First, we can see the following experiment topology:
650) This. width = 650; "width =" 617 "Height =" 379 "src ="/e/u261/themes/default/images/spacer.gif "style =" Background: URL ("/e/u261/lang/ZH-CN/images/localimage.png") No-repeat center; Border: 1px solid # DDD; "alt =" spacer.gif "/>
Except that the E0/0/5 and E0/0/1 ports connected to the two vswitches are trunk, and the other ports connected to the PC are all access interface types.
1: When the trunk interface receives a packet frame carrying VLAN tags, it determines whether the port allows packets marked by this VLAN to pass. If yes, the packet carries the original VLAN tag for forwarding. Otherwise, the packet is discarded.
2: If the received packets do not carry VLAN tags, the packets are marked as PVID of the port.
3: when sending packets, the trunk interface first checks whether the VLAN tags carried by the packets are the same as the PVID of the port. If they are equal, the VLAN tags carried in the packets are removed. If they are different, the packet carries the original VLAN tag for forwarding.
Trunk interface forwarding process:
1. receives a data frame.
Whether two frames have VLAN tags, no tags, and the frames are discarded. If there is a tag, the trunk interface determines whether the VLAN frame is allowed to enter. If this parameter is set, the next step is processed. Otherwise, the frame is discarded.
3. The vswitch searches for VLAN configuration information based on the target MAC address and vlan id of the frame and determines from which interface to send the frame.
4. The switch sends data frames based on the found outbound interface.
SW1 Configuration:
<Huawei>
[Huawei] sys
[Huawei] sysname SW1
[SW1] int E0/0/1
[SW1-Ethernet0/0/1] portlink-type access // first define the interface type as access.
[SW1] int E0/0/2
[SW1-Ethernet0/0/2] portlink-type access
[SW1] int E0/0/3
[SW1-Ethernet0/0/3] portlink-type access
[SW1] int E0/0/4
[SW1-Ethernet0/0/4] portlink-type access.
[SW1] VLAN 10
[SW1-vlan10] Port E0/0/1
[SW1-vlan10] Port E0/0/3
[SW1] VLAN 20
[SW1-vlan20] Port E0/0/2
[SW1-vlan20] Port E0/0/4
Sw2 configuration (approximate configuration): [sw2] VLAN 20
[SW2-vlan20] porte0/0/2
[Sw2] VLAN 10
[SW2-vlan10] porte0/0/3.
In this case, if pC1 is used to ping PC3, it is possible that pC1 and PC3 are in the same network segment, the same VLAN and the same switch.
650) This. width = 650; "width =" 504 "Height =" 270 "src ="/e/u261/themes/default/images/spacer.gif "style =" Background: URL ("/e/u261/lang/ZH-CN/images/localimage.png") No-repeat center; Border: 1px solid # DDD; "alt =" spacer.gif "/>
However, Ping PC6 with pC1 is not allowed, because the two interfaces of the Cross-switch are only allowed to pass through vlan1. therefore, the interfaces of the two switches must be configured with the trunk link type.
650) This. width = 650; "width =" 555 "Height =" 145 "src ="/e/u261/themes/default/images/spacer.gif "style =" Background: URL ("/e/u261/lang/ZH-CN/images/localimage.png") No-repeat center; Border: 1px solid # DDD; "alt =" spacer.gif "/>
If you want to ping pC1 and PC6, You need to configure the trunk link on the interfaces of the two switches. The added configuration is as follows:
[SW1] int E0/0/5
[SW1-Ethernet0/0/5] portlink-type trunk // specify the interface type as trunk
[SW1-Ethernet0/0/5] porttrunk allow-pass VLAN all // by default, the trunk port only allows the default VLAN to pass through, that is, the data frame of vlan1 passes through, so specify which VLAN frames can pass through. The H3C configuration command here is port trunk permit vlanall
[Sw2] int E0/0/1
[SW2-Ethernet0/0, 0/1] portlink-type trunk
[SW2-Ethernet0/0/1] Port trunk allow-pass vlanall.
After the configuration is added, Ping PC6 with pC1 as shown in the following figure:
650) This. width = 650; "width =" 437 "Height =" 220 "src ="/e/u261/themes/default/images/spacer.gif "style =" Background: URL ("/e/u261/lang/ZH-CN/images/localimage.png") No-repeat center; Border: 1px solid # DDD; "alt =" spacer.gif "/>.
VLAN trunk interface experiment