I have an azure Linux VM say VM1 having only one network interface with private IP 10.3.0.5
, I have another azure Linux VM say VM2 with two network interfaces, the private IP on primary network interface is 10.3.5.4
, the private IP on the secondary network interface is 10.3.4.4
.
Now I am able to ping VM2 from VM1 on primary network interface of VM2 as
ping 10.3.5.4
but I am not able to ping it in on secondary network interface as ping 10.3.4.4
.
After reading azure docs - https://learn.microsoft.com/en-gb/azure/virtual-machines/linux/multiple-nics#configure-guest-os-for-multiple-nics, they say that you would have to manually add required routes to achieve this.
Similar problem in windows VM - https://support.microsoft.com/en-in/help/4048050/troubleshooter-for-azure-vm-connectivity-problems
here is the result of command route -n
on VM2
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
Now as per the above azure docs, it is missing an entry something like this
0.0.0.0 10.3.4.1 0.0.0.0 UG 0 0 0 eth1
I tried adding this route to my VM2 but after running the following command, my vm just stopped responding
route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.3.4.1 dev eth1
How do I add the correct route for my problem ? Please help !
Copyright License:
Author:「Aak」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer.
Link to:https://stackoverflow.com/questions/56802924/unable-to-communicate-from-one-azure-vm-in-same-virtual-net-to-the-secondary-nic