Data forwarding rules of access and trunk ports on the switch

access port:

The data packets passing through the access port do not carry VLAN tags and belong to only one VLAN;

In the incoming direction of the access port, after the switch receives the data packet, it first determines whether it has a VLAN tag. If it does, it discards the data packet. If not, it adds the VLAN tag configured for the port.

In the outbound direction of the access port, the switch forwards the data packets with the same VLAN tag as the port, and removes the VLAN tag and turns it into a normal data packet.

trunk port:

Data packets passing through the trunk port must carry VLAN tags;

In the incoming direction of the trunk port, after the switch receives the data packet, it first determines whether it has a VLAN tag. If not, it discards the data packet. If it does, it forwards it according to the corresponding VLAN;

In the outbound direction of the trunk port, the switch forwards the data packets with VLAN tag intact, and the data packets without VLAN tag will not be forwarded from the trunk port.

There is a special situation on the trunk port. If native VLAN (also called PVID) is configured, the forwarding method is the same as that of the access port. When the packet comes in from the port without a vlan tag, it will be marked with a Native vlan tag; when it goes out from the port When a packet carries a Native vlan tag, the tag will be stripped off.

Still don’t understand? Just look at the picture below and simulate it a few times:

 

Guess you like

Origin blog.csdn.net/weixin_42517271/article/details/130385032
Recommended