Good time-of-the-day everybody!
I have such problem: I need to configure access to subnet via DHCP configured non-permanent network using NetworkManager on my laptop with Debian Buster. So I can add route in connection's IPv4 Settings -> Routes. I don't know gateway and its changed any connection, so I can't add any in field Gateway. But if I keep Gateway empty, connection created to device, without gateway and with link scope

хх.хх.0.0/16 dev wwp0s20f0u5u6i3 proto static scope link metric 1

What I need to paste to Gateway field to get route with connection's DHCP assigned gateway? Like this

хх.хх.0.0/16 via yy.yy.yy.yy dev wwp0s20f0u5u6i3



OpenVPN supports special gateways, like "net_gateway", which OpenVPN substitutes dynamically.

NetworkManager does not support that. It's a missing feature.

If the connection is a point-to-point link, like a VPN, then might work for you (the gateway wouldn't really matter).

As a workaround you could place a dispatcher script to /etc/NetworkManager/dispatcher.d, see man NetworkManager amd the "pre-up" event. The script could add the route via ip route add.

In general, if you want to configure manual routes, you indeed know the parameters of the network you connect to. You would hence have different connection profiles in NetworkManager, and activate the right one depending on where you are.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.