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

How do I know the switch is layer 2 or layer 3?

sjarasan
Level 1
Level 1

Is it possible to find the switch is Layer3 or Layer2 in (Switch)CLI? Is there any command to check whether the switch Layer(Layer 3 or 2) in CLI?

1 Accepted Solution

Accepted Solutions

balaji.bandi
Hall of Fame
Hall of Fame

show ip interface brief - see any layer3 interface.

show vlan ( see any other vlan other vlan 1)

show ip route will give you any routing protocol running.

 

or post the config if you need any suggestion.

BB

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

How to Ask The Cisco Community for Help

View solution in original post

10 Replies 10

Leo Laohoo
Hall of Fame
Hall of Fame

In a single command?  Not accurately possible. 

It will also depend on what IOS/IOS-XE you're running. 

You can start with the basic: 

sh version
sh run
sh ip route

Thanks for ur reply

In addition to what Leo said, if the switch is Layer3, you possibly will not  see the restrictions the switch has, like limited amount of static routes, restrictions in the amount of routing-entries and so on. I would directly look into the data-sheet and the configuration guide.

balaji.bandi
Hall of Fame
Hall of Fame

show ip interface brief - see any layer3 interface.

show vlan ( see any other vlan other vlan 1)

show ip route will give you any routing protocol running.

 

or post the config if you need any suggestion.

BB

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

How to Ask The Cisco Community for Help

The key question in determining whether a switch is operating as L2 or L3 is whether ip routing is enabled. For many switches that will be evident in the output of show run. But that would not work on some switches for which ip routing is the default. I agree with @balaji.bandi that show ip route is a good way to approach this. In looking at the output if there is a single local network/subnet then most likely is L2. If there are multiple local network/subnet and especially if there are any remote network/subnet then it is L3. I also think that the output of show ip protocol might be helpful in this.

HTH

Rick

Joseph W. Doherty
Hall of Fame
Hall of Fame

Besides what the others have described, modern Enterprise class switches often blur the line between L2 and L3.

For example, a smart or enhanced L2 switch might be able to use ACLs against L3 attributes.

Or such a L2 switch might offer some limited routing features.

Unfortunately, there's no simple one command that will show all these differences, especially when the distinction between a switch being L2 or L3 is often gray.

To expand a bit on what I've already posted, a "pure" L2 switch would have no features that can work with a packet.  They would be limited to just features that can work on a frame.

A "smart" or "enhanced" L2 switch has features that can work against a packet, like L3 ACLs.

A L3 or multi-layer switch can route, at least by using static routes and possible using a dynamic routing protocol.

Where the last two have somewhat converged, some L2 switches provide very limited routing, sometimes by supporting a small number of static routes.  Some L3 switches have also support a "lite" version with just static routing and/or perhaps a subset of EIGRP and/or OSPF (and/or ODR).

BTW, as an aside, some of Cisco's earlier MLS highlighted how a L2 switch became a L3 switch.

For example, the Catalyst 5500, w/o a routing module, could do MLS using an external router.  The switch would pass the first packet to the router, the router would inform the switch where the packets should be sent, and then the switch would "switch" all subsequent packets.  I also recall, with a Catalyst 5500, even with a routing modules, to perform MLS, you had to enable it.  The routing module would route, by default, but effectively you had a L2 switch with an internal router-on-a-stick if you didn't enable MLS.

If curious, more info:

https://www.cisco.com/c/en/us/support/docs/switches/catalyst-6000-series-switches/10577-55.html#cat5500 

https://www.ciscopress.com/articles/article.asp?p=102093&seqNum=3 

marioiram
Level 1
Level 1

You could try typing:

config t

ip routing

 

If that works you just enabled layer 3 capabilities. You could remove that config and you'd have a layer 2 switch.

 

HTH

BrianLS1TA
Level 1
Level 1

The command 'ip routing' is effectively what makes an L3 switch an L3 switch.  You can have an L3 capable switch without that command on there and it's going to function as an L2 Switch.

 

sh run | inc routing   **see if you see 'ip routing' command in the config -Clear sign it's an L3 capable switch

sh run | inc gateway  **see if you see 'ip default-gateway <IP Address> -sign the switch is functioning only as an L2 switch.

 

sh ip route - check the output

Do you see:

 

'default gateway is <IP Address>' ?  = L2 Switch

'Gateway of last resort is <IP Address> to 0.0.0.0' = L3 Switch

not a valid command? = L2 switch

One technical note about this statement:"see if you see 'ip default-gateway <IP Address> -sign the switch is functioning only as an L2 switch." While it is true that this statement is used when a switch in operating in L2 mode, it does not mean that this is an accurate indicator of what mode the switch in operating in. When ip routing is enabled on a switch which was in L2 it becomes a L3 mode, but the ip default-gateway is ignored and is NOT removed from the config. I have seen MANY switches obviously operating as L3 which still have the ip default-gateway in their config.

 

 

HTH

Rick