custom route not working on windows

You've got 10/8 on a local network interface. Windows will not try to route a packet to a 10/8 subnet (10.21/16 is a subnet of 10/8); there's no routing involved at all.


Your routing table looks correct. It's possible that your VPN network filter driver doesn't use the routing table but routes the packets destined to 10.21.0.0/16 directly to the VPN adapter, or even drops them.

Can you try the same configuration but with your VPN filter driver disabled in the network connection properties? You should see an item for the VPN software in the properties, just uncheck it and click OK to disable it. The image below is from my computer so it doesn't have one. If you don't see any VPN related item either, the VPN software must use the routing table after all, as I don't see how it could bypass it without its own filter driver.

Network Connection Properties

For the record, I added the same routes on my computer and got similar results with the route print commands, so I'm not sure if they indicate any problem even though it's surprising that 10.21.0.1 gets no matches. I filtered the output to show only the relevant parts.

C:\>route print 10.*
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
         10.0.0.0        255.0.0.0      192.168.1.1     192.168.1.2       1
        10.21.0.0      255.255.0.0      192.168.1.1     192.168.1.2       1
Default Gateway:       192.168.1.1
===========================================================================
Persistent Routes:
  None

C:\>route print 10.21.*
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
        10.21.0.0      255.255.0.0      192.168.1.1     192.168.1.2       1
Default Gateway:       192.168.1.1
===========================================================================
Persistent Routes:
  None

C:\>route print 10.21.0.1
===========================================================================
Active Routes:
Default Gateway:       192.168.1.1
  None
Persistent Routes:
  None

The route with the longest matching prefix is always preferred, so the route metric has no effect in this case. The metric is only used if there are two routes with the same prefix.