Azure – Multi-NIC Linux VM (ubuntu 16.04 LTS) in Azure and default gateway route

azureazure-networkingnic

Can some one please share steps on how to add default gateway address route permanently to the route table on Ubuntu 16.04 LTS on Azure for the secondary nic?

As you know Azure DHCP only populate the default gateway address for the primary nic.

so basically, in my route table I want to have eth0 –> default gateway address pointing to the subnet gateway address (xx.1) that it is attached to (this is all fine since it's handled by the azure because it's a primary nic) and for the secondary nic i.e. eth1 –> i have to add a manual default gateway address for the subnet that this nic is attached. hoping this is clear and makes sense

Here is the document that I'm referring that provides the background.

https://docs.microsoft.com/en-us/azure/virtual-machines/linux/multiple-nics#configure-guest-os-for-multiple-nics

Appreciate any help.

Best Answer

https://my.esecuredata.com/index.php?/knowledgebase/article/2/add-a-static-route-on-centos

ip route add ???.16.5.0/24 via ??.0.0.101 dev eth?

You MUST make sure that the IP address is the start of the CIDR address range you have been allocated, otherwise it will fail.

http://jodies.de/ipcalc

will help you find the CIDR start, of you only have one IP address and mask to go by.

Related Topic