NetworkManager adds second default route if processing DHCP lease
Hello all,
first of all, I don't know, if this is a bug or a feature.
Nevertheless, I have a problem with the combination of NetworkManager, OpenVPN and the resulting routing table.
Let's start from the beginning... At first, there is only one interface 'wlp58s0', configured by NetworkManager and DHCP. The routing table is:
default via 192.168.40.1 dev wlp58s0 proto dhcp metric 600
192.168.40.0/22 dev wlp58s0 proto kernel scope link src 192.168.42.39 metric 600
After activating OpenVPN with the parameter redirect-gateway
, I get the expected routing table (replaced public IP):
default via 10.8.0.1 dev tun0
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.2
XXX.XXX.XXX.XXX via 192.168.40.1 dev wlp58s0
192.168.40.0/22 dev wlp58s0 proto kernel scope link src 192.168.42.39 metric 600
Note: OpenVPN is started "by hand", i.e without importing the config into NetworkManager. Reason: the required line route XXX.XXX.XXX.XXX 255.255.255.255 net_gateway
is unsupported by NetworkManager (gives import error).
And now comes the problem: if the DHCP lease time arrives, NetworkManager reports this:
Feb 21 20:33:51 xps13 NetworkManager[530]: <info> [1550777631.2085] dhcp4 (wlp58s0): address 192.168.42.39
Feb 21 20:33:51 xps13 NetworkManager[530]: <info> [1550777631.2086] dhcp4 (wlp58s0): plen 22
Feb 21 20:33:51 xps13 NetworkManager[530]: <info> [1550777631.2086] dhcp4 (wlp58s0): expires in 3600 seconds
Feb 21 20:33:51 xps13 NetworkManager[530]: <info> [1550777631.2087] dhcp4 (wlp58s0): nameserver '195.146.128.62'
Feb 21 20:33:51 xps13 NetworkManager[530]: <info> [1550777631.2087] dhcp4 (wlp58s0): nameserver '195.146.132.58'
Feb 21 20:33:51 xps13 NetworkManager[530]: <info> [1550777631.2088] dhcp4 (wlp58s0): gateway 192.168.40.1
Feb 21 20:33:51 xps13 NetworkManager[530]: <info> [1550777631.2098] dhcp4 (wlp58s0): state changed bound -> bound
Feb 21 20:33:51 xps13 NetworkManager[530]: <info> [1550777631.2125] policy: set 'Auto Alexander' (wlp58s0) as default for IPv4 routing and DNS
and the routing table contains two default entries:
default via 10.8.0.1 dev tun0
default via 192.168.40.1 dev wlp58s0 proto dhcp metric 600
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.2
XXX.XXX.XXX.XXX via 192.168.40.1 dev wlp58s0
192.168.40.0/22 dev wlp58s0 proto kernel scope link src 192.168.42.39 metric 600
I think, NetworkManager should set the routing table only if bringing an interface up or down, but not if processing DHCP lease times. Is there any config flag to prevent NetworkManager from setting (adding) the default route at this step?
For reference: using Arch Linux, package "networkmanager 1.14.5dev+17+gba83251b-2"
Thanks a lot and best regards, Stefan