如圖12-14所示,Host通過Switch接入網絡,Gateway為企業出口網關,各Host均使用靜態配置的IP地址。管理員希望Host使用管理員分配的固定IP地址上網,不允許私自更改IP地址非法獲取網絡訪問權限。
采用如下的思路在Switch上配置IPSG功能,實現上述需求。
在Switch上配置Host_1和Host_2的靜態綁定表,固定IP和MAC的綁定關系。
在Switch連接用戶主機的接口使能IPSG,實現Host只能使用管理員分配的固定IP地址上網。同時,在接口開啟IP報文檢查告警功能,當交換機丟棄非法上網用戶的報文達到閾值后上報告警。
創建Host_1和Host_2的靜態綁定表項
system-view
Switch[Switch] user-bind static ip-address 10.0.0.1 mac-address 0001-0001-0001
[Switch] user-bind static ip-address 10.0.0.11 mac-address 0002-0002-0002
使能IPSG并設置丟棄報文上報告警功能
# 在連接Host_1的GE1/0/1接口使能IPSG和IP報文檢查告警功能,當丟棄報文閾值到達200將上報告警。
[Switch] interface gigabitethernet 1/0/1
[Switch-GigabitEthernet1/0/1] ip source check user-bind enable
[Switch-GigabitEthernet1/0/1] ip source check user-bind alarm enable
[Switch-GigabitEthernet1/0/1] ip source check user-bind alarm threshold 200
[Switch-GigabitEthernet1/0/1] quit
# 在連接Host_2的GE1/0/2接口使能IPSG和IP報文檢查告警功能,當丟棄報文閾值到達200將上報告警。
[Switch] interface gigabitethernet 1/0/2
[Switch-GigabitEthernet1/0/2] ip source check user-bind enable
[Switch-GigabitEthernet1/0/2] ip source check user-bind alarm enable
[Switch-GigabitEthernet1/0/2] ip source check user-bind alarm threshold 200
[Switch-GigabitEthernet1/0/2] quit
驗證配置結果
在Switch上執行display dhcp static user-bind all命令,可以查看靜態綁定表信息。
[Switch] display dhcp static user-bind allDHCP static Bind-table: Flags:O - outer vlan ,I - inner vlan ,P - Vlan-mapping IP Address MAC Address VSI/VLAN(O/I/P) Interface -------------------------------------------------------------------------------- 10.0.0.1 0001-0001-0001 -- /-- /-- -- 10.0.0.11 0002-0002-0002 -- /-- /-- -- -------------------------------------------------------------------------------- Print count: 2 Total count: 2
Host_1和Host_2使用管理員分配的固定IP地址可以正常訪問網絡,更改IP地址后無法訪問網絡。
Switch的配置文件
# sysname Switch# user-bind static ip-address 10.0.0.1 mac-address 0001-0001-0001 user-bind static ip-address 10.0.0.11 mac-address 0002-0002-0002 # interface GigabitEthernet1/0/1 ip source check user-bind enable ip source check user-bind alarm enable ip source check user-bind alarm threshold 200 # interface GigabitEthernet1/0/2 ip source check user-bind enable ip source check user-bind alarm enable ip source check user-bind alarm threshold 200 # return