cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2723
Views
15
Helpful
13
Replies

routing on a switch

wavess
Level 1
Level 1

HI All

 

On an access switch with no routing protocols turned on.  why would there be an default route command?  (ip route 0.0.0.0 0.0.0.0 192.168.1.1)  there is a routed port on the switch with the ip add 192.168.1.2/24.

 

my thought is you need a DEFAULT GATEWAY command on a switch that does not do routing, not a default route command.  

 

perhaps someone smarter than me can clarify.  thanks.

 

waves

1 Accepted Solution

Accepted Solutions

 

So it looks like you can configure a L3 port with an IP and bring it up but until ip routing is enabled it is not going to work. 

 

Did you try with the L3 port up using a default gateway because I still think that won't work ie. L3 port means it has to be routing. 

 

Apologies for all the questions, just don't have any kit to test with at the moment. 

 

Jon

View solution in original post

13 Replies 13

Hi

  This is for the switch management. Even Layer 2 switch which dont neet to worry about routing table, need to have IP address to be manged. This route is used for that. 

 As you said, switch´s IP address  is 192.168.1.2 and his gateway is 192.168.1.1. 

balaji.bandi
Hall of Fame
Hall of Fame

default used for Layer 2, if you looking Layer 3 then ip route is best to use

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

wavess
Level 1
Level 1

if you have a routed port on the switch, this means you have a L2 port that you have a L3 ip address to.  

 

so, if that is the case, then do you have to turn on ip routing and then use the ip route commands for forwarding traffic?  

 

there is a routed port on the switch.  there is not ip routing enabled.  i just assume keep it simple and use the default gateway command if there is only one device connected to teh switch (apart from the routed port)

 

i understand the idea of the management ip address.  not sure why you'd use L2 vs L3...

 

thanks.

wavess
Level 1
Level 1

i understand ip routing for when you have multiple vlans on a switch and want to switch between vlans on that switch.  if we only have a routed port on the switch and 1 vlan, then i don't understand the need for ip routing....just use default gateway...no?

Hello,

 

Check to see if the command is actually being used. Just because its in the config does not mean its doing anything and could be extra.

 

Use the 'show ip route' command to see if any routes populate the routing table

 

show run all | begin ip routing <-- to see if ip routing is enabled

 

If neither a routing table is present or ip routing is not enabled then that command is probably not in use. (but you can configure it even if routing isn't enabled, it just wont do anything)

 

Default gateway is usually for a single VLAN/Network as per your assesment.

 

Also a document to maybe help:

Configuring a Gateway of Last Resort Using IP Commands - Cisco

 

 

-David

 

I think if you use L3 ports on a L3 switch you are turning on ip routing on those ports and as such you will then have a routing table and you would need to add a default route rather than a default gateway. 

 

It's an interesting question in that I have never actually done it ie. replace the management SVI with a management L3 port and don't have anything to test with but the above is my understanding. 

 

Jon

Hey @Jon Marshall I did some testing (not all inclusive) just on my C3560. IP routing was not enabled by default and adding a L3 routed interface and static ip route of 0.0.0.0 did not populate a routing table and did not enable IP routing. Once I turned on IP routing the default route of 0.0.0.0 and the local interface populated into the routing table.

 

I kinda thought what you did too as far as if you have a L3 interface up/up then routing would be enabled like when you assign a port to a vlan if its not created it will automatically create it for you. It may be based of of device model too.

 

-David

 

Hi David

 

Did it actually work when routing was not enabled ie. could you access it remotely ? 

 

Jon

@Jon Marshall no I could not. And keep in mind just basic/very limited testing was done. I may try more tonight when I have the resources. It'll help with the studies anyway.

 

 

-David

 

So it looks like you can configure a L3 port with an IP and bring it up but until ip routing is enabled it is not going to work. 

 

Did you try with the L3 port up using a default gateway because I still think that won't work ie. L3 port means it has to be routing. 

 

Apologies for all the questions, just don't have any kit to test with at the moment. 

 

Jon

No worries. That's what my testing proved to be. It did not work (even with a default route) until I enabled IP routing. It was able to reach its neighbor, obviously since its directly connected. But anything past that did not work. If others have tried similar configurations I would be curious to see what command and on what devices worked.

 

 

-David

share here 
show ip route ?

You need the default routing because the switch needs to know to where send the packet. And people from many places inside the network can access the switch. So, many differents IP will hit him and with default route, it dont need to care about to who send the packet. It just need to send to gateway.