I have two ISP options where both provide DHCP leases. I want the secondary (and possibly a 3rd when they allow & if needed) as a failover if the first (or second) fails, eg:
After reviewing Netplan examples, it is a little confusing to see how to bridge these (or even if a bridge is necessary) while having the main interface receive IP config values via DHCP from the ISP and then to hand that off to a static output to the LAN at 192.168.10.1, for example. It appears that you might do something like this:
network:
version: 2
renderer: networkd
ethernets:
# LAN interface
eth0:
optional: true
dhcp4: no
addresses:
- 192.168.10.1/24
# Is a gateway necessary since it provides a bridge?
gateway4: 192.168.1.1
nameservers:
addresses: [1.1.1.1, 192.168.1.1]
# ISP 1 interface
eth1:
optional: true
dhcp4: true
# ISP 2 interface
eth2:
optional: true
dhcp4: true
# ISP 3interface
eth3:
optional: true
dhcp4: true
bridges:
br0:
addresses: [ 192.168.10.1/24 ]
interfaces: [ eth0 eth1 eth2 eth3 ]
It also appears that metric values might need to be assigned to the ISP interfaces... But then again, I see other examples that make me think I may be going about this wrong.
What would or should be used in this situation as far as a Netplan conf goes?
UPDATE: heynnema's answer seems close below and localhost (on Ubuntu Server) get's to the Internet fine, however while a test system can ping to 192.168.10.1
just fine, it can't ping on out to 1.1.1.1
and thus it appears that there's still a routing issue between eth0
and eth(1|2|3)
.
As per request, ip addr
and ip route
ouptput:
https://gist.github.com/ylluminate/6435840c37edc01e82c047c61f4c071b
Maybe start with something closer to this...
Note: This doesn't take into account having to come up with routing tables for iptables.
sudo netplan --debug generate
sudo netplan apply
reboot
You cannot use a bridge or bond to treat upstream links from multiple ISPs the same, because none of your ISPs are going to route traffic that uses the IP of the other.
Since you say you only care about using the additional ISPs as failover, then you probably should simply set route metrics for each of the uplinks, and use NAT so that internal machines do not have to care about changes to the active uplink network.