Skip to main content

diff between ip route,ip default-gateway

More
19 years 1 month ago #10792 by gangadar1234
hi all,

Can any one explain what is the difference between ip route,
ip default-gateway,ip default-network commands.


tahnks :D
More
19 years 1 month ago #10797 by Chris
Gangadar,

The 'ip default-gateway' command is used to enter your router's default gateway, just as you would do on your normal Windows machine. This command does not differ from your everyday 'gateway' used in all devices required to access hosts outside the local network.

On the other side, the 'ip route' command is available to help us create 'static' routes. In other words, we can tell the router which 'gateway' it must use in order to reach specific networks.

The 'ip route' command can also be used to define a default gateway using the following command:
ip route 0.0.0.0 0.0.0.0 <next hop ip address>

But the main use of this command is to provide routes to other networks which cannot be reached via the 'default gateway'.

I hope that helps clear things up for you.

Cheers,

Chris Partsenidis.
Founder & Editor-in-Chief
www.Firewall.cx
More
19 years 1 month ago #10807 by jwj
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:

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: www.cisco.com/warp/public/105/default.html#ipnetwork

-Jeremy-
More
19 years 1 month ago #10816 by TheBishop
Replied by TheBishop on topic Default Gateway
Good information there jwj! Thanks.
More
19 years 1 month ago #10826 by gangadar1234
thanks chris,JWJ............... :D
More
13 years 8 months ago #36564 by makas
Thanka Man..............
Time to create page: 0.131 seconds