目录
简介:
端口隔离:端口隔离是为了实现报文之间的二层隔离,可以将不同的端口加入不同的VLAN,但会浪费有限的VLAN资源。采用端口隔离特性,可以实现同一VLAN内端口之间的隔离。用户只需要将端口加入到隔离组中,就可以实现隔离组内端口之间二层数据的隔离。端口隔离功能为用户提供了更安全、更灵活的组网方案
端口隔离配置:

先对PC1和PC2进行IP地址和子网掩码的配置


在没有配置VLAN之前,默认是VLAN1,所以两个PC机处于一个域里面,所以它们之间是可以通信的


然后进行端口隔离配置,配置接口GE0/0/1和GE0/0/2的端口隔离功能,实现两个端口之间的二层数据隔离,三层数据互通

配置了端口隔离后,两个PC机就不能进行二层数据通信了


配置命令如下:
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname Xzzzz911
[Xzzzz911]
Oct 17 2024 23:37:32-08:00 Xzzzz911 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011
.5.25.191.3.1 configurations have been changed. The current change number is 4,
the change loop count is 0, and the maximum number of records is 4095.
[Xzzzz911]undo info-center enable
Info: Information center is disabled.
[Xzzzz911]port-isolate mode l2
[Xzzzz911]interface GigabitEthernet 0/0/1
[Xzzzz911-GigabitEthernet0/0/1]port-isolate enable group 1
[Xzzzz911-GigabitEthernet0/0/1]q
[Xzzzz911]interface GigabitEthernet 0/0/2
[Xzzzz911-GigabitEthernet0/0/2]port-isolate enable group 1
[Xzzzz911-GigabitEthernet0/0/2]q
尽管两个端口都被隔离了,但仍然可以使用ARP代理来进行三层数据通信,利用网关来进行数据通信,接下来配置网关(由于没有设置VLAN,使用默认VLAN 1,记得PC机里面也要设置一样的网关)

ARP代理的两种模式:前者是打开同一个VLAN的ARP代理,而后者是打开VLAN之间的ARP代理

直接打开同一VLAN的ARP代理即可实现三层数据通信,这样两个PC机又可以进行通信了



配置命令如下:
[Xzzzz911]int vlan 1
[Xzzzz911-Vlanif1]ip address 192.168.10.254 24
[Xzzzz911-Vlanif1]arp-proxy ?
enable Enable proxy ARP(Address Resolve Protocol)
inner-sub-vlan-proxy Proxy ARP within a VLAN
inter-sub-vlan-proxy Proxy ARP between VLANs
[Xzzzz911-Vlanif1]arp-proxy inner-sub-vlan-proxy enable
端口速率配置:
配置以太网接口GE0/0/1在自协商模式下协商速率为100Mb/s

配置命令如下:
<Xzzzz911>system-view
Enter system view, return user view with Ctrl+Z.
[Xzzzz911]interface GigabitEthernet 0/0/1
[Xzzzz911-GigabitEthernet0/0/1]undo negotiation auto //关闭自动协商功能,配置以太网接口工作在非自协商模式
[Xzzzz911-GigabitEthernet0/0/1]speed 100
端口模式配置:
配置以太网接口GE0/0/1在自协商模式下双工模式为全双工模式

<Xzzzz911>system-view
Enter system view, return user view with Ctrl+Z.
[Xzzzz911]interface GigabitEthernet 0/0/1
[Xzzzz911-GigabitEthernet0/0/1]undo negotiation auto
[Xzzzz911-GigabitEthernet0/0/1]duplex full
总结:
1、端口隔离模式不止上面的一种模式,它其实有两种模式:
(1)二层隔离三层互通(L2):二层数据隔离,三层数据互通
(2)二层三层均隔离(ALL):二层数据隔离,三层数据也隔离

(3)二层数据通信:根据IP地址来进行通信
(4)三层数据通信:根据网关来进行数据通信
2、端口隔离基本原理
(1)同一VLAN隔离组内的用户不能进行二层通信
(2)不同VLAN隔离组内的用户可正常通信
(3)未划分VLAN隔离的用户也可以与VLAN隔离组内的用户正常通信