it says here, If you use both the ip default-network and ip route 0.0.0.0 0.0.0.0 commands to configure candidate default networks, and the network used by the ip default-network command is known statically, the network defined with the ip default-networkcommand takes precedence and is chosen for the gateway of last resort. Otherwise if the network used by the ip default-network command is derived by a routing protocol, the ip route 0.0.0.0 0.0.0.0 command, which has a lower administrative distance, takes precedence and is chosen for the gateway of last resort.

Can some one help me to verify if this is true about the behavior of ip default-network and ip route 0.0.0.0/0 command??

when i tried to apply this in PT, I configured a static route for network 198.10.1.0, and used this network for the ip default-network command, and the gateway of last resort was set as it shown in the show ip route :

Then when I am configuring default route using the ip route 0.0.0.0/0 131.108.99.2 command, it takes precedence and chosen for the gateway of last resort. although that the network used for the ip default-network is known statically for the router:

The ip default-network command is used mostly with routing protocols. The ip route command is used with static routing. Both are achieving the same goals but can be used in different scenarios. If you have a routing protocol for a domain, and you would like to advertise to the rest of the routers that a default route, you would implement the ip default-network command. This would cause the routing protocol to carry the candidate for default network in its routing updates to all routers in the domain.

The ip route 0.0.0.0 0.0.0.0 xx is a command that is statically assigned. This is called a default network because the all-zeros syntax means to catch all routes. The ip route command is not automatically carried in routing updates like the ip default-network command is in some routing protocols. You must redistribute the static command into a routing protocol for it to be carried.

In a network where, there are multiple default gateways, you must understand that certain parts of the network will be routed out one direction, and other parts might be routed out another direction. Understand that each router makes it's own forwarding decision even when the network is converged with consistent routing information. This can cause an un-even balance of routing out of default routes.

In this scenario, let's say you typed ip default-network on router 161.144.91.2 (top one) and all routers are converged. This will cause all routers in the domain to see a candidate default network as 192.10.1.0/24. Now, let's say you type ip route 0.0.0.0 0.0.0.0 131.108.99.2 on the middle router. You have just created a routing loop. How? the bottom router sees the candidate default route at the top, and sends all packets that did not match a more specific route to the middle router. The middle router has been configured with IP route back to the lower router because it was statically assigned. It's AD takes precedence over the ip default-network command and packets are sent back down to the bottom router.

Now you ask why do the ADs look the same for both ip route 0.0.0.0 0.0.0.0 and ip default-network? It's because you have configured them on the same router. Go to another router and you will see the 192.10.0/24 network have a different AD. This is because on the local router, you have statically defined both default routes. But, ip default-network command is sent across routing updates and therefore carries the routing protocol's AD instead of a static one.

That is a complicated answer to ur scenario. If you don't understand the answer, make you take away a few ideas: all routers make routing decisions on their own regardless of influences from others. AD dictates a route "believability", the lower the better and lastly, unless you know exactly what you're doing: don't install multiple default routes or routing loops may appear. This happens a lot.

Well Mike, thanks for you reply, but you are talking about the second part of the note i posted in the beginning of my post, which is when the network used by the ip default-network command is not known statically ( in other words it is known through an ip routing protocol, just like your example), this i understand.

My Question exactly is, when the network used by the ip default-network command is known statically, and we configure the ip route command as well in the same router ( all the configuration is made in the middle router), and according to the not, the ip route 0.0.0.0/0 command should take precedence and chosen for the gateway of last resort, but what is happening in my router ( middle router ) is that the ip default-network taking precedence and chosen for the gateway of last resort.

What is your confirmation that the router is using the ip default-network command to forward packets to a default network? According to your show ip route command in the first post, it shows both with AD of 1. This implies that both are statically assigned on the router. Like I said both are similar in their goals but are for different scenarios.

This is exactly my question, when both configured in the same router with AD=1, which one should take precedence and is chosen for the Gateway of last resort ??

According to the Note, which I found in Cisco.com ( link attached ), the ip default-network should take precedence and chosen for the gateway of last resort, but in my configuration what is happening is the contrary.

This means that if the router has a route to the subnet defined by this command, the router installs the route to the major net. and if the major network is devided into subnets in routing table, no network (subnet) has been flagged as the default network. The ip default-network command must be issued again, using the major net, in order to flag the candidate default route.

By the ip route (static) command, we can use any ip to set it as the gateway of last resort.

The default route configured with IP default-Network command is NOT a static route.it's administrative distance is identical to the distance of the underlying classful network. This is the reason your static default route takes precedence.

In your example the route confgured with IP default- network command should take precedence as the both routes have AD=1. You need to confirm if that route is properly functional.Look for the reverse route issue and any ACL issue which can restrict it to act as a default route.

em.. very interesting topic. I just found this one today, and did some tests based on your theory.

Pretty much, you have to use classful network after ip default-network command to make it work. however, that classful network must have a route in routing table (subnet routes do not count).

When you say the command has to be flagged again to make it work, I found it is not all true. What it does is if you issue ip default-network 'subnet' command, the router will create a static route in the routing table for the classful network, but this is only trure if the 'subnet' you used also has a route in the routing table. For example, you try to make 20.20.20.0 as your last resort network, so you put 'ip default-network 20.20.20.0' in the router. Now, if you have a route in the routing table for network such as 20.20.20.0/24 or 20.20.20.0/30 or something similar which can cover 20.20.20.0, it will then creat a static route for network 20.0.0.0/8 with next hop ip 20.20.20.0. so if you issue 'ip default-network 20.0.0.0', it will give you the last escort network as 20.0.0.0 through next hop 20.20.20.0.

This also works with ip add 20.20.20.1/2/3 as well as it is covered in the routing table.

what I have also found is if the classful ip routes in routing table has next hop as an interface, ip default-network wont work. for example, you have a static route in the routing table saying '20.0.0.0/8 is directly connected, FastEthernet1/0', whatever you do, ip default-network cannot use 20.0.0.0/8 as a default gateway network, it has to be an next hop ip address in the routing table.

Although it's very unlikely this issue is still ongoing from the date of the posts, but,

Why are you trying to compare an ip default-network for a defined network vs an ip route to 0.0.0.0?

You have to remember that the gateway of last resort is the one route to be used when no other routes for that network exist.

By doing ip default-network 198.10.1.0 alone, that could be easily overriden by even an ip default-network of 198.10.0.0, because of the latter being advertised for the major network.

By adding the ip route 0.0.0.0/0, your previous ip default-network is no longer preferred as a destination to the biggest major network, and a route to the 198.10.1.0 is known and placed in the routing table.

If you want to test ip default-network taking precedence over ip route, I would suggest implementing and comparing them both using the same classful network. Otherwise, it would almost be the equivalent of comparing routes preferred based on AD.