IP Routes - Route Mapping

1

I've been reading up on static routes and such while studying for my next MS exam, and am wondering - in CMD, if you do a route print -4 you get a Active Route Output such like this:

Destination 0.0.0.0
Netmask     0.0.0.0
Gateway     192.168.0.1
Interface   192.168.0.5

Is this just a default route which routes all traffic (regardless of the IP/Subnet being requested) to the default gateway?

If so - what does the 0.0.0.0 attempt to define?

If not - what does this route actually do?

Cheers!

PnP

Posted 2012-09-01T17:57:24.277

Reputation: 923

20.0.0.0 is the first address where all bits are zero. 0.0.0.0 is the netmask where any bit of address could be either zero or one, ie. the range of addresses will be 0.0.0.0-255.255.255.255 ie. all IP addresses and therefore the name "default route" – Cougar – 2012-09-01T18:16:13.167

Answers

1

It is a default route, but it does not route (match) all traffic.
Packet will be routed via default if no better route exists. In other words it says - I (router) tried to match this packet to all networks I know of and failed. But I know this guy, default gateway, who may be more knowledgeable than I am, so I kick the can along (and forward to him).

That's why a default route is also known as Route of last resort.

Now why those 0.0.0.0 entries:
In order to check if an IP address matches given route entry, your (router) device will compare it to Destination. Netmask dictates how many leftmost bits must match (at least as many as 1s in Netmask). If multiple route entries match, longest match is selected as best. How this works with 0.0.0.0 as Netmask?
Any IP will match - because it needs to match on 0 bits. By the same token, it will be shortest possible match so it will be used only if there are no more specific matches.

Why Destination is shown as 0.0.0.0? To get network address, you zero host bits (by bitwise ANDing IP with netmask). Because of that for 0.0.0.0 mask the only valid network address is also 0.0.0.0

wmz

Posted 2012-09-01T17:57:24.277

Reputation: 6 132