Default routing

I know what default routing is.What confuses me is what do we achieve exactly by seting 0.0.0.0/0 as IP address in the case of a default routing entry in the router.

From what i know in the case where the router gets a packet with a

destination IP Address he does not know than the router will send the packet to another router,so the IP address of that other router i suppose should be in the routing table. By 0.0.0.0/0 where does the packet goes?

P.S Anyone who knows about and has worked default routing should know this strange 0.0.0.0/0 IP address.

Thank you.

Reply to
thejim
Loading thread data ...

gets a packet with adestination IP Address he does not know than the router will send the

A default route is installed in the routing table as any other route is and has either a next hop IP address or an egress interface or both.

Cisco router sperform a longest match lookup on the destination address and default route is included in this lookup.

Reply to
Merv

thejim schrieb:

simplyfied: the default route is just a normal routing entry the routing decision is made by performing a match of the target IP against the routing table and the default route (0.0.0.0/0) will match ALL targets (0.0.0.0/0=0.0.0.0/0.0.0.0 => 0.0.0.0-255.255.255.255).

Reply to
klaus zerwes

You should consider 0.0.0.0/0 as a network address, not a single IP address.

That's true.

"0.0.0.0/0" without any further informatiosn *is not* a valid default route because you need a gateway for "0.0.0.0/0" too. That's why you have to configure it somehow like this:

ip route 0.0.0.0 0.0.0.0 192.168.0.1

There is your missing "router ip".

It's not really strange, it's just the largest IPv4 network you could have: from 0.0.0.0 up to 255.255.255.255. It contains *all* the IPv4 address space.

The default route is nothing special, it's only a route with a big destination network.

Reply to
Gerald Krause

Hi Jim,

Note that "0.0.0.0/0" is not a complete routing statement, its just PART of a routing entry. What is the critical part thats missing?

The 0.0.0.0/0 only defines the RANGE of addresses that need to be routed, not the destination address for that range.

You appear to be missing critical information. Remember that Routing consists of at least 2 essential components - 1. WHAT needs to be routed. 2. WHERE it needs to be routed.

The same detail is required for EVERY Routing entry, no exception.

The WHAT is the Network Address or Range that is being routed (in your case 0.0.0.0/0), the WHERE is the next hop info. The Network 0.0.0.0/0 effectively says "everything" is to be routed, but you dont say what you are using for the Next Hop info...

Note that a Next Hop is USUALLY the IP address of the Next hop station, but it can also be the EXIT Interface on the Router.

Cheers.................pk.

Reply to
Peter

thejim

It occurs to me that the fundamental algorithm of IP routing needs to be explained to you in order for you to see that the "0.0.0.0/0" IP

*routing* address is not at all strange, is very logical and is actually what identifies the routing statement in which it provides the *destination* specification as the *default* routing statement.

Note that what the other responders have said is incorporated into what I am about to explain. If it isn't I wait to hear from them.

-

An IP packet arrives at a router.

Some packets may actually be destined for the router itself since the packet could be, for example, an SNMP GET packet - or - the "router" could be an application-supporting node which is also prepared to be a router. Thus the first test is whether or not the packet is destined for the node itself.

If the destination address is one of the "home" addresses, that is an address associated with one of the interfaces of the node or a virtual IP address associated with the node, then the packet is routed to the internal logic of the node, possibly to be routed within the node based on the port number where the protocol is UDP or TCP.

If the destination address is *not* one of the "home" addresses, the packet is analysed against the routing table.

You must regard the routing table as logically ordered using the destination specification in the routing table entry. The top entry or entries in the table are those with the most number of significant bits set in the routing mask.

I have used the term *routing* mask rather than the more common - and "official" - term *subnet* mask. The reason is that the mask can range from 255.255.255.255 to 0.0.0.0 using the dotted decimal notation. Clearly, at the two extremes, the mask can no longer logically be described as a *subnet* mask.

It is not clear from your post whether or not you are aware that the number following the "/" actually defines this routing mask. Before this revised notation for the routing mask, it used to be expressed in dotted decimal just like a regular IP address and you should still think of the specification as a 32-bit mask, although composed of n leading 1 bits followed by 32-n following 0 bits where n is the number following the "/" character. n, conveniently for the purposes of these concepts, defines the number of *significant* bits in the "/n" version of the routing mask.

The routing table is extended after the top entry or entries with the entry or entries with the next lower number of significant bits and so on. Finally, at the bottom of the routing table, we - normally inevitably - come to the single entry which has the least possible number of significant bits, that is the entry with no significant bits at all!

The analysis of the destination IP address against the routing table happens as follows for each entry in the routing table:

  1. The destination IP address number is extracted into a work area.
  2. The number is ANDed with the routing mask for that routing table entry. In other words, only the bits in the address number which correspond to
1 bits in the mask survive to appear in the result. 3, The result is compared against the destination address for that routing table entry.[1]
  1. If there is no match, the next entry in the routing table is selected and the logic returns to 1.[2]
  2. If there is no match and there are no more routing table entries, the packet must be discarded.
  3. If there is a match, the packet is routed according to the "next hop" specification.
[1] Note that a destination address in a routing table entry should be stored there only after having also been ANDed with the routing mask for that routing table entry at the time the routing table entry is added to the routing table. Whether this is what actually happens or not is irrelevant. It is what you must imagine in order that this conceptualisation of the routing algorithm works logically.

I have also assumed that all interfaces upon which the "next hop" specification will rely are active. I believe the way to deal with inactive interfaces is to assume that all routing entries associated with inactive interfaces are logically regarded as not present in the routing table - but I'll leave it to the experts who are much better with the fine details to clarify that point.

Another simplification I have introduced is not to consider "load balancing" where there can be multiple valid routing table entries which can lead to packets with the same destination address being routed using different "next hop" specifications at different times.

[2] Now that you understand the algorithm, you can probably see that returning to step 2 will also work - and is actually ever so slightly more efficient!

-

How can we be sure that in step 3 there will eventually be a match so that step 6 is executed and the packet is routed rather than being discarded in step 5?

This is where the "strange" "0.0.0.0/0" destination specification comes to our rescue as the specification for the default route.

Note that I introduced note [1] in order to be sure that the destination address in the routing table entry would match the destination address from the packet after it had been ANDed against the routing mask in the routing table entry. Thus, if I had specified the destination address in the routing table entry as "a.b.c.d" representing any valid dotted decimal IP address, what would be stored in the routing table entry with routing mask "0.0.0.0" or "/0" would inevitably be "0.0.0.0", so why not just specify "0.0.0.0"?

Lastly remember that I said above that the "/n" specification actually defines a routing mask. When the routing mask was invented as a way of replacing routing masks implied by the first octet of the IP address, it was possible to specify whatever took your fancy in that the 1 bits did not have to be contiguous from the beginning. It was only a convention that most designers of routing in IP networks tended to make the 1 bits contiguous from the beginning - for the sake of sanity! - if not for themselves, for the sake of anyone trying to understand what they were doing. Somehow or other Cisco - and perhaps other vendors - have now *imposed* this convention so that the "insane" approach to routing masks has become outlawed. Perhaps again, those closer to the "coal face" than I am can explain the "somehow or other". You will understand, with the algorithm I described above, that the router logic would have no difficulty with non-contiguous 1 bits in the routing mask

- only humans do!

I hope that's clear. Please post again if it is not.

Chris Mas> I know what default routing is.What confuses me is what do we achieve

Reply to
Chris Mason

Cabling-Design.com Forums website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.