Hoopdady
Hoopdady

Reputation: 2356

Make route go out right gateway

I guess I just don't understand how routes work. My routing table has a route for 0.0.0.0 with a netmask of 0.0.0.0 with the lowest metric of all other routes. Doesn't that mean none of the other routes matter, since that encompasses every IP, and it was my understanding that the lowest metric wins?

Either way, by default, everything should route out the 10.236.35.52 interface, but I would like 64.233.0.0 with a newm with a netmask of 255.255.0.0 to route different interface than the default, interface 192.168.116.244. I tried making two routes for that path, one for the interface I want (192.168.116.244) with a lower weight (metric) and one for the default interface with a higher weight (metric). Hoping this would override the 0.0.0.0 route at the top. My logic might be completely wrong, in fact it probably is, because its not working. Anyone have any idea what I'm doing wrong.

enter image description here

Upvotes: 0

Views: 1124

Answers (1)

Ente
Ente

Reputation: 2462

Doesn't that mean none of the other routes matter, since that encompasses every IP, and it was my understanding that the lowest metric wins?

No. Routes are considered in order according to the number of bits set to 1 in the netmask. For example, a route with a 255.255.255.255 (32 bits set to 1) netmask is very specific and has the highest precedence, since it only matches one IP. 0.0.0.0, or 00000000000000000000000000000000 in binary, is your default gateways and has zero bits set to 1.

If multiple routes match, the route with the lowest metric will be used.

Upvotes: 3

Related Questions