Why does deleting a gateway route and then re-adding it make routing suddenly work?
Solution 1:
The destination IP address matches two routes with the same network and prefix length (default
meaning 0.0.0.0/0
). When this happens, the route with the lowest metric – i.e. the lowest cost – is the one that gets used.
In the first example, you aren't using 10.100.0.1 as the gateway at all – it has a metric of 101, so the OS ignores it and uses 192.168.100.1 as the gateway because its metric (100) is lower.
But in the second example, you've re-added the route without specifying a metric, so it is treated as if it had a metric of zero, i.e. highest possible priority.