1

I have an Ubuntu 18.04 VM on Azure with 2 NIC's on the same subnet. Both have public IPs but only 1 can access the internet. I tried to modify the netplan file but can only seem to get one or the other to work.

Here is the route table:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         _gateway        255.255.255.255 UGH   100    0        0 eth1
0.0.0.0         _gateway        255.255.255.255 UGH   100    0        0 eth0
default         _gateway        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 eth1
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
168.63.129.16   _gateway        255.255.255.255 UGH   100    0        0 eth0
169.254.169.254 _gateway        255.255.255.255 UGH   100    0        0 eth0

And the netplan:

network:
    ethernets:
        eth0:
            dhcp4: true
            routes:
            - to: 0.0.0.0
              via: 10.0.0.1
              metric: 100
            # dhcp4-overrides:
                #route-metric: 100
                #use-routes: false
            dhcp6: false
            match:
                driver: hv_netvsc
                macaddress: 60:45:bd:c0:aa:ff
            set-name: eth0
        eth1:
            dhcp4: true
            routes:
            - to: 0.0.0.0
              via: 10.0.0.1
              metric: 100
              #dhcp4-overrides:
              # route-metric: 200
            dhcp6: false
            match:
                driver: hv_netvsc
                macaddress: 60:45:bd:c7:6a:d7
            set-name: eth1
    version: 2

In this config I can only access (ping) the internet from eth0. I tried to override the DHCP route and set the default on 1 nic only but that didn't seem to work. Both NIC have static IPs in Azure. Appreciate any tips.

edit:

So interestingly, I updated my netplan and set static IPs and disable dhcpv4 but systemd is still inherting the route from DHCP so I believe that is the issue but I am not sure how else to disable it if I set it to disabled in netplan

systemd-networkd[2711]: eth1: DHCPv4 address 10.0.0.5/24
systemd-networkd[2711]: eth1: DHCP: No routes received from DHCP server: No data available
systemd-networkd[2711]: eth1: Configured
systemd-networkd[2711]: eth0: DHCPv4 address 10.0.0.4/24 via 10.0.0.1
systemd-networkd[2711]: eth0: Configured

shelum
  • 21

1 Answers1

1

I found this other question that was my exact use case. It appears to have resolved my issue.

Set up two IP addresses with one gateway?

shelum
  • 21