0

I'm using openconnect to connect to my office VPN. They push some pretty crappy/aggressive routing rules allocating ALL of the private IP address spaces >.<

After I connect to my office VPN, my main routing table contains these routes (it contains a lot more actually, but those are the colliding subnets):

192.168.0.0/24 dev p4p1  proto kernel  scope link  src 192.168.0.200 
192.168.0.0/16 dev tun0  scope link

As you can see, all traffic to 192.168.0.0/16 should be routed through tun0. The weird thing though is that it's not.

If I ping a machine in my home LAN (192.168.0.0/24), the ICMP packet reaches the machine and generally everything works OK, so I assume that packets to 192.168.0.0/24 don't go through the VPN connection.

My question is the following, how does the Linux kernel deal with colliding subnets? I'm suspecting that it chooses to use most precise route, in this case 192.168.0.0/24. Could you please point me to a document that describes this or provide some hints?

3

Actually it's not colliding. One subnet has more specific mask

192.168.0.0/24 has more specific mask than 192.168.0.0/16

For example default gateway is default because it has less specific mask /0.

If you add a route to 192.168.0.3/32 via another interface it would have more specific mask than other two routes.

| improve this answer | |

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.