Trunk and Access Ports in a Network Switch | Trunk Port and VLAN
A port in a network switch is a physical slot where a LAN cable can be plugged in. It may have few ports or it may have multiple ports, depends on the capacity. If there is no VLAN all ports are the same type, but if 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 and connects to each other via ports.
What is an access port?
By default, a port is an access port. When we need to create a LAN, we can plug cables to connect computers. A computer can message to any other computer on the access port. On switch, the message broadcasts and the intended computer receives. 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 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 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 on 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 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.