配置通过IPSG功能对IP报文的接口+IP+MAC信息进行匹配检查示例
组网需求
如图14-2所示,HostA与HostB分别与Switch的10GE1/0/1和10GE1/0/2接口相连。要求使HostB不能仿冒HostA的IP和MAC欺骗Server,保证HostA的IP报文能正常上送。
配置思路
采用如下的思路在Switch上配置IPSG功能(假设用户的IP地址是静态分配的):
- 接口使能IP报文检查功能。连接HostA和HostB的接口都需要使能该功能。
- 配置静态绑定表,对于静态配置IP的用户建立绑定关系表。
以下配置步骤中,只列出了和IP Source Guard配置相关的命令。
操作步骤
- 配置IP报文检查功能
# 在连接HostA的10GE1/0/1接口使能IP报文检查功能。
<HUAWEI> system-view [~HUAWEI] sysname Switch [*HUAWEI] commit [~Switch] interface 10ge 1/0/1 [~Switch-10GE1/0/1] ip source check user-bind enable
# 在连接HostA的10GE1/0/1接口使能IP报文检查告警功能并配置告警阈值。
[*Switch-10GE1/0/1] ip source check user-bind alarm enable [*Switch-10GE1/0/1] ip source check user-bind alarm threshold 200 [*Switch-10GE1/0/1] quit
# 在连接HostB的10GE1/0/2接口使能IP报文检查功能。
[*Switch] interface 10ge 1/0/2 [*Switch-10GE1/0/2] ip source check user-bind enable
# 在连接HostB的10GE1/0/2接口使能IP报文检查告警功能并配置告警阈值。
[*Switch-10GE1/0/2] ip source check user-bind alarm enable [*Switch-10GE1/0/2] ip source check user-bind alarm threshold 200 [*Switch-10GE1/0/2] quit
- 配置静态绑定表项
# 配置HostA为静态绑定表项。
[*Switch] user-bind static ip-address 10.0.0.1 mac-address 0001-0001-0001 interface 10ge 1/0/1 [*Switch] commit
- 验证配置结果
在Switch上执行display user-bind static all命令可以查看绑定表信息。
[~Switch] display user-bind static all Flags: O - outer vlan, I - inner vlan, P - map vlan IP Address MAC Address VSI/VLAN(O/I/P) Interface -------------------------------------------------------------------------------- 10.0.0.1 0001-0001-0001 -- /-- /-- 10GE1/0/1 -------------------------------------------------------------------------------- Print count: 1 Total count: 1
从显示信息可知,HostA已经配置为静态绑定表项。
配置文件
Switch的配置文件
# sysname Switch # user-bind static ip-address 10.0.0.1 mac-address 0001-0001-0001 interface 10GE1/0/1 # interface 10GE1/0/1 ip source check user-bind enable ip source check user-bind alarm enable ip source check user-bind alarm threshold 200 # interface 10GE1/0/2 ip source check user-bind enable ip source check user-bind alarm enable ip source check user-bind alarm threshold 200 # return