Answer the question
In order to leave comments, you need to log in
2 main gateways on linux ubuntu?
How to make 2 default gateways per network interface in netplan?
registered routes and a metric in Netplan. But it does not switch to the second gateway if you disable the first one.
network:
ethernets:
ens33:
dhcp4: no
addresses:
- 150.150.150.4/24
routes:
- to: 0.0.0.0/0
via: 150.150.150.2
metric: 100
- to: 0.0.0.0/0
via: 150.150.150.3
metric: 101
[email protected]:~# routel
target gateway source proto scope dev tbl
default 150.150.150.2 static ens33
default 150.150.150.3 static ens33
Answer the question
In order to leave comments, you need to log in
Write a script that will be run by cron, check availability and reconfigure the route.
Of course (without a script) it will work under two conditions:
1) each gateway is connected through its own interface;
2) the link must physically fall on one of the interfaces, then the route will go through the other, in accordance with the metric; if there is no ping, but there is a link - even if you crack, it will be hammered by the minimum metric. I agree that this is pretty dumb for 2020, but as it is.
PS well, or use all sorts of dynamic routing protocols, this is a separate conversation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question