有一种情况: 有2台虚拟计算机(定义为A和B),每台运行Ubuntu 16.04。 在它们两个上进行网络配置: 适配器1:仅主机,混杂允许全部 Adapter2:具有允许混合虚拟机的Nat网络 两台计算机的Mac地址都不同
PC A: 带有mac的仅主机适配器(080027B2EBC7) 带有mac(0800273F605C)的NAT网络适配器
PC B:
带有mac(0800272DC6FF
)的主机onlt适配器
带有mac(080027B8CEC1
)的Nat Network适配器
计算机A:通过终端通过以下命令发送ping命令:
ping google.com
在计算机A对计算机B上的线缆进行ping操作时
我无法在PC B的Wireshark上看到从PC A发送的icmp数据包。
两台PC的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
也许我对虚拟机网络的想法有错误的理解。
感谢您的帮助
答案 0 :(得分:0)
您没有明确说明您的问题,但是我想您想在VM-B上查看ICMP流量,当您从VM-A ping谷歌时,如果是这样,则说明有误:
Host-Only adapter(通过它可以访问VM-B)不适用于外部/外部/公共(更清楚的地方)网络。
您可以使用此命令来检查哪个iface用于路由:
ip route get $(host google.com | head -n1 | grep -oP '[0-9][0-9\.]+')
如果要将其路由为VM-A-> VM-B-> Internet,则必须为此设置默认(或专用)路由