配置MAC防漂移示例
组网需求
某企业网络中,用户需要访问企业的服务器。由于在企业网中很难控制接入用户的行为,如果某些非法用户从其他接口假冒服务器的MAC地址发送报文,则服务器的MAC地址将在其他接口学习到。这样用户发往服务器的报文就会发往非法用户,不仅会导致用户与服务器不能正常通信,还会导致一些重要用户信息被窃取。
如图2-14所示,为了提高服务器安全性,防止被非法用户攻击,可配置MAC防漂移功能。
操作步骤
- 创建VLAN,并将接口加入到VLAN中。
# 将10GE1/0/1、10GE1/0/2加入VLAN10。
<HUAWEI> system-view [~HUAWEI] sysname Switch [*HUAWEI] commit [~Switch] vlan 10 [*Switch-vlan10] quit [*Switch] interface 10ge 1/0/2 [*Switch-10GE1/0/2] port link-type trunk [*Switch-10GE1/0/2] port trunk allow-pass vlan 10 [*Switch-10GE1/0/2] quit [*Switch] interface 10ge 1/0/1 [*Switch-10GE1/0/1] port default vlan 10 [*Switch-10GE1/0/1] commit
- # 在10GE1/0/1上配置MAC地址学习的优先级为2。
[~Switch-10GE1/0/1] mac-address learning priority 2 [*Switch-10GE1/0/1] commit [~Switch-10GE1/0/1] quit
- 验证配置结果
# 在任意视图下执行display current-configuration命令,查看接口MAC地址学习的优先级配置是否正确。
[~Switch] display current-configuration interface 10ge 1/0/1 # interface 10GE1/0/1 port default vlan 10 mac-address learning priority 2 # return