型号是S5120V3-52S-SI,添加静态mac地址后,也限制mac最大数量了,还是有动态MAC地址出现
interface GigabitEthernet1/0/48
description 市属医院传输7600
port access vlan 29
port-isolate enable group 1
bpdu-drop any
mac-address max-mac-count 21
undo mac-address max-mac-count enable-forwarding
mac-address static 4064-dc31-c12b vlan 29
mac-address static 407d-0f97-50df vlan 29
mac-address static 6c2b-5985-03c8 vlan 29
mac-address static 703a-a63a-5c03 vlan 29
mac-address static 902e-1604-d8bf vlan 29
mac-address static 94ff-3ce2-b3ea vlan 29
mac-address static b04f-a6d7-5734 vlan 29
mac-address static bcfc-e7b9-0fcf vlan 29
mac-address static c0a4-768a-27d1 vlan 29
mac-address static dead-beef-26e7 vlan 29
mac-address static dead-beef-4323 vlan 29
mac-address static dead-beef-44a4 vlan 29
mac-address static dead-beef-7188 vlan 29
mac-address static dead-beef-718a vlan 29
mac-address static dead-beef-7198 vlan 29
mac-address static dead-beef-955c vlan 29
mac-address static dead-beef-a72e vlan 29
mac-address static dead-beef-b500 vlan 29
mac-address static dead-beef-bb3a vlan 29
mac-address static dead-beef-e77c vlan 29
mac-address static f4e9-7588-2c35 vlan 29
loopback-detection enable vlan 29
#
return
[JMS-AC-YiYuan-GigabitEthernet1/0/48]dis mac-address interface GigabitEthernet 1/0/48
MAC Address VLAN ID State Port/Nickname Aging
4064-dc31-c12b 29 Static GE1/0/48 N
407d-0f97-50df 29 Static GE1/0/48 N
6c2b-5985-03c8 29 Static GE1/0/48 N
703a-a63a-5c03 29 Static GE1/0/48 N
902e-1604-d8bf 29 Static GE1/0/48 N
94ff-3ce2-b3ea 29 Static GE1/0/48 N
b04f-a6d7-5734 29 Static GE1/0/48 N
bcfc-e7b9-0fcf 29 Static GE1/0/48 N
c0a4-768a-27d1 29 Static GE1/0/48 N
dead-beef-26e7 29 Static GE1/0/48 N
dead-beef-4323 29 Static GE1/0/48 N
dead-beef-44a4 29 Static GE1/0/48 N
dead-beef-7188 29 Static GE1/0/48 N
dead-beef-718a 29 Static GE1/0/48 N
dead-beef-7198 29 Static GE1/0/48 N
dead-beef-955c 29 Static GE1/0/48 N
dead-beef-a72e 29 Static GE1/0/48 N
dead-beef-b500 29 Static GE1/0/48 N
dead-beef-bb3a 29 Static GE1/0/48 N
dead-beef-e77c 29 Static GE1/0/48 N
f4e9-7588-2c35 29 Static GE1/0/48 N
000f-e944-ab5f 29 Learned GE1/0/48 Y
000f-e998-7f72 29 Learned GE1/0/48 Y
000f-e999-638c 29 Learned GE1/0/48 Y
00e0-fc09-bcf9 29 Learned GE1/0/48 Y
3cc7-86d7-ed2a 29 Learned GE1/0/48 Y
7449-d2d6-4ab1 29 Learned GE1/0/48 Y
解决方案
方法一:启用端口安全功能(推荐)
# 进入端口配置模式
system-view
interface GigabitEthernet1/0/48
# 启用端口安全功能
port-security enable
# 设置端口安全模式为static(只允许静态MAC)
port-security port-mode autolearn
# 手动将已学习的动态MAC转换为安全MAC(可选)
port-security mac-address security 4064-dc31-c12b vlan 29
port-security mac-address security 407d-0f97-50df vlan 29
# ... 添加所有需要允许的MAC地址
# 或者直接启用自动学习并限制为只允许已配置的静态MAC
port-security mac-address learning-mode static
方法二:使用更严格的MAC地址限制
interface GigabitEthernet1/0/48
# 禁用MAC地址自动学习
undo mac-address mac-learning enable
# 或者设置MAC学习数量为0(如果支持)
mac-address max-mac-count 0
# 配置违规处理方式为block(丢弃未知MAC的帧)
mac-address max-mac-count enable-forwarding
mac-address trap violation
方法三:完整的端口安全配置示例
system-view
interface GigabitEthernet1/0/48
# 1. 启用端口安全
port-security enable
# 2. 设置安全MAC地址学习模式为静态
port-security mac-address learning-mode static
# 3. 设置端口安全模式
port-security port-mode userlogin-secure
# 4. 设置最大安全MAC地址数为静态MAC的数量
port-security max-mac-count 21
# 5. 配置违规处理(MAC地址违规时关闭端口)
port-security intrusion-mode disableport-temporarily
# 6. 添加所有静态MAC为安全MAC(逐个添加)
port-security mac-address security 4064-dc31-c12b vlan 29
port-security mac-address security 407d-0f97-50df vlan 29
port-security mac-address security 6c2b-5985-03c8 vlan 29
# ... 继续添加所有21个MAC地址
# 7. 保存配置
save
方法四:使用ACL进行MAC地址过滤(备用方案)
如果端口安全功能不适用,可以使用MAC ACL:
# 创建高级ACL
acl number 4000
rule 5 permit source-mac 4064-dc31-c12b ffff-ffff-ffff
rule 10 permit source-mac 407d-0f97-50df ffff-ffff-ffff
# ... 为每个允许的MAC添加规则
rule 100 deny
# 在端口上应用ACL
interface GigabitEthernet1/0/48
packet-filter 4000 inbound
验证配置
配置完成后,使用以下命令验证:
# 检查端口安全状态
display port-security interface GigabitEthernet1/0/48
# 检查MAC地址表
display mac-address interface GigabitEthernet1/0/48
# 检查是否有违规记录
display port-security violation interface GigabitEthernet1/0/48
重要说明
端口安全模式选择:
userlogin-secure: 最严格,只允许安全MAC
autolearn: 自动学习并转换为安全MAC
static: 只允许手动配置的安全MAC
违规处理方式:
disableport-temporarily: 暂时关闭端口(推荐)
blockmac: 阻塞违规MAC
disableport: 永久关闭端口
注意事项:
配置前确保所有合法设备都已添加为静态MAC
建议先在测试端口验证配置效果
配置变更可能会造成网络短暂中断
推荐使用方法一的组合配置,这样可以确保端口只允许您指定的21个静态MAC地址通信,其他任何动态学习的MAC地址都会被拒绝。
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论