Ask Your Question

Proper Way To Hard Code Default Route with NM running

asked 2018-07-12 16:01:06 -0600

saltydog gravatar image

What is the proper way to hard code the default route on Fedora Core 28 Server running NetworkManager? I know I can turn it off, but that invariably causes systemd complaints. Were it just the one interface and basic routes it would be okay to let NM decide but it starts getting it wrong the second I add a route to an external network , changing the default route as in nmcli con del enp2s0 +ipv4.routes ipv4.gateway which resets the wanted default of to *.70. Adding ipv4.never-default true will turn off DEFROUTE in the config file but it will also strip any GATEWAY designation which is not added except during nmcli con add ...

nmcli will create a route-ifname file for the route in NM syntax. As an alternate, it can take 'ip' syntax which it does if I add a file like: via dev enp2s0
default via dev enp2s0

but when it comes up, it hasn't actually set a gateway route but a host route, so my guess it's just ignoring it.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-07-12 17:08:19 -0600

saltydog gravatar image

Well, as happens just after posting, I discovered a workaround was to add the additional routes via the NM dispatcher drop-in:



[ "$2" != "up" ] && exit 0
[ "$1" != "enp2s0" ] && exit 0

/usr/sbin/ip route add via

And then leave NM to set the default route on it's own. It's not exactly robust but it survives reboot

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-07-12 16:01:06 -0600

Seen: 24 times

Last updated: Jul 12 '18