cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
218999
Views
51
Helpful
19
Replies

Switch command ip default-gateway

wfqk
Level 5
Level 5

Hi I saw the following: 

 

" ------------------

Use the following commands to assign the IP address 192.168.1.254 to VLAN 1, which is the management VLAN by default:
TEswitch1(config)#interface vlan 1
TEswitch1(config-if)#ip address 192.168.0.9 255.255.255.0
TEswitch1(config-if)#no shutdown


If you need to be able to connect to the switch from other networks, you will also need to configure a default gateway address. For example, if the switch is connected to a router with the IP address 192.168.1.254, use the following command, in Global Configuration mode, to use it as the default gateway:
TEswitch1(config-if)#exit
TEswitch1(config)#ip default-gateway 192.168.0.254

------------------------ "

My question is why we still need to use command ip default-gateway since the router still can reach the switch from other network without the ip default-gateway. 

 

Thank you

19 Replies 19

Reza Sharifi
Hall of Fame
Hall of Fame

My question is why we still need to use command ip default-gateway since the router still can reach the switch from other network without the ip default-gateway.

If you don't add the ip default-command to the switch, the switch can only reach hosts in the local subnet (192.168.0.0/24) and no other subnet.  Also without this command, no other device outside subnet 192.168.0.0/24 can reach this switch.

HTH

 

Thank you so much for your reply. 

 

Here are two cases:

One is switch (192.168.0.9/24(vlan1) -------------(192.168.0.1/24)Router 1

Two is Router2(192.168.0.9/24) -------------------(192.168.0.1/24)Router 1

 

I think the command ip default-gateway function in layer 2 device is similar with command ip route 0.0.0.0 0.0.0.0 x.x.x.x in router, right ? In the above two cases, Router1 can ping its other end, and in case two, two router should ping each other since two router have its routing table, but why in case one Switch still can send the ping packet back to the router without command ip default-gateway ? 

Hi Showipinterface,

The default-gateway is not the same as ip route 0.0.0.0 0.0.0.0. Yes they do cary the same function but the reason why they are used are completely different. When you have "ip routing" enabled the device no longer becomes a "host", it is performing routing. Where a layer 2 switch without "ip routing" is exactly like a host, like a PC / Laptop etc... It may need a default gateway to communicate with other networks.

I just explained to you below in my post about the proxy arp function.

To explain more, lets say we have a L2 switch with IP 192.168.0.9/24 - no default gateway configured - connected on this LAN is the router.

The L2 switch tries to ping a subnet off of the router which is 10.10.10.1. 

When this happens if the router has the proxy arp function, it will respond back to the L2 switch with a reply saying "come to me, I know where that network is"

Hope it explains a little better.

Please rate useful posts & remember to mark any solved questions as answered. Thank you.

Thank you for your explanation. 

I read document of Cisco.

http://www.cisco.com/c/en/us/support/docs/dial-access/asynchronous-connections/5466-comm-server.html

Here is what Cisco says:

ip default-gateway 171.55.31.1

!--- This is the default gateway when routing is disabled.
!--- For example, if the router is in boot ROM mode.

 

If the router is in boot ROM mode, how can I reach the router ? Does that mean we can telnet to its interface ? 

When the router is in rommon mode, it depends if it is open to accepting telnet connections to the IP. But I do not think it is the case. We still have to set the IP when in rommon mode via console. 

I think the document stating what you have highlighted isn't really a clear explanation. But I see why they used an example of rommon. Same analogy as to what I used. Think of it as a host.

Please rate useful posts & remember to mark any solved questions as answered. Thank you.

I think what all of you said are correct. but I want to confirm the concept myself in my scenario.

@Bilal, "But it all depends on one thing. If the actual default gateway is enabled for proxy arp/auto arp response, then automatically the reachability to the switch from another subnet will indeed work - perhaps this is what's happening in your scenario. (without default-gateway command)" 

You said "If the actual default gateway is enabled for proxy arp/auto arp response My question is how to disable default gateway for proxy arp/auto arp response ? If I can do this, I could confirm the concept. 

I will take this question on behalf of Bilal,

@Showipinterface:-

In order to disable proxy arp, Go into conf t & type:

no ip proxy-arp

Here is what Proxy ARP Feature does fyi:-


" A router or switch with the Proxy ARP feature enabled will reply to any broadcast with its own MAC address. Clients that tries to communicate with devices outside the local network will be sent to the router or switch that then forwards the traffic. "

HTH
Regards
Inayath

@InayathUlla, Thanks for your joining. Cisco device do not have the command "ip proxy-arp", at least in router 3640 ( that I just tested as switch by gns3) , I used below command and clear arp, but neither of them could work. 

 

R6(config-if)#no arp arpa ?
  <cr>

 

My apology for not giving you the syntax. Its not at the global mode you need to go to the respective port for disabling the proxy arp.

On My 2911 router:-

Router(config)#int vlan 1
Router(config-if)#no ip proxy-arp  >> It accepts.


Router(config-if)#int g0/0
Router(config-if)#no ip proxy-arp >> It accepts.

 

Regards

Inayath

Proxy ARP is enabled by default on the cisco devices. If you would ask us the reason for the same why it is enabled then you  might have to check the following RFC:-1009.

RFC 1009 has an explicit requirement that the router be able to be configured to enable or disable support of proxy arp.

 

HTH

Thank you InayathUlla ! 

I just tested it, and it can only work in SVI instead of physical interface. 

What we want to confirm is if the command ip default-gateway is needed when we try to reach the switch from different network. However, even if I disabled ip proxy-arp in all of vlan interface, it still can ping the switch from different network(without ip default-gateway. 

 

Attached is topology. R6 is considered as the switch. I can past the config if necessary

@show ip interface,

Thanks for getting back to us. Now we have the topology can you please share what exactly you are trying to ping( Be specific the src ip address and destination address, Vlan if any).

Second share the config of all the devices.

 

Regards

Inayath

Maybe we need to clear the arp entries after disabling the proxy arp?

Please rate useful posts & remember to mark any solved questions as answered. Thank you.

I think the issue should be considered like this: If an end router has only one ip address connected with other device, the router cannot be reached by user located in different network unless the router has default route. The default route in the router is like ip default-gateway in the switch that we are talking about. Thank you all for your posts !

 

Review Cisco Networking for a $25 gift card