I am trying to add 2 default gateways on my Centos8 server with different interface names and metrics. I have a route file for each interface with the route "default via metric ". This is not working as I don't see the routes when I specify "ip route show all". Looks like NetworkManager is not considering the route files with default gateway. So I add the default route using "ip route add" command. This becomes a problem since this doesn't persist on reboot. Any idea how to achieve this and make it persistent?

  • Why not use route add ? route add default gw netmask dev eth0 route add default gw netmask dev eth1. – Overmind Jun 4 at 5:53
  • @Overmind ip route add works well but the routes don't persist after a reboot right? – ram Jun 4 at 14:13
  • For persistent routes, you can create them in /etc/sysconfig/network-scripts/route-eth1 for example. And the syntax is: via dev eth1 – Ron Jun 4 at 15:44
  • As Ron said, they can be made persistent. – Overmind Jun 5 at 5:46
  • Nevermind I figured out the issue. Default routes cannot be added using the route files. I can only add gateway inside the ifcfg file. Thanks anyway. – ram Jun 17 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.