基本网络:浏览到另一台机器上运行的Rails站点 [英] Basic networking: browsing to Rails site running on another machine

查看:82
本文介绍了基本网络:浏览到另一台机器上运行的Rails站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在计算机A上运行一个Rails站点.我从rails server开始该站点,然后在http://localhost:3000浏览到它.电脑B在同一个WIFI网络上.在计算机B上,我可以访问http://192.x.y.z:3000的站点,该站点是从OS X终端中的ifconfig获取计算机A的IPv4地址的.

I'm running a Rails site on computer A. I start the site with rails server and browse to it at http://localhost:3000. Computer B is on the same WIFI network. From computer B I can visit my site at http://192.x.y.z:3000 where the IPv4 address of computer A is obtained from ifconfig in the OS X Terminal.

如何在不使用无线路由器的情况下从计算机B浏览到我的站点(在计算机A上运行)??我仍然在两台计算机上都启用了WIFI.但是,我不希望计算机通过附加的WIFI路由器进行通信.

How can I browse to my site (running on computer A) from computer B without using the wireless router? I'll still have WIFI enabled on both computers. However I don't want the computers to communicate through the additional WIFI router.

我目前的理解是WIFI路由器为网络上的各种设备分配IP地址.在尝试回答我的问题时,我想知道在删除无线路由器后,谁/将为计算机分配IP地址.

My current understanding is the WIFI router assigns IP addresses to the various devices on the network. In trying to answer my question I wondered who/what will assign IP addresses to the computers when the wireless router is removed.

我的目标是学习有关网络的更多信息.如果需要的话,我可以做一些底层套接字编程.

My goal is to learn more about networking. I'm fine doing some low-level sockets programming if that's what it takes.

推荐答案

您可以在两台计算机之间创建一个Ad-Hoc WiFi网络,该网络无需路由器即可工作.两者仍将尝试从第三方获取IP地址,但是这当然会失败.在这种情况下,他们将依靠IP自分配功能,并选择169.x范围内的随机IP.这将花费一分钟左右的时间,但是一旦发生,您就可以访问该地址上的另一台计算机.也可以选择在两台计算机上手动设置固定IP.

You can create an Ad-Hoc WiFi network between the two computers, which works without a router. The two will still try to get an IP address from a 3rd party, which will of course fail though. In this case they'll fall back on IP self-assignment and pick a random IP in the 169.x range. This will take a minute or so, but once it happened, you can access the other machine on that address. Manually setting a fixed IP on both machines is an option as well.

这篇关于基本网络:浏览到另一台机器上运行的Rails站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆