Trunk and Access Ports in a Network Switch | Trunk Port and VLAN
A network switch is a physical device that connects multiple other devices together within a Local Area Network, using LAN cables. A port in a network switch is a physical slot where a LAN cable can be plugged in.
The switch may have fewer ports or it may have a larger number of ports, depending on the capacity requirement. If there is no VLAN configured, all ports are of the same type, but if any VLAN is configured then a port could be a trunk port or an access port type.
When the number of hosts increases, there could be multiple switches, that may connect to each other via ports.
What is an access port?
By default, a port is an access port. To create a LAN, we need to plug cables to connect computers and other devices. A computer can send messages to any other computer on the access port. On switch, the message broadcasts, and the intended computer receives it. When multiple switches, another switch also receives a broadcast.
When there is VLAN, the ports tagged with the same VLAN id, broadcast the message. If the same VLAN expends to another switch or Router the far switch/router port should be configured with the same VLAN id. But what if we have multiple VLANs on a switch, we need multiple interfaces on the far Router or switch for each VLAN. To overcome this issue, there is another type of port a switch can be configured, which can carry any VLAN messages. The new port type is the trunk port. In the next section, we are explaining details about the trunk port type.
Trunk Port in a switch:
The trunk in telecom is a communication channel, that can carry different types of Signaling or frequencies over a single physical link. The same applies to the switch for a trunk port. Physically it is similar to any other port, but it is configured to carry messages from any VLAN. While configuring VLANs in a switch, the network administrator sets a port as a trunk port type. So that in the future, the network could be expanded by adding more switches.
When to use a trunk port?
Here we are discussing two scenarios where a network administrator needs to configure a port as a trunk port. If there are multiple VLANs on a switch that is located on a floor. But after some time the same network has to expand to another floor. What to do? There are two options, one carries long cables from the switch for each computer on another floor. Or there is another simpler option, that carries a single cable from a trunk port and configures a switch on another floor with the same VLAN ids. This way you may expand other VLANs also.
Another example of a trunk port is interval VLAN routing.