To isolate broadcast packets in the same VLAN but allow users connecting to different interfaces to communicate at Layer 3, you can set the port isolation mode to Layer 2 isolation and Layer 3 interworking. To prevent interfaces in the same VLAN from communicating at both Layer 2 and Layer 3, you can set the port isolation mode to Layer 2 and Layer 3 isolation.
Figure 1 shows a port isolation usage scenario. PC1, PC2, and PC3 belong to VLAN 10. After GE0/0/1 connecting to PC1 and GE0/0/2 connecting to PC2 are added to a port isolation group, PC1 and PC2 cannot communicate with each other in VLAN 10, but they can communicate with PC3.
Unidirectional port isolation can be configured in certain scenarios. When multiple hosts connect to different interfaces of a device, a host with security risks may send a lot of broadcast packets to other hosts. You can configure unidirectional isolation to prevent the insecure host from sending packets to other hosts.
As shown in Figure 2, PC4 is not secure and sends many broadcast packets to other hosts. You can configure unidirectional isolation to isolate GE0/0/4 from GE0/0/5 and GE0/0/6 unidirectionally. In this way, the broadcast packets sent by PC4 cannot reach PC5 and PC6, but the broadcast packets sent by PC5 and PC6 can reach PC4.
In Figure 3, PC3 needs to communicate with PC1 and PC2 but PC1 and PC2 cannot communicate with each other.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan 10 [Switch-vlan10] quit [Switch] interface gigabitethernet 0/0/1 [Switch-GigabitEthernet0/0/1] port link-type access [Switch-GigabitEthernet0/0/1] port default vlan 10 [Switch-GigabitEthernet0/0/1] port-isolate enable //By default, the interface is added to port isolation group 1 and the port isolation mode is Layer 2 isolation and Layer 3 interworking. You can run the port-isolate mode all command to set the port isolation mode to Layer 2 and Layer 3 isolation. [Switch-GigabitEthernet0/0/1] quit [Switch] interface gigabitethernet 0/0/2 [Switch-GigabitEthernet0/0/2] port link-type access [Switch-GigabitEthernet0/0/2] port default vlan 10 [Switch-GigabitEthernet0/0/2] port-isolate enable //By default, the interface is added to port isolation group 1 and the port isolation mode is Layer 2 isolation and Layer 3 interworking. You can run the port-isolate mode all command to set the port isolation mode to Layer 2 and Layer 3 isolation. [Switch-GigabitEthernet0/0/2] quit [Switch] interface gigabitethernet 0/0/3 [Switch-GigabitEthernet0/0/3] port link-type access [Switch-GigabitEthernet0/0/3] port default vlan 10 [Switch-GigabitEthernet0/0/3] quit
Run the display port-isolate group { group-id | all } command in any view to check the configuration of a port isolation group.
After configuring port isolation, you can perform the following tasks:
To reduce the maintenance workload and operation complexity, run the clear configuration port-isolate command in the system view to clear all the port isolation configurations on the device.
To exclude a VLAN when configuring port isolation, run the port-isolate exclude vlan command in the system view. This configuration ensures that port isolation does not take effect in the excluded VLAN, and users in the VLAN can communicate with each other.