I have a VM in Azure with Ubuntu 19.04 and 4 NICs, each one has a public IP attached to it, as an example, this is the second NIC:
As you can see, it has public IP 191.234.186.19.
My objective is to be able to access the internet from each NIC with a different IP address, but inside the VM I'm only able to access it with the first network eth0
.
Looking at # route -n
I get this output:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.0.1 0.0.0.0 UG 100 0 0 eth0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
168.63.129.16 10.0.0.1 255.255.255.255 UGH 100 0 0 eth0
169.254.169.254 10.0.0.1 255.255.255.255 UGH 100 0 0 eth0
I tried to add routes for the other NICs with the following commands:
sudo ip route add default via 10.0.0.1 dev eth1 metric 101
sudo ip route add default via 10.0.0.1 dev eth2 metric 102
sudo ip route add default via 10.0.0.1 dev eth3 metric 103
But again I still can't connect to the internet with these NICs, only eth0
.
Am I missing something? Should I need to change/configure anything else to make this work?
For completeness, I'm using this command to test the connectivity:
curl --interface eth1 api.ipify.org?format=json -w "\n"
And my VM is the same as the one in this article: article