Trunk Ports are switchports on Cisco switches that interconnect switches. The trunk port carries traffic for all the VLans across the switches it interconnects. switchport can be enabled and configured as trunks without much trouble.
The following procedure helps setting a switchport into a Trunk port with 802.1q encapsulation.
Enter the Interface Configuration mode
To configure the port enter the Interface config mode from the global configuration mode.
ciscoswitch# conf t
ciscoswitch(config)# interface gigabitethernet 1/1
Set the Switchport mode as Trunk
Once in the configuration mode for the selected interface (here GigabitEthernet 1/1), make the port as switchport and set the switchport mode as trunk and then set trunk port encapsulation.
ciscoswitch(config-if)# switchport
ciscoswitch(config-if)# switchport mode trunk
ciscoswitch(config-if)# switchport trunk encapsulation dot1q
This turns the switchport as a Trunk port.
Optional recommended configurations
Enable UDLD
UDLD is a Layer 2 protocol that enables devices connected through fiber-optic or twisted-pair Ethernet cables to monitor the physical configuration of the cables and detect when a unidirectional link exists. When UDLD detects a unidirectional link, it administratively shuts down the affected port and alerts you. Unidirectional links can cause a variety of problems, including spanning-tree topology loops.
ciscoswitch(config-if)# udld port aggressive
Setting the udld port mode as aggressive, it can detect unidirectional links due to one-way traffic on fiber-optic and twisted-pair links and to misconnected ports on fiber-optic links.
Enable Logging
Being a trunk port, it is advisable to enable logging on the switchport link status
ciscoswitch(config-if)# logging event link-status
ciscoswitch(config-if)# logging event bundle-status
ciscoswitch(config-if)# logging event trunk-status
To see the port configuration
ciscoswitch# sh run interface gi1/1
switchport
switchport trunk encapsulation dot1q
switchport mode trunk
logging event link-status
logging event bundle-status
logging event trunk-status
udld port aggressive