Host:
OS:Windows 7
IP:192.168.1.43
Guest:
OS: Oracle Linux 6.2 64bit
IP: 192.168.56.201(Host Only Ethernet Adapter)
Gateway:192.168.56.1
問題:
從win7 ping linux 沒有問題,但是從linux ping win7失敗。
說明:
在網路上有人提到可以增加一個NAT的網路介面,所以我也增加一個。
因此我的guest上有兩塊網路卡,資訊如下:
eth0:192.168.56.201(Host Only Ethernet Adapter)
eth1:10.0.3.2(NAT)
再測一次,從linux ping win7,還是失敗。
查詢路由表:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.3.0 * 255.255.255.0 U 1 0 0 eth1
192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0
192.168.56.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default 192.168.56.1 0.0.0.0 UG 0 0 0 eth0
預設的Gateway是192.168.56.1,增加一條routing rule
# route add -net 192.168.1.0 netmask 255.255.255.0 dev eth1 gw 10.0.3.2
查詢路由表:
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 10.0.3.2 255.255.255.0 UG 0 0 0 eth1
10.0.3.0 * 255.255.255.0 U 1 0 0 eth1
192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0
192.168.56.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default 192.168.56.1 0.0.0.0 UG 0 0 0 eth0
再試一次,從linux ping win7 ,成功。
# ping -c 3 192.168.1.43
PING 192.168.1.43 (192.168.1.43) 56(84) bytes of data.
64 bytes from 192.168.1.43: icmp_seq=1 ttl=128 time=3.44 ms
64 bytes from 192.168.1.43: icmp_seq=2 ttl=128 time=1.10 ms
64 bytes from 192.168.1.43: icmp_seq=3 ttl=128 time=0.904 ms