端口安全典型配置指导
目录
第1章端口安全典型配置指导...
1.1 端口安全autolearn模式典型配置指导..
1.1.1 组网图..
1.1.2 应用要求..
1.1.3 适用产品、版本..
1.1.4 配置过程和解释..
1.1.5 完整配置..
1.1.6 配置注意事项..
1.2 端口安全userLoginWithOUI模式典型配置指导..
1.2.1 组网图..
1.2.2 组网需求..
1.2.3 适用产品、版本..
1.2.4 配置过程和解释..
1.2.5 完整配置..
1.2.6 配置注意事项..
1.3 端口安全macAddressWithRadius模式典型配置指导..
1.3.1 组网图..
1.3.2 组网需求..
1.3.3 适用产品、版本..
1.3.4 配置过程和解释..
1.3.5 完整配置..
1.3.6 配置注意事项..
1.4 端口安全macAddressElseUserLoginSecure模式典型配置指导..
1.4.1 组网图..
1.4.2 组网需求..
1.4.3 适用产品、版本..
1.4.4 配置过程和解释..
1.4.5 完整配置..
1.4.6 配置注意事项..
第1章端口安全典型配置指导
1.1 端口安全autolearn模式典型配置指导
在端口安全autolearn模式下,端口学习到的MAC地址被保存在安全MAC地址表
项中。当端口下的安全MAC地址数超过端口允许学习的最大安全MAC地址数后,
端口模式会自动转变为secure模式。之后,该端口不会再添加新的安全MAC,只
有源MAC地址为安全MAC地址、已配置的静态MAC地址的报文,才能通过该端
口。
1.1.1 组网图
Internet
Switch
Host
GE1/0/1
图1-1 端口安全autolearn模式配置组网图
1.1.2 应用要求
在交换机的端口GigabitEthernet1/0/1上对接入用户做如下的:
●允许个用户自由接入,不进行认证,将学习到的用户MAC地址添加
为安全MAC地址;
●当安全MAC地址数量达到后,停止学习;当再有新的MAC地址接
入时,触发入侵检测,并将此端口关闭30秒;
1.1.3 适用产品、版本
表1-1 配置适用的产品与软硬件版本关系
产品软件版本硬件版本
S5500-SI系列以太网交换机Release 1207软件版本
全系列硬件版本
(除S5500-20TP-SI)Release 1301软件版本S5500-20TP-SI
S5500-EI系列以太网交换机Release 2102软件版本全系列硬件版本
1.1.4 配置过程和解释
# 使能端口安全功能。
system-view
[Switch] port-security enable
# 打开入侵检测Trap开关。
[Switch] port-security trap intrusion
# 设置端口允许的最大安全MAC地址数为。
[Switch] interface GigabitEthernet 1/0/1
[Switch-GigabitEthernet1/0/1] port-security max-mac-count
# 设置端口安全模式为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
(1)验证配置结果
上述配置完成后,可以用display命令显示端口安全配置情况,如下:
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
Stored MAC address number is 0
Authorization is permitted
可以看到端口的最大安全MAC数为,端口模式为autoLearn,入侵检测Trap开
关打开,入侵保护动作为DisablePortTemporarily,入侵发生后端口禁用时间为30
秒。
配置完成后,允许地址学习,学习到的MAC地址数可以用上述命令显示,如学习
到5个,那么存储的安全MAC地址数就为5,可以在端口视图下用display this命
令查看学习到的MAC地址,如:
system-view
[Switch] interface gigabitethernet 1/0/1
[Switch-GigabitEthernet1/0/1] display this
#
interface GigabitEthernet1/0/1
port-security max-mac-count
port-security port-mode autolearn
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地址数达到后,用命令display port-security interface可以看
到端口模式变为secure,再有新的MAC地址到达将触发入侵保护,Trap信息如下:
#May 2 03:15:55:871 2000 Switch
PORTSEC/1/VIOLATION:Traph3cSecureViolation
A intrusion occurs!
IfIndex: 9437207
Port: 9437207
MAC Addr: 0.2.0.0.0.21
VLAN ID: 1
IfAdminStatus: 1
并且可以通过下述命令看到端口安全将此端口关闭:
display interface gigabitethernet 1/0/1
GigabitEthernet1/0/1 current state: 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地址。
1.1.5 完整配置
#
port-security enable
port-security trap intrusion
port-security timer disableport 30 # interface GigabitEthernet1/0/1 port-security max-mac-count port-security port-mode autolearn port-security intrusion-mode disableport-temporarily
#
1.1.6 配置注意事项
● 在使能端口安全功能之前,需要关闭全局的802.1x 和MAC 地址认证功
能。
●
端口安全模式的配置与端口加入聚合组互斥。 ● 当多个用户通过认证时,端口下所允许的最大用户数根据不同的端口安
全模式,取最大安全MAC 地址数与相应模式下允许认证用户数的最小值。 ● 端口上有用户在线的情况下,端口安全功能无法关闭。
1.2 端口安全userLoginWithOUI 模式典型配置指导
在端口安全userLoginWithOUI 模式下,端口必须通过802.1x 认证才能开启,且只允许认证成功的用户报文通过。除此之外,端口还允许一个指定OUI 的源MAC 地址的报文认证通过。
1.2.1 组网图 Internet
Switch Host GE1/0/1
Authentication servers
(192.168.1.1/24
192.168.1.2/24)
图1-2 端口安全userLoginWithOUI 模式组网图
1.2.2 组网需求
客户端通过端口GigabitEthernet1/0/1连接到交换机上,交换机通过RADIUS 服务器对客户端进行身份认证,如果认证成功,客户端被授权允许访问Internet 资源。 交换机的管理者希望对接入用户的端口GigabitEthernet1/0/1做如下: ● 允许一个802.1x 用户上线;
●最多可以配置16个OUI值,还允许端口上有一个与OUI值匹配的MAC
地址用户通过。
1.2.3 适用产品、版本
表1-2 配置适用的产品与软硬件版本关系
产品软件版本硬件版本
S5500-SI系列以太网交换机Release 1207软件版本
全系列硬件版本
(除S5500-20TP-SI)Release 1301软件版本S5500-20TP-SI
S5500-EI系列以太网交换机Release 2102软件版本全系列硬件版本
1.2.4 配置过程和解释
说明:
●下述配置步骤包含了部分AAA/RADIUS协议配置命令,具体介绍请参见
“AAA–RADIUS-HWTACACS配置”。
●接入用户和RADIUS服务器上的配置略。
(1)具体的配置步骤
●配置RADIUS协议
# 创建名为radsun的RADIUS方案。
system-view
[Switch] radius scheme radsun
# 设置主认证RADIUS服务器的IP地址为192.168.1.1,主计费RADIUS服务器的
IP地址为192.168.1.2。
[Switch-radius-radsun] primary authentication 192.168.1.1
[Switch-radius-radsun] primary accounting 192.168.1.2
# 设置从认证RADIUS服务器的IP地址为192.168.1.2,从计费RADIUS服务器的
IP地址为192.168.1.1。
[Switch-radius-radsun] secondary authentication 192.168.1.2
[Switch-radius-radsun] secondary accounting 192.168.1.1
# 设置与认证RADIUS服务器交互报文时的加密密码为name。
[Switch-radius-radsun] key authentication name
# 设置与计费RADIUS服务器交互报文时的加密密码为money。
[Switch-radius-radsun] key accounting money
# 设置RADIUS服务器应答超时时间为5秒,RADIUS报文的超时重传次数的最大值为5。
[Switch-radius-radsun] timer response-timeout 5
[Switch-radius-radsun] retry 5
# 设置向RADIUS服务器发送实时计费报文的时间间隔为15分钟。
[Switch-radius-radsun] timer realtime-accounting 15
# 设置将去除域名的用户名发送给RADIUS服务器。
[Switch-radius-radsun] user-name-format without-domain
[Switch-radius-radsun] quit
# 创建名为sun的ISP域,并进入其视图。
[Switch] domain sun
# 指定名为radsun的RADIUS方案为该域用户的缺省RADIUS方案。
[Switch-isp-sun] authentication default radius-scheme radsun
# 设置该ISP域最多可容纳30个用户。
[Switch-isp-sun] access-limit enable 30
[Switch-isp-sun] quit
配置端口安全特性
# 使能端口安全功能。
[Switch] port-security enable
# 添加5个OUI值。
[Switch] port-security oui 1234-0100-1111 index 1
[Switch] port-security oui 1234-0200-1111 index 2
[Switch] port-security oui 1234-0300-1111 index 3
[Switch] port-security oui 1234-0400-1111 index 4
[Switch] port-security oui 1234-0500-1111 index 5
[Switch] interface GigabitEthernet 1/0/1
# 设置端口安全模式为userLoginWithOUI。
[Switch-GigabitEthernet1/0/1] port-security port-mode userlogin-withoui (2)验证配置结果
查看名为radsun的RADIUS方案的配置信息:
display radius scheme radsun
SchemeName = radsun
Index = 0 Type = standard
Primary Auth IP = 192.168.1.1 Port = 1812 State = active
Primary Acct IP = 192.168.1.2 Port = 1813 State = active
Second Auth IP = 192.168.1.2 Port = 1812 State = active
Second Acct IP = 192.168.1.1 Port = 1813 State = active
Auth Server Encryption Key = name
Acct Server Encryption Key = money
Accounting-On packet disable, send times = 5 , interval = 3s
Interval for timeout(second) = 5
Retransmission times for timeout = 5
Interval for realtime accounting(minute) = 15
Retransmission times of realtime-accounting packet = 5
Retransmission times of stop-accounting packet = 500
Quiet-interval(min) = 5
Username format = without-domain Data flow unit = Byte
Packet unit = one
查看名为sun的ISP域的配置信息:
display domain sun
Domain = sun
State = Active
Access-limit = 30
Accounting method = Required
Default authentication scheme : radius=radsun
Default authorization scheme : local
Default accounting scheme : local
Domain User Template:
Idle-cut = Disable
Self-service = Disable
查看端口安全的配置信息:
display port-security interface gigabitethernet 1/0/1
Equipment port-security is enabled
Trap is disabled
Disableport Timeout: 20s
OUI value:
Index is 1, OUI value is 123401
Index is 2, OUI value is 123402
Index is 3, OUI value is 123403
Index is 4, OUI value is 123404
Index is 5, OUI value is 123405
GigabitEthernet1/0/1 is link-up
Port mode is userLoginWithOUI
NeedToKnow mode is disabled
Intrusion Protection mode is NoAction
Max MAC address number is not configured
Stored MAC address number is 0
Authorization is permitted
配置完成后,如果有802.1x用户上线,则可以看到存储的安全MAC地址数为1。还可以通过下述命令查看802.1x用户的情况:
display dot1x interface gigabitethernet 1/0/1
Equipment 802.1X protocol is enabled
CHAP authentication is enabled
Configuration: Transmit Period 30 s, Handshake Period 15 s
Quiet Period 60 s, Quiet Period Timer is disabled
Supp Timeout 30 s, Server Timeout 100 s
The maximal retransmitting times 2
Total maximum 802.1X user resource number is 1024 per slot
Total current used 802.1X resource number is 1
GigabitEthernet1/0/1 is link-up
802.1X protocol is enabled
Handshake is enabled
The port is an authenticator
Authentication Mode is Auto
Port Control Type is Mac-based
Guest VLAN: 0
Max number of on-line users is 256
EAPOL Packet: Tx 16331, Rx 102
Sent EAP Request/Identity Packets : 16316
EAP Request/Challenge Packets: 6
EAP Success Packets: 4, Fail Packets: 5
Received EAPOL Start Packets : 6
EAPOL LogOff Packets: 2
EAP Response/Identity Packets : 80
EAP Response/Challenge Packets: 6
Error Packets: 0
1. Authenticated user : MAC address: 0002-0000-0011
Controlled User(s) amount to 1
此外,端口还允许一个与OUI值匹配的MAC地址的用户通过,可以通过下述命令查看:
display mac-address interface gigabitethernet 1/0/1
MAC ADDR VLAN ID STATE PORT INDEX AGING TIME(s)
1234-0300-0011 1 Learned GigabitEthernet1/0/1 AGING
--- 1 mac address(es) found ---
1.2.5 完整配置
#
port-security enable
port-security oui 1234-0100-0000 index 1
port-security oui 1234-0200-0000 index 2
port-security oui 1234-0300-0000 index 3
port-security oui 1234-0400-0000 index 4
port-security oui 1234-0500-0000 index 5
#
radius scheme radsun
primary authentication 192.168.1.1
primary accounting 192.168.1.2
secondary authentication 192.168.1.2
secondary accounting 192.168.1.1
key authentication name
key accounting money
timer realtime-accounting 15
timer response-timeout 5
user-name-format without-domain
retry 5
#
domain sun
authentication default radius-scheme radsun
access-limit enable 30
#
interface GigabitEthernet1/0/1
port-security port-mode userlogin-withoui
#
1.2.6 配置注意事项
●在使能端口安全功能之前,需要关闭全局的802.1x和MAC地址认证功
能。
●端口安全模式的配置与端口加入聚合组互斥。
因篇幅问题不能全部显示,请点此查看更多更全内容