Archive for the Router Gateway Commands Category

Gateway command No More confusion!

Posted in Router Gateway Commands on June 15, 2008 by itdaddy

——————————————————-

ip default-gateway (ip routing turned off when used; like windows gateway)

ip default-network 207.134.6.0 (same as below defines gateway of last resort)

ip route 0.0.0.0 0.0.0.0 207.134.6.1(creates gateway of last resort)

read below to know the difference between the last two. There is a big difference.

——————————————————-

Here’s a couple of interesting things I learned too. One was a few months ago, trying to get a Catalyst 4500 to work with the ip default-gateway command. I configured the switch exactly as I thought it need to, but it would not connect to it’s uplink. Finally, after a bit of reading, I found out that the┬ádefault-gateway command only works on layer 3 switches and routers with the “no ip routing” command. Another thing is the default network command. I’ve never seen it used, so I decided to check Cisco’s site for an explanation of it.

Apparently it’s (almost) the same thing as doing ip route 0.0.0.0 0.0.0.0 (next hop ip). Here’s the difference:

Cisco wrote:
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-network command 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.

So in short, if you have ip routing enable, use either ip default-network or ip route 0.0.0.0 0.0.0.0. If you do not have ip routing enable or are working on a pure switch, use ip default-gateway. Interesting stuff.

Edit: Oh yeah, and another difference is how routing protocols treat either

command. It’s detailed in the below link.
Source: http://www.cisco.com/warp/public/105/default.html#ipnetwork