12-06-2020 10:16 PM
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?
Solved! Go to Solution.
12-07-2020 02:22 AM
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.
12-06-2020 10:30 PM
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
12-08-2020 05:53 PM
Thanks for ur reply
12-06-2020 11:41 PM
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.
12-07-2020 02:22 AM
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.
12-07-2020 04:31 AM
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.
12-07-2020 09:59 AM
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.
12-09-2020 06:43 PM
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.ciscopress.com/articles/article.asp?p=102093&seqNum=3
12-08-2020 12:37 PM
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
12-09-2020 11:13 AM
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
12-09-2020 02:45 PM
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.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide