我有一个蔚蓝的Linux VM,说VM1只有一个具有私有IP is_conforming_to
的网络接口,我还有一个蔚蓝的Linux VM,说VM2具有两个网络接口,主要网络接口上的私有IP是{{1} },则辅助网络接口上的专用IP为10.3.0.5
。
现在,我能够从VM2的主网络接口上的VM1 ping Ping VM2,如下所示:
10.3.5.4
,但无法像ping 10.3.4.4
一样在辅助网络接口上对其进行ping操作。
在阅读了天青的文档-https://docs.microsoft.com/en-gb/azure/virtual-machines/linux/multiple-nics#configure-guest-os-for-multiple-nics之后,他们说您必须手动添加所需的路由才能实现此目的。
Windows VM中的类似问题-https://support.microsoft.com/en-in/help/4048050/troubleshooter-for-azure-vm-connectivity-problems
这是VM2上命令ping 10.3.5.4
的结果
10.3.4.4
现在,根据上述Azure文档,它缺少类似这样的条目
route -n
我尝试将此路由添加到我的VM2,但是运行以下命令后,我的VM刚刚停止响应
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.3.5.1 0.0.0.0 UG 0 0 0 eth0
10.3.4.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
10.3.5.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
168.63.129.16 10.3.5.1 255.255.255.255 UGH 0 0 0 eth0
169.254.169.254 10.3.5.1 255.255.255.255 UGH 0 0 0 eth0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker_gwbridge
如何为我的问题添加正确的路线?请帮忙!
答案 0 :(得分:1)
我的建议是向您的VM1添加另一个网络接口。例如,我有两个网络接口的VMA。主网络接口的专用IP为10.0.3.4
。辅助网络接口的专用IP为10.0.2.5
。
VMA上的命令route -n的结果
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Ifac
0.0.0.0 10.0.3.1 0.0.0.0 UG 100 0 0 eth0
10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
10.0.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
168.63.129.16 10.0.3.1 255.255.255.255 UGH 100 0 0 eth0
169.254.169.254 10.0.3.1 255.255.255.255 UGH 100 0 0 eth0
VMB还具有两个网络接口。主网络接口的私有IP为10.0.1.4
。辅助网络接口上的私有IP为10.0.2.4
。 VMB的专用IP 10.0.2.4
和专用IP 10.0.2.5
位于同一子网中。
VMB上命令route -n的结果
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Ifa
0.0.0.0 10.0.1.1 0.0.0.0 UG 100 0 0 eth
10.0.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth
10.0.2.0 0.0.0.0 255.255.255.0 U 0 0 0 eth
168.63.129.16 10.0.1.1 255.255.255.255 UGH 100 0 0 eth
169.254.169.254 10.0.1.1 255.255.255.255 UGH 100 0 0 eth
因此,在VMA中,我可以通过主网络接口ping 10.0.1.4
,并通过辅助网络接口ping 10.0.2.4
。