109
NOTE:
To change the link type of a port from trunk to hybrid or vice versa, you must set the link type to access first.
After you use the port link-type { access | hybrid | trunk } command to change the link type of an interface,
the loopback detection action configured on the interface by using the loopback-detection action command will
be restored to the default. For more information about the loopback-detection action command, see the
Layer
2—LAN Switching Command Reference
.
Before you assign a hybrid port to a VLAN, create the VLAN.
After configuring the PVID for a hybrid port, you must use the port hybrid vlan command to configure the hybrid
port to allow packets from the PVID to pass through, so that the egress port can forward packets from the PVID.
After you configure a command on a Layer 2 aggregate interface, the system starts applying the configuration to
the aggregate interface and its aggregation member ports. If the system fails to do that on the aggregate
interface, it stops applying the configuration to the aggregation member ports. If it fails to do that on an
aggregation member port, it skips the port and moves to the next port.
Port-based VLAN configuration example
Network requirements
As shown in Figure 34:
Host A and Host C belong to Department A, and access the enterprise network through different
devices. Host B and Host D belong to Department B. They also access the enterprise network
through different devices.
To ensure communication security and avoid broadcast storms, VLANs are configured in the
enterprise network to isolate Layer 2 traffic of different departments. VLAN 100 is assigned to
Department A, and VLAN 200 is assigned to Department B.
Ensure that hosts within the same VLAN can communicate with each other. Host A can communicate
with Host C, and Host B can communicate with Host D.
Figure 34 Network diagram for port-based VLAN configuration
GE1/0/2GE1/0/1
Host A Host CHost B Host D
Device A
VLAN 100 VLAN 100VLAN 200 VLAN 200
Device B
GE1/0/1 GE1/0/2
GE1/0/3 GE1/0/3
Configuration procedure
1. Configure Device A.
# Create VLAN 100, and assign port GigabitEthernet 1/0/1 to VLAN 100.
<DeviceA> system-view
[DeviceA] vlan 100
[DeviceA-vlan100] port gigabitethernet 1/0/1
[DeviceA-vlan100] quit
# Create VLAN 200, and assign port GigabitEthernet 1/0/2 to VLAN 200.
[DeviceA] vlan 200