[Solved] Preventing automatic metric reset

I use Ethernet and Wifi connections in parallel. Both are connected to the same IP network. I would like to prefer Ethernet one whenever it is connected, but use also WiFi, when not. I achieve the goal temporarily by setting different metrics to interfaces. The problem is, however, that after some time the metrics reset automatically to 0. How to prevent such an automatic metric reset?
After manual set:
After some time:
After manual set:
- Code: Select all
[root@pmrnote etc]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.18.0.1 0.0.0.0 UG 66 0 0 enp2s0
172.18.0.0 0.0.0.0 255.255.255.192 U 66 0 0 enp2s0
172.18.0.0 0.0.0.0 255.255.255.192 U 666 0 0 wlp1s0
After some time:
- Code: Select all
[root@pmrnote etc]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.18.0.1 0.0.0.0 UG 0 0 0 enp2s0
172.18.0.0 0.0.0.0 255.255.255.192 U 0 0 0 enp2s0
172.18.0.0 0.0.0.0 255.255.255.192 U 0 0 0 wlp1s0