Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

IP route vs ip default-gateway

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

5 ACCEPTED SOLUTIONS

Accepted Solutions
Cisco Employee

Re: IP route vs ip default-gateway

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

Re: IP route vs ip default-gateway

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

Cisco Employee

Re: IP route vs ip default-gateway

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

Hall of Fame Super Bronze

Re: IP route vs ip default-gateway

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

Cisco Employee

Re: IP route vs ip default-gateway

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

10 REPLIES
Cisco Employee

Re: IP route vs ip default-gateway

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

Re: IP route vs ip default-gateway

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

Re: IP route vs ip default-gateway

Thanks for the help.

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

Mike

Cisco Employee

Re: IP route vs ip default-gateway

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

Hall of Fame Super Bronze

Re: IP route vs ip default-gateway

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

Re: IP route vs ip default-gateway

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

Hall of Fame Super Bronze

Re: IP route vs ip default-gateway

Yes, your understanding is correct.

Cisco Employee

Re: IP route vs ip default-gateway

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

Re: IP route vs ip default-gateway

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

Re: IP route vs ip default-gateway

Informative post by Edson and letian

. Thanks

3458
Views
25
Helpful
10
Replies