cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
787
Views
0
Helpful
3
Replies

Layer 2 and Layer 3

Lim Seow Hua
Level 1
Level 1

Hi,

I would like to know that is there any command that we can use in the Cisco switch in order to check whether a switch port is either a Layer 2 or Layer 3 port?

Thanks.

3 Replies 3

Dipesh Patel
Level 2
Level 2

Dear Lim Seow Hua,

 You can check using :

show interface fastethernet 0/2 switchport command.

If output shows Switchport: Enabled than it show that port is Layer 2 else it is Layer 3 port.

Example:

SW1#show interface fast 0/2 switchport
Name: Fa0/2
Switchport: Enabled
Administrative Mode: dynamic desirable
Operational Mode: down
Administrative Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL
Protected: false
Appliance trust: none

Rate for helpful replies......!!!

Regards,

Hi,


You can use the command Show interfaces  [interface] switchport. If the port is routed (Layer 3) mode then the  command output will be as follows

SWITCH#show interfaces gigabitEthernet 4/1  switchport
Name: Gi4/1
Switchport: Disabled

If  the port is a Layer 2 port then command output will be as follows

SWITCH#  show interfaces  gigabitEthernet 3/7 switchport

Name: Gi3/7
Switchport: Enabled
Administrative Mode: dynamic auto
Operational Mode: static access
Administrative Trunking Encapsulation: negotiate
Operational Trunking Encapsulation: native
Negotiation of Trunking: On
Access Mode VLAN: 310 (Test_Vlan)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: enabled
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk Native VLAN tagging: enabled
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL


Unknown unicast  blocked: disabled
Unknown multicast blocked: disabled
Appliance trust: none

Hope  this helps, Please rate helpful posts

Thanks  & Regards

Zeeshan Sanaullah

Ganesh Hariharan
VIP Alumni
VIP Alumni

Hi,

I would like to know that is there any command that we can use in the Cisco switch in order to check whether a switch port is either a Layer 2 or Layer 3 port?

Thanks.

Hi,

If an interface is configured as switchport under interface then it is layer 2 as per the below example

interface GigabitEthernet0/12
switchport access vlan 40
duplex full
end

if you dont see switchport configuration under interface then it is layer 3 as per the below example

interface GigabitEthernet0/12

bandwidth 79872
ip address x.x.x.x x.x.x.x
ip accounting output-packets
ip ospf priority 0

duplex full
end

Hope to Help !!

Ganesh.H

Remember to rate the helpful post

Review Cisco Networking products for a $25 gift card