Access and trunk ports


Introduction

In computer networking, a network switch is a device that connects network devices together to enable communication within a network. Switches are an essential component of any modern network, and they provide a way to manage network traffic by directing data to appropriate device. Access and trunk ports are two types of ports used on switches to manage network traffic.

In this article, we will discuss access and trunk ports, their differences, and when to use them.

What are Access and Trunk Ports?

Access ports and trunk ports are two types of ports used on network switches. Access ports are used to connect devices that do not require VLAN tagging, while trunk ports are used to connect devices that require VLAN tagging.

Access Ports

Access ports are simplest type of port used on a switch. They are used to connect end devices such as computers, printers, and servers to network. An access port is assigned to a single VLAN, and all traffic on that port is tagged with VLAN ID of that VLAN. Access ports do not require any additional configuration, and they are typically configured as untagged ports.

For example, if a switch has two VLANs, VLAN 10 and VLAN 20, and a computer is connected to an access port assigned to VLAN 10, all traffic generated by computer will be tagged with VLAN ID of VLAN 10. Similarly, if a printer is connected to an access port assigned to VLAN 20, all traffic generated by printer will be tagged with VLAN ID of VLAN 20.

Trunk Ports

Trunk ports are used to connect switches and other network devices that support VLAN tagging. Trunk ports allow multiple VLANs to be carried over a single physical connection, and they are typically configured as tagged ports. Trunk ports are used to carry traffic from multiple VLANs between switches or other network devices.

For example, if a switch has two VLANs, VLAN 10 and VLAN 20, and another switch needs to be connected to network, a trunk port can be configured on both switches. Traffic from VLAN 10 and VLAN 20 can then be carried over trunk port between switches.

Trunk Ports

The decision to use access or trunk ports depends on network topology and requirements of end devices. Access ports are typically used to connect end devices such as computers, printers, and servers to network. If end devices do not require VLAN tagging, then access ports are best option.

For example, if a switch has two VLANs, VLAN 10 and VLAN 20, and another switch needs to be connected to network, a trunk port can be configured on both switches. Traffic from VLAN 10 and VLAN 20 can then be carried over trunk port between switches.

When to Use Access and Trunk Ports

The decision to use access or trunk ports depends on network topology and requirements of end devices. Access ports are typically used to connect end devices such as computers, printers, and servers to network. If end devices do not require VLAN tagging, then access ports are best option.

Trunk ports are used to connect switches and other network devices that require VLAN tagging. If network has multiple VLANs and devices need to communicate across VLANs, then trunk ports are necessary. Trunk ports also allow for VLANs to be extended across multiple switches, enabling devices on different switches to communicate with each other.

Configuring Access and Trunk Ports

Configuring access and trunk ports is a straightforward process. Access ports are typically configured as untagged ports, while trunk ports are configured as tagged ports. following sections will provide an overview of how to configure access and trunk ports.

Configuring Access Ports

To configure an access port, follow these steps −

  • Access switch's configuration interface.

  • Identify port you want to configure as an access port.

  • Configure port as an access port using following command:

switchport mode access
  • Assign port to appropriate VLAN using following command:

switchport access vlan VLAN_ID

For example, to configure port 1 on a switch as an access port and assign it to VLAN 10, use following commands −

switch(config)# interface GigabitEthernet1/0/1 
switch(config-if)# switchport mode access 
switch(config-if)# switchport access vlan 10

Configuring Trunk Ports

To configure a trunk port, follow these steps −

  • Access switch's configuration interface.

  • Identify port you want to configure as a trunk port.

  • Configure port as a trunk port using following command:

switchport mode trunk
  • Configure allowed VLANs on trunk port using following command −

switchport trunk allowed vlan VLAN_ID_1,VLAN_ID_2, ...

For example, to configure port 2 on a switch as a trunk port and allow VLANs 10 and 20, use following commands −

switch(config)# interface GigabitEthernet1/0/2 
switch(config-if)# switchport mode trunk 
switch(config-if)# switchport trunk allowed vlan 10,20

Advanced Configurations with Access and Trunk Ports

While configuring access and trunk ports is relatively simple, there are some advanced configurations that network administrators can use to improve network performance and security. Some of these configurations include:

Port Security

Port security is a feature that allows network administrators to limit number of devices that can connect to an access port. This is particularly useful in environments where unauthorized devices could be connected to network, such as in public areas or shared workspaces. By configuring port security, network administrators can limit number of MAC addresses that are allowed to connect to an access port.

VLAN Hopping

VLAN hopping is a security vulnerability that can occur when a malicious device connected to an access port tries to access VLANs that it is not authorized to access. This can occur when a device sends a tagged frame with a VLAN ID that is not allowed on access port. Network administrators can mitigate VLAN hopping by configuring access ports to only allow untagged frames or by using dynamic VLAN assignment.

Voice VLAN

Voice VLAN is a feature that allows network administrators to separate voice and data traffic on a network. This is particularly useful in environments where VoIP phones are used. By configuring a voice VLAN on an access port, voice traffic can be separated from data traffic, improving network performance and quality of service.

Link Aggregation

Link aggregation, also known as port trunking or NIC teaming, is a feature that allows multiple physical links to be combined into a single logical link. This can improve network performance and provide redundancy in case one of physical links fails. Link aggregation can be configured on trunk ports, allowing multiple links to be combined into a single logical link.

Conclusion

Access and trunk ports are essential components of network switches that are used to manage network traffic. Access ports are used to connect end devices that do not require VLAN tagging, while trunk ports are used to connect devices that require VLAN tagging. decision to use access or trunk ports depends on network topology and requirements of end devices. Configuring access and trunk ports is a straightforward process and involves setting port mode and assigning VLANs to port.

By understanding differences between access and trunk ports, network administrators can configure their switches to effectively manage network traffic and ensure that devices on network can communicate with each other.

Updated on: 27-Sep-2023

138 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements