why changing metric doesn't impact route selection

by vinczo   Last Updated July 11, 2019 18:00 PM - source

I have the following output for my default route :

Kernel IP routing table Destination     Gateway         Genmask        Flags Metric Ref    Use Iface
0.0.0.0         192.168.167.1   0.0.0.0         UG    100    0        0 enp1s0
192.168.167.0   0.0.0.0         255.255.255.0   U     100    0        0 enp1s0

And here the selected route to 8.8.8.8. Until here, nothing extraordinary.

traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  192.168.167.1 (192.168.167.1)  0.326 ms  0.465 ms  0.527 ms
 2  192.168.1.254 (192.168.1.254)  1.409 ms  1.422 ms  1.429 ms

When I activate the VPN, the route becomes :

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.8.0.13       128.0.0.0       UG    0      0        0 tun0
0.0.0.0         192.168.167.1   0.0.0.0         UG    100    0        0 enp1s0
10.8.0.1        10.8.0.13       255.255.255.255 UGH   0      0        0 tun0
10.8.0.13       0.0.0.0         255.255.255.255 UH    0      0        0 tun0
128.0.0.0       10.8.0.13       128.0.0.0       UG    0      0        0 tun0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 tun0
192.168.167.0   0.0.0.0         255.255.255.0   U     100    0        0 enp1s0
213.246.56.21   192.168.167.1   255.255.255.255 UGH   0      0        0 enp1s0

Whatever value I set for tun0 metric :

sudo ifmetric tun0 3000

route -n output :

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.8.0.13       128.0.0.0       UG    3000   0        0 tun0
0.0.0.0         192.168.167.1   0.0.0.0         UG    100    0        0 enp1s0
10.8.0.1        10.8.0.13       255.255.255.255 UGH   3000   0        0 tun0
10.8.0.13       0.0.0.0         255.255.255.255 UH    3000   0        0 tun0
128.0.0.0       10.8.0.13       128.0.0.0       UG    3000   0        0 tun0
169.254.0.0     0.0.0.0         255.255.0.0     U     3000   0        0 tun0
192.168.167.0   0.0.0.0         255.255.255.0   U     100    0        0 enp1s0
213.246.56.21   192.168.167.1   255.255.255.255 UGH   0      0        0 enp1s0

The selected route is always going through interface tun0 :

traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
 1  10.8.0.1 (10.8.0.1)  28.510 ms  33.924 ms  33.941 ms
 2  ik056002.ikoula.com (213.246.56.2)  33.960 ms
...

Why ??

Thanks !

Tags : route


Related Questions




Breakpoint is not hit in VS2017

Updated December 26, 2017 17:00 PM

Windows Static route

Updated October 09, 2018 17:00 PM