Note: switchport mode trunk can run directly on the 2950 switch, which enables 802.1q directly. To enable the relay function on vswitches such as 3550 and 4500, you must first select the encapsulation method, that is, run switchport trunk encapsulation dot1q.
Sw0 # vlan database
Sw0 (vlan) # vtp domain Contoso
Sw0 (vlan) # vtp password Contoso
Sw0 (vlan) # vtp server
Sw0 (vlan) # vlan 10
Sw0 (vlan) # vlan 20
Sw0 (config) # interface range gigabitEthernet 0/1-2
Sw0 (config-if-range) # switchport trunk encapsulation dot1q
Sw0 (config-if-range) # switch mode trunk
Sw0 (config) # interface vlan 10
Sw0 (config-if) # ip address 192.168.0.1 255.255.255.0
Sw0 (config) # interface vlan 20
Sw0 (config-if) # ip address 192.168.1.1 255.255.255.0
Sw1 # vlan database
Sw1 (vlan) # vtp domain Contoso
Sw1 (vlan) # vtp password Contoso
Sw1 (vlan) # vtp client
Sw1 (config) # interface gigabitEthernet 1/1
Sw1 (config-if) # switchport mode trunk
Sw1 (config) # interface range fastEthernet 0/1-10
Sw1 (config-if-range) # switchport access vlan 10
Sw2 # vlan database
Sw2 (vlan) # vtp domain Contoso
Sw2 (vlan) # vtp password Contoso
Sw2 (vlan) # vtp client
Sw2 (config) # interface gigabitEthernet 1/1
Sw2 (config-if) # switchport mode trunk
Sw2 (config) # interface range fastEthernet 0/1-10
Sw2 (config-if-range) # switchport access vlan 20
Related viewing commands
Show interface trunk
Show vlan
Show vtp status
Show interfaces gigabitEthernet 0/1 switchport
This article is from the "light rain in September" blog