通过虚拟机路由stream量

我有OpenWRT在虚拟机上运行。 它的networking适配器桥接到主机。

主机ifconfig

root@michael-VirtualBox:/home/michael/Scripts/python# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:8c:1b:c3 inet addr:10.0.2.16 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe8c:1bc3/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:784199 errors:0 dropped:0 overruns:0 frame:0 TX packets:452028 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:953595278 (953.5 MB) TX bytes:30390503 (30.3 MB) 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:4393 errors:0 dropped:0 overruns:0 frame:0 TX packets:4393 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:386626 (386.6 KB) TX bytes:386626 (386.6 KB) 

OpenWRT ifconfig

 root@OpenWrt:~# ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:8A:24:52 inet addr:10.0.2.18 Bcast:10.0.2.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe8a:2452/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:5241 errors:0 dropped:0 overruns:0 frame:0 TX packets:5130 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:461014 (450.2 KiB) TX bytes:1198305 (1.1 MiB) 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:262 errors:0 dropped:0 overruns:0 frame:0 TX packets:262 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:20416 (19.9 KiB) TX bytes:20416 (19.9 KiB) 

如果我想说,从我的主机ping 8.8.8.8 ,并通过虚拟机,我会从主机执行以下操作?

 route add 8.8.8.8 gw 10.0.2.18 

如果是这样,我应该能够看到通过在虚拟机端使用tcpdump ping来的?

当我在OpenWRT虚拟机上执行一个tcpdump的时候,似乎并没有为主机端的每个ping信息抽取信息。

在我route add 8.8.8.8 gw 10.0.2.18 ,我得到了每个ping的回复。

有什么方法可以validationping是否正确路由

更新

tracepath 8.8.8.8输出

 root@michael-VirtualBox:/home/michael/Scripts/python# tracepath 8.8.8.8 1: michael-VirtualBox.local 0.189ms pmtu 1500 1: 10.0.2.2 0.393ms 1: 10.0.2.2 0.539ms 2: no reply 3: no reply 4: no reply 5: no reply 6: no reply 7: no reply 8: no reply 9: no reply 10: no reply 11: no reply 12: no reply 13: no reply 14: no reply 15: no reply 16: no reply 17: no reply 18: no reply 19: no reply 20: no reply 21: no reply 22: no reply 23: no reply 24: no reply 25: no reply 26: no reply 27: no reply 28: no reply 29: no reply 30: no reply 31: no reply Too many hops: pmtu 1500 Resume: pmtu 1500 

ps root @ michael-VirtualBox是我的主机(也运行在VM:P上)

为此,你可以tracepath 。 它会告诉你每一个主机,你ping通过。

不要忘记检查防火墙!