To implement Layer 2 isolation between interfaces, you can add each interface to a different VLAN. However, this method wastes VLAN resources. Port isolation can isolate interfaces in the same VLAN, and a port isolation group can effectively implement Layer 2 isolation between these interfaces. Port isolation provides secure and flexible networking solutions.
An R&D office of a company contains employees from the company, partner company A, and partner company B. As shown in Figure 1, PC1 and PC2 are used by two employees from partner companies A and B respectively, and PC3 is used by an R&D employee from the company. The requirements are as follows:
The configuration roadmap is as follows:
Add interfaces to a VLAN.
Add the interfaces to a port isolation group to implement Layer 2 isolation between these interfaces. The default port isolation mode is Layer 2 isolation and Layer 3 interworking.
# Configure port isolation on GE1/0/1.
<HUAWEI> system-view [HUAWEI] sysname Switch [Switch] vlan 10 [Switch-vlan10] quit [Switch] interface gigabitethernet 1/0/1 [Switch-GigabitEthernet1/0/1] port link-type access //Set the interface type of GE1/0/1 to access. [Switch-GigabitEthernet1/0/1] port default vlan 10 //Add GE1/0/1 to VLAN 10. [Switch-GigabitEthernet1/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-GigabitEthernet1/0/1] quit
# Configure port isolation on GE1/0/2.
[Switch] interface gigabitethernet 1/0/2 [Switch-GigabitEthernet1/0/2] port link-type access //Set the interface type of GE1/0/2 to access. [Switch-GigabitEthernet1/0/2] port default vlan 10 //Add GE1/0/2 to VLAN 10. [Switch-GigabitEthernet1/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-GigabitEthernet1/0/2] quit
# Add GE1/0/3 to VLAN 10.
[Switch] interface gigabitethernet 1/0/3 [Switch-GigabitEthernet1/0/3] port link-type access //Set the interface type of GE1/0/3 to access. [Switch-GigabitEthernet1/0/3] port default vlan 10 //Add GE1/0/3 to VLAN 10. [Switch-GigabitEthernet1/0/3] quit
# PC1 and PC2 cannot communicate with each other.
# PC1 and PC3 can communicate with each other.
# PC2 and PC3 can communicate with each other.
Switch configuration file
# sysname Switch # vlan batch 10 # interface GigabitEthernet1/0/1 port link-type access port default vlan 10 port-isolate enable group 1 # interface GigabitEthernet1/0/2 port link-type access port default vlan 10 port-isolate enable group 1 # interface GigabitEthernet1/0/3 port link-type access port default vlan 10 # return