我尝试连接到VirtualBox中的来宾操作系统上运行的服务器。 VirtualBox配置为为guest虚拟机分配静态IP。但是,我很确定它分配的IP实际上属于主机。如果我在主机上运行了nginx服务器,则主机服务器会拦截对vboxnet1 IP的请求,并且永远不会到达guest虚拟机。
主持人和访客都是Debian。
此外,无论是否启用VirtualBox DHCP服务器,我都会得到相同的结果。
这里是VirtualBox网络设置(无法用< 10 rep ... sigh嵌入图片):
虚拟机网络设置:
我还尝试使用不同的主机IP地址,没有变化。
主机上的ifconfig:
$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:90:f5:e8:b0:e0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:183363 errors:0 dropped:0 overruns:0 frame:0
TX packets:183363 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:70022881 (70.0 MB) TX bytes:70022881 (70.0 MB)
vboxnet1 Link encap:Ethernet HWaddr 0a:00:27:00:00:01
inet addr:192.168.66.1 Bcast:192.168.66.255 Mask:255.255.255.0
inet6 addr: fe80::800:27ff:fe00:1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:2545 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:308371 (308.3 KB)
wlan0 Link encap:Ethernet HWaddr 24:fd:52:c0:1b:b1
inet addr:192.168.2.106 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::26fd:52ff:fec0:1bb1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11724555 errors:0 dropped:0 overruns:0 frame:0
TX packets:7429276 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16204472393 (16.2 GB) TX bytes:1222715861 (1.2 GB)
主持人的iptables:
$ sudo iptables -L
[sudo] password for aidan:
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
这是一个比较主机IP和'来宾' IP:
$ nmap 192.168.66.1
Starting Nmap 6.40 ( http://nmap.org ) at 2015-07-22 13:28 CEST
Nmap scan report for 192.168.66.1
Host is up (0.00015s latency).
Not shown: 995 closed ports
PORT STATE SERVICE
139/tcp open netbios-ssn
445/tcp open microsoft-ds
902/tcp open iss-realsecure
3128/tcp open squid-http
5050/tcp open mmcc
Nmap done: 1 IP address (1 host up) scanned in 0.16 seconds
$ nmap 192.168.2.106
Starting Nmap 6.40 ( http://nmap.org ) at 2015-07-22 13:28 CEST
Nmap scan report for 192.168.2.106
Host is up (0.00015s latency).
Not shown: 995 closed ports
PORT STATE SERVICE
139/tcp open netbios-ssn
445/tcp open microsoft-ds
902/tcp open iss-realsecure
3128/tcp open squid-http
5050/tcp open mmcc
Nmap done: 1 IP address (1 host up) scanned in 0.17 seconds