出现以下情况:有2台虚拟计算机(定义为A和B(,每台运行Ubuntu 16.04。两者的网络配置:
Adapter1 : Host-only with Promiscuous Allow All
Adapter2: Nat Network with Promiscuous Allow VM's
两台计算机的mac地址不同
PC A:
带mac的主机专用适配器(080027B2EBC7(
带有mac的NAT网络适配器(0801273F605C(
PC B:
带mac的主机联机适配器(0800272DC6FF
(
带mac的Nat网络适配器(080027B8CEC1
(
计算机A:通过终端,通过命令发送ping:
ping google.com
而计算机A正在ping打开计算机B上的wireshark。
我看不到我从PC A在PC B上的Wireshark上发送的icmp数据包。
两台电脑的ifconfig:
A:
enp0s3 Link encap:Ethernet HWaddr 08:00:27:b2:eb:c7
inet addr:192.168.56.103 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::717a:1d3f:cf7d:a25f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:83 errors:0 dropped:0 overruns:0 frame:0
TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:8788 (8.7 KB) TX bytes:6807 (6.8 KB)
enp0s8 Link encap:Ethernet HWaddr 08:00:27:3f:60:5c
inet addr:10.0.2.4 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::955f:36a:18c3:706f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:17 errors:0 dropped:0 overruns:0 frame:0
TX packets:65 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2689 (2.6 KB) TX bytes:7197 (7.1 KB)
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:71 errors:0 dropped:0 overruns:0 frame:0
TX packets:71 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:21609 (21.6 KB) TX bytes:21609 (21.6 KB)
B:
enp0s3 Link encap:Ethernet HWaddr 08:00:27:2d:c6:ff
inet addr:192.168.56.101 Bcast:192.168.56.255 Mask:255.255.255.0
inet6 addr: fe80::ca16:a283:da31:e0a2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:97 errors:0 dropped:0 overruns:0 frame:0
TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11541 (11.5 KB) TX bytes:6333 (6.3 KB)
enp0s8 Link encap:Ethernet HWaddr 08:00:27:b8:ce:c1
inet addr:10.0.2.7 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::b3c3:7fd:e18c:ccd3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:54 errors:0 dropped:0 overruns:0 frame:0
TX packets:58 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:7449 (7.4 KB) TX bytes:6511 (6.5 KB)
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:95 errors:0 dropped:0 overruns:0 frame:0
TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
也许我对虚拟机网络的概念有一个错误的理解。
感谢您帮助
你没有明确表示你的问题,但我认为你想在VM-B上看到ICMP流量,当你从VM-A ping谷歌时,如果是这样,那么你就有一个错误:
您可以通过其访问VM-B的主机专用适配器不适用于外部/外部/公共(更清晰的(网络。
您可以使用此命令检查哪个iface用于路由:
ip route get $(host google.com | head -n1 | grep -oP '[0-9][0-9.]+')
如果你想将其路由为VM-A->VM-B->互联网,那么你必须为设置默认(或专用(路由