Field Notes D02
Configure Ubuntu to Support Multiple NICs in Azure
By default, in Linux, if multiple NICs are in the same subnet, all traffic will route through the default NIC, which is usually eth0. If multiple NICs are added, and you need to route traffic back through the NIC that received it, you need to create a routing table for that NIC. Refer to How to create a Linux virtual machine in Azure with multiple network interface cards.
However, newer Ubuntu releases do not use /etc/sysconfig/network-scripts anymore. Here are the steps for Ubuntu:
sudo -i
bash -c "echo '200 eth1-rt' >> /etc/iproute2/rt_tables"
vi /etc/network/interfaces.d/eth1.cfg
# Configure second NIC and populate new routing table
auto eth1
iface eth1 inet dhcp
post-up ip route add 10.0.1.0/24 dev eth1 src 10.0.1.5 table eth1-rt
post-up ip route add default via 10.0.1.1 dev eth1 table eth1-rt
post-up ip rule add from 10.0.1.5/32 table eth1-rt
post-up ip rule add to 10.0.1.5/32 table eth1-rt