试图绑定mac地址时,提示port-security不是合法指令,给端口绑定mac地址应该用哪些指令?
(0)
最佳答案
以下是端口安全的配置举例,请参考:
在交换机的端口GigabitEthernet1/0/1上对接入用户做如下的限制:
· 允许64个用户自由接入,不进行认证,将学习到的用户MAC地址添加为安全MAC地址;
· 当安全MAC地址数量达到64后,停止学习;当再有新的MAC地址接入时,触发入侵检测,并将此端口关闭30秒。
图1-1 端口安全autoLearn模式组网图
(1) 具体的配置步骤
<Switch> system-view
# 使能端口安全功能。
[Switch] port-security enable
# 打开入侵检测Trap开关。
[Switch] port-security trap intrusion
# 设置端口允许的最大安全MAC地址数为64。
[Switch] interface gigabitethernet 1/0/1
[Switch-GigabitEthernet1/0/1] port-security max-mac-count 64
# 设置端口安全模式为autoLearn。
[Switch-GigabitEthernet1/0/1] port-security port-mode autolearn
# 设置触发入侵检测特性后的保护动作为暂时关闭端口,关闭时间为30秒。
[Switch-GigabitEthernet1/0/1] port-security intrusion-mode disableport-temporarily
[Switch-GigabitEthernet1/0/1] quit
[Switch] port-security timer disableport 30
(2) 验证配置结果
上述配置完成后,可以用display命令显示端口安全配置情况,如下:
<Switch> display port-security interface gigabitethernet 1/0/1
Equipment port-security is enabled
Intrusion trap is enabled
Disableport Timeout: 30s
OUI value:
GigabitEthernet1/0/1 is link-up
Port mode is autoLearn
NeedToKnow mode is disabled
Intrusion Protection mode is DisablePortTemporarily
Max MAC address number is 64
Stored MAC address number is 0
Authorization is permitted
可以看到端口的最大安全MAC数为64,端口模式为autoLearn,入侵检测Trap开关打开,入侵保护动作为DisablePortTemporarily,入侵发生后端口禁用时间为30秒。
配置完成后,允许地址学习,学习到的MAC地址数可以用上述命令显示,如学习到5个,那么存储的安全MAC地址数就为5,可以在端口视图下用display this命令查看学习到的MAC地址,如:
<Switch> system-view
[Switch] interface gigabitethernet 1/0/1
[Switch-GigabitEthernet1/0/1] display this
#
interface GigabitEthernet1/0/1
port link-mode bridge
port-security max-mac-count 64
port-security port-mode autolearn
port-security intrusion-mode disableport-temporarily
port-security mac-address security 0002-0000-0015 vlan 1
port-security mac-address security 0002-0000-0014 vlan 1
port-security mac-address security 0002-0000-0013 vlan 1
port-security mac-address security 0002-0000-0012 vlan 1
port-security mac-address security 0002-0000-0011 vlan 1
#
当学习到的MAC地址数达到64后,用命令display port-security interface可以看到端口模式变为secure,再有新的MAC地址到达将触发入侵保护,Trap信息如下:
#Jul 14 10:39:47:135 2009 Switch PORTSEC/4/VIOLATION:Traph3cSecureViolation
An intrusion occurs!
IfIndex: 9437185
Port: 9437185
MAC Addr: 00:02:00:00:00:32
VLAN ID: 1
IfAdminStatus: 1
并且可以通过下述命令看到端口安全将此端口关闭:
[Switch-GigabitEthernet1/0/1] display interface gigabitethernet 1/0/1
GigabitEthernet1/0/1 current state: DOWN ( Port Security Disabled )
IP Packet Frame Type: PKTFMT_ETHNT_2, Hardware Address: 000f-cb00-5558
Description: GigabitEthernet1/0/1 Interface
......
30秒后,端口状态恢复:
[Switch-GigabitEthernet1/0/1] display interface gigabitethernet 1/0/1
GigabitEthernet1/0/1 current state: UP
IP Packet Frame Type: PKTFMT_ETHNT_2, Hardware Address: 000f-cb00-5558
Description: GigabitEthernet1/0/1 Interface
......
此时,如手动删除几条安全MAC地址后,端口安全的状态重新恢复为autoLearn,可以继续学习MAC地址。
(0)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论