cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
20179
Views
40
Helpful
10
Replies

IP route vs ip default-gateway

burleyman
Level 8
Level 8

 

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

Lei Tian
Cisco Employee
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

View solution in original post

manish arora
Level 6
Level 6

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

View solution in original post

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

View solution in original post

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

View solution in original post

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

View solution in original post

10 Replies 10

Lei Tian
Cisco Employee
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

manish arora
Level 6
Level 6

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

Thanks for the help.

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

Mike

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

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

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

Yes, your understanding is correct.

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

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

Informative post by Edson and letian

. Thanks

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card