IP route vs ip default-gateway

Answered Question
Aug 20th, 2010
User Badges:
  • Blue, 1500 points or more

I am looking for some clarification as I keep second guessing myself.


Do these two commands do the same thing?


the IP Address for the interface gi0/0 is 10.60.1.225


ip route 0.0.0.0 0.0.0.0 gi0/0

ip default-gateway 10.60.1.225



Now if they are not the same what is the difference?


If they are the same would there be any reason to have them both in the config at the same time?


Now which of these two command are a better practice? and why? and for the one that is not best practice why is it not?

ip route 0.0.0.0 0.0.0.0 10.60.1.225

or

ip route 0.0.0.0 0.0.0.0 gi0/0


I looked up these commands on the command lookup tool and it helped but I am looking for a little more real world detail.



Thanks,


Mike

Correct Answer by Peter Paluch about 6 years 7 months ago

Hi Mike,


In addition to all the great posts here, let me add a link to a perfect Cisco document that is very relevant to the discussion here:


http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a0080094374.shtml


Best regards,

Peter

Correct Answer by Edison Ortiz about 6 years 7 months ago

I've had them configured both at the time back in the days while upgrading 2500s over a slow speed link.

If you lost the connection while upgrading the IOS, the 2500 would boot with a skinny IOS and this IOS did not support routing but it supported the default gateway command so I can get back onto the devices.


With today's routers, it makes no sense to have both.


However, you can choose to use 'ip default gateway' on L3 devices if you decide to turn off routing on such device.


Many companies turn off routing on devices that don't need it as a security approach.


Regards,


Edison

Correct Answer by Lei Tian about 6 years 7 months ago

Hi Mike,


Thanks for the rateing.


No, there is no need to have both configured. default-gateway should only be used when 'ip routoing' is disabled.


HTH,

Lei Tian

Correct Answer by manish arora about 6 years 7 months ago

There is a difference between these two commands :-


ip route 0.0.0.0 0.0.0.0 10.2.x.x  --> this will forward packets to the next hop with ip address 10.2.x.x ( L 3 at osi ).

where as

ip route 0.0.0.0 0.0.0.0 g0/1 --> this will assume that all other destination are directly connected to me via interface g0/1 and will look for an ARP for every destination at comes in 0.0.0.0 0.0.0.0 , now for it to work the upstream device  needs to give its proxy arp for every destination and then route the packet itself.


it is better to use ip route 0.0.0.0 0.0.0.0 10.2.x.x as this will not collect a lot of arp entries on the device compared to other option.


Please comment if there is a better explanation for this.


thanks

manish

Correct Answer by Lei Tian about 6 years 7 months ago

Hi Mike,


ip default-gateway is used when the device doesn't support L3 routing. ip route is used to configure static route for the devices support L3 routing.


'ip route 0.0.0.0 0.0.0.0 10.60.1.225' follows the best practice. If you use interface as the next-hop, the devices will send out ARP all unknown destination, which will decrease the device performance.


HTH,

Lei Tian

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (10 ratings)
Loading.
Correct Answer
Lei Tian Fri, 08/20/2010 - 08:49
User Badges:
  • Cisco Employee,

Hi Mike,


ip default-gateway is used when the device doesn't support L3 routing. ip route is used to configure static route for the devices support L3 routing.


'ip route 0.0.0.0 0.0.0.0 10.60.1.225' follows the best practice. If you use interface as the next-hop, the devices will send out ARP all unknown destination, which will decrease the device performance.


HTH,

Lei Tian

Correct Answer
manish arora Fri, 08/20/2010 - 08:51
User Badges:
  • Silver, 250 points or more

There is a difference between these two commands :-


ip route 0.0.0.0 0.0.0.0 10.2.x.x  --> this will forward packets to the next hop with ip address 10.2.x.x ( L 3 at osi ).

where as

ip route 0.0.0.0 0.0.0.0 g0/1 --> this will assume that all other destination are directly connected to me via interface g0/1 and will look for an ARP for every destination at comes in 0.0.0.0 0.0.0.0 , now for it to work the upstream device  needs to give its proxy arp for every destination and then route the packet itself.


it is better to use ip route 0.0.0.0 0.0.0.0 10.2.x.x as this will not collect a lot of arp entries on the device compared to other option.


Please comment if there is a better explanation for this.


thanks

manish

burleyman Fri, 08/20/2010 - 08:59
User Badges:
  • Blue, 1500 points or more

Thanks for the help.


Would there be any reason to have them both in the config at once?



Mike

Correct Answer
Lei Tian Fri, 08/20/2010 - 09:05
User Badges:
  • Cisco Employee,

Hi Mike,


Thanks for the rateing.


No, there is no need to have both configured. default-gateway should only be used when 'ip routoing' is disabled.


HTH,

Lei Tian

Correct Answer
Edison Ortiz Fri, 08/20/2010 - 09:11
User Badges:
  • Super Bronze, 10000 points or more
  • Hall of Fame,

    Founding Member

I've had them configured both at the time back in the days while upgrading 2500s over a slow speed link.

If you lost the connection while upgrading the IOS, the 2500 would boot with a skinny IOS and this IOS did not support routing but it supported the default gateway command so I can get back onto the devices.


With today's routers, it makes no sense to have both.


However, you can choose to use 'ip default gateway' on L3 devices if you decide to turn off routing on such device.


Many companies turn off routing on devices that don't need it as a security approach.


Regards,


Edison

burleyman Fri, 08/20/2010 - 09:21
User Badges:
  • Blue, 1500 points or more

Thank everyone now let me explain it back and you let me know where I go wrong.


IP default-gateway is used when L3 routing is not on.


IP route 0.0.0.0 0.0.0.0 gi0/0  is bad because the router will send an ARP request for everything that gets sent to 0.0.0.0 which causes a lot of processing and it will result in a large ARP table


Having both configured helped with older equipment but is not really need now but it will not hurt if both are configured.


Do I have it correct?



Thanks for all your posts.


Mike

Edison Ortiz Fri, 08/20/2010 - 09:48
User Badges:
  • Super Bronze, 10000 points or more
  • Hall of Fame,

    Founding Member

Yes, your understanding is correct.

burleyman Fri, 08/20/2010 - 10:16
User Badges:
  • Blue, 1500 points or more

Peter...and all, Thanks for your help I think I have it cemented in my thick head now.....


Peter that was a perfect doc...thanks.



Mike

Actions

This Discussion