I like NetworkManager
, it has good functionality, reliability, configuration. There’s good GUI and CLI tools for it. When using the “Advanced Network Configuration” GUI (nm-connection-editor
) there’s an option within the routes section (IPv4 Settings → Routes) that sets the ipv4.never-default
config. “Use this connection only for resources on its network”
My understanding is when this option is on, it will only use the route when accessing hosts within the same subnet. However, in my tests this is not working and I would like some help to achieve my needs.
I have a system connected to two networks, one has access to the Internet and the other does not. Two NICs, two Ethernet cables, two routers. Let’s say 192.168.1.x
and 192.168.2.x
. I need to be able to access hosts on the second network but I want everything else to default to the first. What’s happening is when I try to access Internet, it’s attempting to route through the network that doesn’t have Internet access.
My temporary fix is to just manually disconnect the Internet access NIC and reconnect it. I have tried changing the autoconnect order but it doesn’t seem to make a difference. Though manually it appears to use the most recently connected network as the default route.
If you know how to do achieve this using something other than NetworkManager
, such as systemd-networkd
. I’m open for suggestions.