A trunk link refers to a high-speed network link connecting different network devices (such as switches and routers) in a computer network. This link is usually used to connect different local area networks (LAN) or wide area networks (WAN) to forward large amounts of data traffic and ensure fast network communication. Trunk links generally use high-speed, reliable, and stable transmission technologies, such as optical fiber, Gigabit Ethernet, etc., which can meet network application scenarios with high requirements on transmission rate, bandwidth capacity, packet delay, etc.
Trunk links usually work using link aggregation technology, which binds multiple physical links into one logical link to improve transmission efficiency and reliability. In a trunk link, multiple physical links are bound through the Link Aggregation Control Protocol (LACP) protocol to form a logical link, thereby fully utilizing the network bandwidth. When one of the physical links fails, other normally working links can automatically take over, ensuring the stability and reliability of network communications. In addition, Trunk links also support VLAN (Virtual Local Area Network) technology, which can divide multiple virtual networks on a single logical link to achieve isolation and priority processing between different departments and different needs.
Topology

Experiment purpose
1. In the practice trunk scenario, use trunk mode for the port connected to R1, so that the PC and R1 can communicate; and explain the principle; (Cisco uses active mode, Huawei uses passive mode, making it impossible to communicate, and explain the reason)
Configuration process
Step 1. Configure PC’s IP


Step 2. Configure the switch and router so that the PC and R1 can communicate
LSW3
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys LSW3
[LSW3]vlan b 10 20 //Create vlan in batches
[LSW3]int g0/0/10
[LSW3-GigabitEthernet0/0/10]po lin a //Set the interface to access mode
[LSW3-GigabitEthernet0/0/10]po de v 10 //The interface allows vlan to be 10
[LSW3-GigabitEthernet0/0/10]int g0/0/11
[LSW3-GigabitEthernet0/0/11]po lin a
[LSW3-GigabitEthernet0/0/11]po de v 20 //The interface allows vlan to be 20
[LSW3-GigabitEthernet0/0/11]int g0/0/3
[LSW3-GigabitEthernet0/0/3]po lin t //Set the interface to trunk mode
[LSW3-GigabitEthernet0/0/3]po
[LSW3-GigabitEthernet0/0/3]port t
[LSW3-GigabitEthernet0/0/3]port trunk a v 10 20 //The interface allows vlan to be 10 and 20
LSW1
<Huawei>SYS
Enter system view, return user view with Ctrl+Z.
[Huawei]sys LSW1
[LSW1]vlan b 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[LSW1]int g0/0/3
[LSW1-GigabitEthernet0/0/3]port lin t
[LSW1-GigabitEthernet0/0/3]po t a
[LSW1-GigabitEthernet0/0/3]po t a vlan 10 20
[LSW1-GigabitEthernet0/0/3]int g0/0/1
[LSW1-GigabitEthernet0/0/1]po lin t
[LSW1-GigabitEthernet0/0/1]po t a vlan 10 20
[LSW1-GigabitEthernet0/0/1]po trunk pvid v 10
AR1
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sys AR1
[AR1]int g0/0/1
[AR1-GigabitEthernet0/0/1]ip add 10.1.1.3 24
PC1 can ping AR1. First, the address is the same network segment, and then the data frame delivery process is:
① PC1 does not have a vlan tag when it is sent out. When entering LSW3, because the port is an access port, it is tagged with vlan 10;
②Vlan10 and 20 are released for trunk between LSW3 and LSW1, and they can pass;
③When I walked to the port connecting LSW1 to AR1, although the port was a trunk, pvid=10 was set, which was consistent with the vlan tag of data encapsulation, so the tag of vlan 10 was removed in the outbound direction and turned into an untagged data frame (Ethernet II frame) and sent to AR1. Access can be achieved.

PC2 cannot ping AR1.
When the data frame reaches the port connecting LSW1 to AR1, although the port is a trunk, pvid=10 is set, which is inconsistent with the vlan tag of the data encapsulation, so it is forwarded without processing. When an 802.1q data frame with vlan tag=20 is transmitted, the terminal device or general devices without the ability to remove the vlan tag cannot receive and communicate. Generally, terminals only receive Ethernet type II frames.

Step 3. Change the PVID of the port connecting SW1 to AR1 to a vlan used by non-services, so that all data frames transmitted in the trunk link carry vlan tags.
<LSW1>
<LSW1>sys
Enter system view, return user view with Ctrl+Z.
[LSW1]int g0/0/1
[LSW1-GigabitEthernet0/0/1]port trunk pvid vlan 4000
Error: The VLAN does not exist. //You need to create a vlan first. If the vlan does not exist, an error will be reported.
[LSW1-GigabitEthernet0/0/1]vlan 4000
[LSW1-vlan4000]int g0/0/1
[LSW1-GigabitEthernet0/0/1]port trunk pvid vlan 4000 //pvid modified to 4000
Huawei uses the passive mode of changing the pvid to a useless vlan, so that PC1 and AR1 cannot communicate; the reason for the inability to communicate is that, like PC2, the outbound vlan tag cannot be removed 10
