Configuring VLAN trunks and trunk ports is essential for allowing traffic from multiple VLANs to traverse a single physical link between switches or between a switch and a router. Trunks are typically used to connect switches together and carry traffic for multiple VLANs across the network. Here's how you can configure VLAN trunks and trunk ports on Cisco switches:
### 1. Access Switch Configuration Mode:
Enter the global configuration mode on the Cisco switch:
``` Switch> enable Switch# configure terminal ```
### 2. Access the Interface Configuration Mode:
Enter the interface configuration mode for the switch port that you want to configure as a trunk port. Replace `<interface_type>` and `<interface_number>` with the appropriate interface type and number (e.g., GigabitEthernet0/1):
``` Switch(config)# interface <interface_type> <interface_number> ```
For example, to configure interface GigabitEthernet0/1:
``` Switch(config)# interface GigabitEthernet0/1 ```
### 3. Set the Switchport Mode to Trunk:
Configure the switch port as a trunk port by setting the switchport mode to trunk:
``` Switch(config-if)# switchport mode trunk ```
### 4. Configure Allowed VLANs (Optional):
By default, trunk ports allow traffic for all VLANs. If you want to restrict the VLANs allowed on the trunk port, you can specify the allowed VLANs using the `switchport trunk allowed vlan <vlan_list>` command. Replace `<vlan_list>` with a comma-separated list of VLAN IDs.
For example, to allow only VLANs 10, 20, and 30 on the trunk port:
``` Switch(config-if)# switchport trunk allowed vlan 10,20,30 ```
### 5. Configure VLAN Native (Untagged) VLAN (Optional):
By default, the native VLAN on a trunk port is VLAN 1. If you want to change the native VLAN, you can do so using the `switchport trunk native vlan <vlan_id>` command. Replace `<vlan_id>` with the desired VLAN ID.
For example, to set VLAN 20 as the native VLAN:
``` Switch(config-if)# switchport trunk native vlan 20 ```
### 6. Verify Trunk Configuration:
Use the `show interfaces trunk` command to verify the trunk port configuration and see which VLANs are allowed and active on the trunk port:
``` Switch# show interfaces trunk ```
### 7. Save Configuration Changes:
Save the configuration changes to the switch's startup configuration to ensure they persist across reboots:
``` Switch# copy running-config startup-config ```
### 8. Repeat for Additional Trunk Ports:
Repeat the above steps to configure additional trunk ports on the switch as needed.
### Conclusion:
Configuring VLAN trunks and trunk ports allows traffic from multiple VLANs to traverse a single physical link, facilitating network segmentation and optimization. By properly configuring trunk ports, network administrators can ensure efficient traffic flow and scalability in their network infrastructure.