Friday, April 5, 2024

Cisco 104 - Initial VLAN Trunk commands

(config)#interface g0/0
; If the command is rejected (such as on an older switch) first configure the port to use dot1q
(config-if)#switchport mode trunk
Command rejected: An interface whose trun encapsulation is “Auto” can not be configured to “trunk” mode.
(config-if)#switchport trunk encapsulation dot1q
(config-if)#switchport mode trunk

; Shows which ports are configured for trunking, which Vlans are allowed on the trunk, which Vlans are allowed and active
#show interfaces trunk

; Shows each vlan and which ports are configured to use them
#show vlan brief

#int g0/0
; Allows Vlan 10 and 30 on interface
(config-if)#switchport trunk allowed vlan 10,30
; Adds Vlan 20 to allowed list
(config-if)#switchport trunk allowed vlan add 20
; removes Vlan 20 from allowed list
(config-if)#switchport trunk allowed vlan remove 20
; Allows all Vlans on the port.  This is the default state – all Vlans are allowed on trunk by default.
(config-if)#switchport trunk allowed vlan all
; Removes all Vlans from allowed list.
(config-if)#switchport trunk allowed vlan none
; Sets native vlan to 1001
(config-if)#switchport trunk native vlan 1001


[These are my notes from Jeremy's excellent CCNA course which can be viewed here.]