Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question
2  
0.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 Sep 1 '12 at 18:16
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.