客户现在是我们安装的监控项目,摄像头一共有61个,监控核心交换机是S5130S-28P-EI。现在的问题是客户那边有内部的人私自接到监控网络里面下载视频,为了阻止私自用电脑接入到监控网络,客户的信息中心主任向我们提出要求在咱们这台S5130S-28P-EI交换机上做配置,要求交换机只让现有的电脑和录像机以及摄像头的数据通过,如果有陌生的电话接到到监控网络就让这台非法接放的电脑不地址转发,也就是说让他接到网络里时交换机不让他通过任何数据。 这对我来说是一种挑战,之前没有做过这种配置,好像只在一些资料中看到过类似的案例。麻烦高手给予指点一下。脚本应如何写。最好发个教程。谢谢。 也就是说只能让现有的设备通过核心交换机,有新设备接入到网络就不让其通过。麻烦老师们指点一下。
(0)
最佳答案
在Device的端口GigabitEthernet1/0/1上对接入用户做如下的限制:
· 允许64个用户自由接入,不进行认证,将学习到的用户MAC地址添加为Sticky MAC地址,老化时间为30分钟;
· 当安全MAC地址数量达到64后,停止学习;当再有新的MAC地址接入时,触发入侵检测,并将此端口关闭30秒。
图1-1 端口安全autoLearn模式组网图
# 使能端口安全。
<Device> system-view
[Device] port-security enable
# 设置安全MAC地址的老化时间为30分钟。
[Device] port-security timer autolearn aging 30
# 设置端口安全允许的最大安全MAC地址数为64。
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] port-security max-mac-count 64
# 设置端口安全模式为autoLearn。
[Device-GigabitEthernet1/0/1] port-security port-mode autolearn
# 设置触发入侵检测特性后的保护动作为暂时关闭端口,关闭时间为30秒。
[Device-GigabitEthernet1/0/1] port-security intrusion-mode disableport-temporarily
[Device-GigabitEthernet1/0/1] quit
[Device] port-security timer disableport 30
上述配置完成后,可以使用如下显示命令查看端口安全的配置情况。
[Device] display port-security interface gigabitethernet 1/0/1
Global port security parameters:
Port security : Enabled
AutoLearn aging time : 30 min
Disableport timeout : 30 s
Blockmac timeout : 180 s
MAC move : Denied
Authorization fail : Online
NAS-ID profile : Not configured
Dot1x-failure trap : Disabled
Dot1x-logon trap : Disabled
Dot1x-logoff trap : Disabled
Intrusion trap : Disabled
Address-learned trap : Disabled
Mac-auth-failure trap : Disabled
Mac-auth-logon trap : Disabled
Mac-auth-logoff trap : Disabled
Open authentication : Disabled
Traffic-statistics : Disabled
OUI value list :
Index : 1 Value : 123401
GigabitEthernet1/0/1 is link-up
Port mode : autoLearn
NeedToKnow mode : Disabled
Intrusion protection mode : DisablePortTemporarily
Strict intrusion protection : Disabled
Security MAC address attribute
Learning mode : Sticky
Aging type : Periodical
Max secure MAC addresses : 64
Current secure MAC addresses : 0
Authorization : Permitted
NAS-ID profile : Not configured
Free VLANs : Not configured
Open authentication : Disabled
MAC-move VLAN check bypass : Disabled
可以看到端口安全所允许的最大安全MAC地址数为64,端口模式为autoLearn,入侵检测保护动作为DisablePortTemporarily,入侵发生后端口被禁用时间为30秒。
配置生效后,端口允许地址学习,学习到的MAC地址数可在上述显示信息的“Current number of secure MAC addresses”字段查看到,具体的MAC地址信息可以在接口视图下用display this命令查看。
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] display this
#
interface GigabitEthernet1/0/1
port-security max-mac-count 64
port-security port-mode autolearn
port-security mac-address security sticky 0002-0000-0015 vlan 1
port-security mac-address security sticky 0002-0000-0014 vlan 1
port-security mac-address security sticky 0002-0000-0013 vlan 1
port-security mac-address security sticky 0002-0000-0012 vlan 1
port-security mac-address security sticky 0002-0000-0011 vlan 1
#
当学习到的MAC地址数达到64后,用命令display port-security interface可以看到端口模式变为secure,再有新的MAC地址到达将触发入侵保护,可以通过命令display interface看到此端口关闭。30秒后,端口状态恢复。此时,如果手动删除几条安全MAC地址后,端口安全的状态重新恢复为autoLearn,可以继续学习MAC地址。
客户端通过端口GigabitEthernet1/0/1连接到Device上,Device通过RADIUS服务器对客户端进行身份认证,如果认证成功,客户端被授权允许访问Internet资源。
· IP地址为192.168.1.2的RADIUS服务器作为主认证服务器和从计费服务器,IP地址为192.168.1.3的RADIUS服务器作为从认证服务器和主计费服务器。认证共享密钥为name,计费共享密钥为money。
· 所有接入用户都使用ISP域sun的认证/授权/计费方法,该域最多可同时接入30个用户;
· 系统向RADIUS服务器重发报文的时间间隔为5秒,重发次数为5次,发送实时计费报文的时间间隔为15分钟,发送的用户名不带域名。
· 端口GigabitEthernet1/0/1同时允许一个802.1X用户以及一个与指定OUI值匹配的设备接入。
图1-2 端口安全userLoginWithOUI模式组网图
· 下述配置步骤包含了部分AAA/RADIUS协议配置命令,具体介绍请参见“安全配置指导”中的“AAA”。
· 保证客户端和RADIUS服务器之间路由可达。
(1) 配置AAA
# 配置RADIUS方案。
<Device> system-view
[Device] radius scheme radsun
[Device-radius-radsun] primary authentication 192.168.1.2
[Device-radius-radsun] primary accounting 192.168.1.3
[Device-radius-radsun] secondary authentication 192.168.1.3
[Device-radius-radsun] secondary accounting 192.168.1.2
[Device-radius-radsun] key authentication simple name
[Device-radius-radsun] key accounting simple money
[Device-radius-radsun] timer response-timeout 5
[Device-radius-radsun] retry 5
[Device-radius-radsun] timer realtime-accounting 15
[Device-radius-radsun] user-name-format without-domain
[Device-radius-radsun] quit
# 配置ISP域。
[Device] domain sun
[Device-isp-sun] authentication lan-access radius-scheme radsun
[Device-isp-sun] authorization lan-access radius-scheme radsun
[Device-isp-sun] accounting lan-access radius-scheme radsun
[Device-isp-sun] quit
(2) 配置802.1X
# 配置802.1X的认证方式为CHAP。(该配置可选,缺省情况下802.1X的认证方式为CHAP)
[Device] dot1x authentication-method chap
# 指定端口上接入的802.1X用户使用强制认证域sun。
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] dot1x mandatory-domain sun
[Device-GigabitEthernet1/0/1] quit
(3) 配置端口安全
# 使能端口安全。
[Device] port-security enable
# 添加5个OUI值。(最多可添加16个,此处仅为示例。最终,端口仅允许一个与某OUI值匹配的用户通过认证)
[Device] port-security oui index 1 mac-address 1234-0100-1111
[Device] port-security oui index 2 mac-address 1234-0200-1111
[Device] port-security oui index 3 mac-address 1234-0300-1111
[Device] port-security oui index 4 mac-address 1234-0400-1111
[Device] port-security oui index 5 mac-address 1234-0500-1111
# 设置端口安全模式为userLoginWithOUI。
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] port-security port-mode userlogin-withoui
[Device-GigabitEthernet1/0/1] quit
# 查看端口安全的配置信息。
[Device] display port-security interface gigabitethernet 1/0/1
Global port security parameters:
Port security : Enabled
AutoLearn aging time : 30 min
Disableport timeout : 30 s
Blockmac timeout : 180 s
MAC move : Denied
Authorization fail : Online
NAS-ID profile : Not configured
Dot1x-failure trap : Disabled
Dot1x-logon trap : Disabled
Dot1x-logoff trap : Disabled
Intrusion trap : Disabled
Address-learned trap : Disabled
Mac-auth-failure trap : Disabled
Mac-auth-logon trap : Disabled
Mac-auth-logoff trap : Disabled
Open authentication : Disabled
Traffic-statistics : Disabled
OUI value list :
Index : 1 Value : 123401
Index : 2 Value : 123402
Index : 3 Value : 123403
Index : 4 Value : 123404
Index : 5 Value : 123405
GigabitEthernet1/0/1 is link-up
Port mode : userLoginWithOUI
NeedToKnow mode : Disabled
Intrusion protection mode : NoAction
Strict intrusion protection : Disabled
Security MAC address attribute
Learning mode : Sticky
Aging type : Periodical
Max secure MAC addresses : Not configured
Current secure MAC addresses : 1
Authorization :Permitted
NAS-ID profile : Not configured
Free VLANs : Not configured
Open authentication : Disabled
MAC-move VLAN check bypass : Disabled
配置完成后,如果有802.1X用户上线,则可以通过上述显示信息看到当前端口保存的MAC地址数为1。还可以通过display dot1x命令查看该802.1X用户的在线情况。
此外,端口还允许一个MAC地址与OUI值匹配的用户通过,可以通过下述命令查看。
[Device] display mac-address interface gigabitethernet 1/0/1
MAC Address VLAN ID State Port/Nickname Aging
1234-0300-0011 1 Learned GE1/0/1 Y
客户端通过端口GigabitEthernet1/0/1连接到Device上,Device通过RADIUS服务器对客户端进行身份认证。如果认证成功,客户端被授权允许访问Internet资源。
· 可以有多个MAC认证用户接入;
· 如果是802.1X用户请求认证,先进行MAC地址认证,MAC地址认证失败,再进行802.1X认证。最多只允许一个802.1X用户接入;
· MAC地址认证设置用户名格式为用户MAC地址的形式;
· 上线的MAC地址认证用户和802.1X认证用户总和不能超过64个;
· 为防止报文发往未知目的MAC地址,启动ntkonly方式的Need To Know特性。
图1-3 端口安全macAddressElseUserLoginSecure模式组网图
· RADIUS认证/计费及ISP域的配置同“1.22.2 端口安全userLoginWithOUI模式配置举例”,这里不再赘述。
· 保证接入用户和RADIUS服务器之间路由可达。
# 使能端口安全。
<Device> system-view
[Device] port-security enable
# 配置MAC认证的用户名和密码,使用带连字符“-”的MAC地址格式,其中字母大写。
[Device] mac-authentication user-name-format mac-address with-hyphen uppercase
# 配置MAC地址认证用户所使用的ISP域。
[Device] mac-authentication domain sun
# 配置802.1X的认证方式为CHAP。(该配置可选,缺省情况下802.1X的认证方式为CHAP)
[Device] dot1x authentication-method chap
# 设置端口安全允许的最大MAC地址数为64。
[Device] interface gigabitethernet 1/0/1
[Device-GigabitEthernet1/0/1] port-security max-mac-count 64
# 设置端口安全模式为macAddressElseUserLoginSecure。
[Device-GigabitEthernet1/0/1] port-security port-mode mac-else-userlogin-secure
# 指定端口上接入的802.1X用户使用强制认证域sun。
[Device-GigabitEthernet1/0/1] dot1x mandatory-domain sun
[Device-GigabitEthernet1/0/1] quit
# 设置端口Need To Know模式为ntkonly。
[Device-GigabitEthernet1/0/1] port-security ntk-mode ntkonly
[Device-GigabitEthernet1/0/1] quit
# 查看端口安全的配置信息。
[Device] display port-security interface gigabitethernet 1/0/1
Global port security parameters:
Port security : Enabled
AutoLearn aging time : 30 min
Disableport timeout : 30 s
Blockmac timeout : 180 s
MAC move : Denied
Authorization fail : Online
NAS-ID profile : Not configured
Dot1x-failure trap : Disabled
Dot1x-logon trap : Disabled
Dot1x-logoff trap : Disabled
Intrusion trap : Disabled
Address-learned trap : Disabled
Mac-auth-failure trap : Disabled
Mac-auth-logon trap : Disabled
Mac-auth-logoff trap : Disabled
Open authentication : Disabled
Traffic-statistics : Disabled
OUI value list
GigabitEthernet1/0/1 is link-up
Port mode : macAddressElseUserLoginSecure
NeedToKnow mode : NeedToKnowOnly
Intrusion protection mode : NoAction
Strict intrusion protection : Disabled
Security MAC address attribute
Learning mode : Sticky
Aging type : Periodical
Max secure MAC addresses : 64
Current secure MAC addresses : 0
Authorization : Permitted
NAS-ID profile : Not configured
Free VLANs : Not configured
Open authentication : Disabled
MAC-move VLAN check bypass : Disabled
配置完成后,如果有用户认证上线,则可以通过下述显示信息看到当前端口上的用户认证信息。
# 查看MAC地址认证信息。
[Device] display mac-authentication interface gigabitethernet 1/0/1
Global MAC authentication parameters:
MAC authentication : Enabled
Authentication method : PAP
User name format : MAC address in uppercase(XX-XX-XX-XX-XX-XX)
Username : mac
Password : Not configured
MAC range accounts : 0
MAC address Mask Username
Offline detect period : 300 s
Quiet period : 180 s
Server timeout : 100 s
Reauth period : 3600 s
User aging period for critical VLAN : 1000 s
User aging period for guest VLAN : 1000 s
Authentication domain : sun
HTTP proxy port list : Not configured
HTTPS proxy port list : Not configured
Max number of silent MACs : 1024 (per slot)
Online MAC-auth wired users : 3
Silent MAC users:
MAC address VLAN ID From port Port index
GigabitEthernet1/0/1 is link-up
MAC authentication : Enabled
Carry User-IP : Disabled
Authentication domain : Not configured
Auth-delay timer : Disabled
Periodic reauth : Disabled
Re-auth server-unreachable : Logoff
Guest VLAN : Not configured
Guest VLAN auth-period : 30 s
Critical VLAN : Not configured
Critical voice VLAN : Disabled
Host mode : Single VLAN
Offline detection : Enabled
Authentication order : Default
User aging : Enabled
Server-recovery online-user-sync : Enabled
URL user logoff : No
Auto-tag feature : Disabled
VLAN tag configuration ignoring : Disabled
Max online users : 4294967295
Authentication attempts : successful 3, failed 7
Current online users : 3
MAC address Auth state
1234-0300-0011 Authenticated
1234-0300-0012 Authenticated
1234-0300-0013 Authenticated
# 查看802.1X认证信息。
[Device] display dot1x interface gigabitethernet 1/0/1
Global 802.1X parameters:
802.1X authentication : Enabled
CHAP authentication : Enabled
Max-tx period : 30 s
Handshake period : 15 s
Offline detect period : 300 s
Quiet timer : Disabled
Quiet period : 60 s
Supp timeout : 30 s
Server timeout : 100 s
Reauth period : 3600 s
Max auth requests : 2
SmartOn switch ID : 30
SmartOn supp timeout : 30 s
SmartOn retry counts : 3
User aging period for Auth-Fail VLAN : 1000 s
User aging period for critical VLAN : 1000 s
User aging period for guest VLAN : 1000 s
EAD assistant function : Disabled
EAD timeout : 30 min
Domain delimiter : @
Online 802.1X wired users : 1
GigabitEthernet1/0/1 is link-up
802.1X authenticaiton : Enabled
Handshake : Enabled
Handshake reply : Disabled
Handshake security : Disabled
Unicast trigger : Disabled
Periodic reauth : Disabled
Port role : Authenticator
Authorization mode : Auto
Port access control : MAC-based
Multicast trigger : Enabled
Mandatory auth domain : sun
Guest VLAN : Not configured
Auth-Fail VLAN : Not configured
Critical VLAN : Not configured
Critical voice VLAN : Disabled
Add Guest VLAN delay : Disabled
Re-auth server-unreachable : Logoff
Max online users : 4294967295
User IP freezing : Disabled
Reauth period : 60 s
Send Packets Without Tag : Disabled
Max Attempts Fail Number : 0
User aging : Enabled
Server-recovery online-user-sync : Enabled
Auth-Fail EAPOL : Disabled
Critical EAPOL : Disabled
Discard duplicate EAPOL-Start : No
EAPOL packets: Tx 16331, Rx 102
Sent EAP Request/Identity packets : 16316
EAP Request/Challenge packets: 6
EAP Success packets: 4
EAP Failure packets: 5
Received EAPOL Start packets : 6
EAPOL LogOff packets: 2
EAP Response/Identity packets : 80
EAP Response/Challenge packets: 6
Error packets: 0
Online 802.1X users: 1
MAC address Auth state
0002-0000-0011 Authenticated
此外,因为设置了Need To Know特性,目的MAC地址未知、广播和多播报文都被丢弃。
(0)
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论