6

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?

sparasan
  • 125
  • 1
  • 6
  • 2
    Note that this question is subtly different from asking whether the switch can do L3 _in hardware_. Many Catalyst switches could do IP routing, but only in software (2900s), or IPv4 routing in hardware but IPv6 only in software (3560). – chrylis -cautiouslyoptimistic- Dec 07 '20 at 18:31
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer. – Ron Maupin Jan 04 '21 at 22:23

2 Answers2

7

In addition to @Zac67 answer, in the Catalyst product line, layer 3 capabilities are often unlocked by licenses.

So a given switch can be layer 3 capable but, depending on the installed license, may have none, a few, or a complete set of, layer 3 features.

The switch is shipped by default with the LAN BASE license (formally LAN lite), but can be either ordered with a higher licence level (often "Enterprise"), or a license can be added later.

To check what you license is the CLI command is, quite logically, show license

the output looks like:

show license
Index 1 Feature: lanlite
    Period left: 0  minute  0  second
Index 2 Feature: lanbase
    Period left: Life time
    License Type: Permanent
    License State: Active, In Use
    License Priority: Medium
    License Count: Non-Counted
JFL
  • 19,405
  • 1
  • 32
  • 64
5

Normally, an L3 switch can be configured to work as a router (forward traffic between IP subnets) or not, e.g. ip routing / no ip routing. Some models/series have routing activated by default, some have it deactivated. Additionally, the IP status (show ip) should show its routing status.

IP Routing : Enabled

On an L2 switch you won't see this option or status.

Apart from CLI, the CDP and LLDP frames sent out should show its capabilities (bridge, router) whether active or not. You should be able to display the local CDP info using something along show cdp tlv - look out for Capabilities: Router.

And of course, you can display the device model (show system) and look up its features. If applicable, check the license as JFL has pointed out.

Zac67
  • 81,287
  • 3
  • 67
  • 131
  • 1
    That's not entirely accurate. Managed layer 2 switches would have an IP address for management access and for monitoring. – Jesse P. Dec 07 '20 at 13:45
  • 1
    Managed L2 switches do have configured IP addresses but they don't display a routing status. – Zac67 Dec 07 '20 at 14:53
  • I've tried to make a better distinction in the answer. VRF in a layer-2 switch? Are you sure? – Zac67 Dec 07 '20 at 15:14
  • No. I swear I've had a layer 2 switch with a VRF for the management interface, because it didn't support a default gateway being defined, but I can't recall which switch that was. I could just be misremembering. I'll give you that most layer 2 switches don't have support routing outside of a default gateway definition. – Jesse P. Dec 07 '20 at 16:12
  • 1
    I removed the previous comment so it doesn't add to the confusion. – Jesse P. Dec 07 '20 at 16:13
  • @JesseP. I guess "VRF" in that case are just separate routing domains since there's no L3 forwarding on an L2 switch... Should rather be "VR" without "F". ;-) – Zac67 Dec 07 '20 at 16:39
  • Maybe. It was definitely strange, if I am remembering correctly. – Jesse P. Dec 07 '20 at 16:53
  • 2
    Some Cisco L2 switches don't allow routes -- `ip route` isn't available. As far as I've ever seen, in L2 mode, one, and only one, L3 interface can be enabled for management. (if you `no shut` a second SVI, the first will be shutdown.) I've heard of "L2" switches needing a VRF defined for management, but they were L3 switches *without* a license for L3 features. – Ricky Dec 07 '20 at 17:13