第24章 端口安全配置.docx
- 文档编号:24193961
- 上传时间:2023-05-25
- 格式:DOCX
- 页数:12
- 大小:19.07KB
第24章 端口安全配置.docx
《第24章 端口安全配置.docx》由会员分享,可在线阅读,更多相关《第24章 端口安全配置.docx(12页珍藏版)》请在冰豆网上搜索。
第24章端口安全配置
第24章端口安全配置
本章主要讲述了MP路由器交换端口的安全功能以及详细的配置信息。
章节主要内容:
●端口安全介绍
●端口安全配置
●监控与维护
24.1端口安全介绍
端口安全一般应用在接入层。
它能够对使用交换端口的主机进行限制,允许某些特定的主机访问网络,而其他主机均不能访问网络。
端口安全功能将用户的MAC地址、IP地址、VLANID以及PORT号四个元素灵活绑定,杜绝非法用户接入网络,从而保证网络数据的安全性,并保证合法用户能够得到足够的带宽。
用户可以通过三种规则来限制可以访问网络的主机,这三种规则分别是MAC规则,IP规则和MAX规则,MAC规则又分为三种绑定方式:
MAC绑定,MAC+IP绑定,MAC+VID绑定;IP规则可以针对某一IP也可以针对一系列IP;MAX规则用以限定端口可以“自由学习”到的(按顺序)最多MAC地址数目,这个地址数目不包括MAC规则和IP规则产生的合法MAC地址。
如果端口仅配置了拒绝规则,没有配置MAX规则,其他报文均不能转发(通过允许规则检查的例外)。
对于配置permit的MAC规则和IP规则系统将在端口LinkUp和端口安全使能时主动将配置写入二层转发表或发送ARP请求报文(详细见配置命令),这三种规则的配置如下:
(1)MAC规则
MAC绑定:
(config-port-xxx)#port-securitypermitmac-address0050.bac3.bebd
(config-port-xxx)#port-securitydenymac-address0050.bac3.bebd
MAC+VID绑定:
(config-port-xxx)#port-securitypermitmac-address0050.bac3.bebdvlan-id100
(config-port-xxx)#port-securitydenymac-address0050.bac3.bebdvlan-id100
MAC+IP绑定:
(config-port-xxx)#port-securitypermitmac-address0050.bac3.bebdip-address128.255.1.1
(config-port-xxx)#port-securitydenymac-address0050.bac3.bebdip-address128.255.1.1
(2)IP规则
(config-port-xxx)#port-securitypermitip-address128.255.1.1
(config-port-xxx)#port-securitydenyip-address128.255.1.1
(config-port-xxx)#port-securitypermitip-address128.255.1.1to128.255.1.63
(config-port-xxx)#port-securitydenyip-address128.255.1.1to128.255.1.63
(3)MAX规则
(config-port-xxx)#port-securitymaximum50
注:
如果一个MAC地址或IP地址是被deny掉的,即使这时未达到MAX的上限,该主机也不能通讯。
RM1800路由器仅RM1800-21-AC,RM1800-22-AC,RM1800-23-AC8三个型号产品不支持端口安全功能。
24.2端口安全配置
本节主要内容:
●端口安全配置命令基本描述
●端口安全启用与关闭
●配置MAC绑定
●配置MAC+VLAN绑定
●配置MAC+IP绑定
●配置IP规则
●配置MAX规则
●配置地址老化时间
●配置静态地址老化
●配置错误处理模式
24.2.1基本指令描述
命令
描述
配置模式
port-security{enable|disable}
端口启用/关闭端口安全
config-port-xxx,
config-port-range,
config-link-aggregation-x
port-securitypermit|denymac-address{mac-address}
配置端口MAC规则
config-port-xxx,
config-port-range,
config-link-aggregation-x
port-securitypermit|denymac-address{mac-address}vlan-id{vlanId}
配置端口MAC+VLAN规则
config-port-xxx,
config-port-range,
config-link-aggregation-x
port-securitypermit|denymac-address{mac-address}ip-address{ip-address}
配置端口MAC+IP规则
config-port-xxx,
config-port-range,
config-link-aggregation-x
port-securitypermint|denyip-address{ip-address}[to{ip-address}]
配置端口IP规则
config-port-xxx,
config-port-range,
config-link-aggregation-x
port-securitymaximum{0-4000}
配置端口MAX规则
config-port-xxx,
config-port-range,
config-link-aggregation-x
port-securityagingtime{0-1440}
配置端口MAC地址老化时间
config-port-xxx,
config-port-range,
config-link-aggregation-x
port-securityagingstatic
启用端口静态地址老化
config-port-xxx,
config-port-range,
config-link-aggregation-x
port-securityviolation{protect|restrict|shutdown}
配置错误处理模式
config-port-xxx,
config-port-range,
config-link-aggregation-x
⏹port-security
该命令在端口启用或者关闭端口安全功能。
port-security{enable|disable}
语法
描述
enable
启用端口安全
disable
关闭端口安全
【缺省情况】disable
⏹port-securitypermit|denymac-address
该命令配置端口的MAC绑定规则,相关的no命令删除该规则。
port-security{permit|denymac-addressmac-address}
noport-security{permit|denymac-addressmac-address}
语法
描述
permit
规则执行动作为允许
deny
规则执行动作为拒绝
mac-address
规则应用的mac地址
【缺省情况】无
注:
对于permit规则系统将其配置MAC地址和端口配置的默认VID一起写入二层转发表(MACAddress表)。
⏹port-securitypermit|denymac-addressmac-addressvlanId
该命令设置端口的MAC+VLAN绑定规则,相关的no命令删除该规则。
port-security{permit|denymac-addressmac-addressvlan-idvlanId}
noport-security{permit|denymac-addressmac-addressvlan-idvlanId}
语法
描述
permit
规则执行动作为允许
deny
规则执行动作为拒绝
mac-address
规则应用的mac地址
vlan-id
与mac地址绑定的vlan号
【缺省情况】无
注:
对于permit规则系统将其配置MAC地址和VID一起写入二层转发表(MACAddress表)。
⏹port-securitypermit|denymac-addressmac-addressip-address
该命令配置端口的MAC+IP绑定规则,相关的no命令删除该规则。
port-security{permit|denymac-addressmac-addressip-addressip-address}
noport-security{permit|denymac-addressmac-addressip-addressip-address}
语法
描述
permit
规则执行动作为允许
deny
规则执行动作为拒绝
mac-address
规则应用的mac地址
ip-address
与mac地址绑定的IP地址
【缺省情况】无
注:
对于permit规则系统将跟据配置的IP地址并在端口的默认VLAN域内从本端口发送ARP请求报文
⏹port-securitypermint|denyip-address
该命令配置端口的IP规则,相关的no命令删除该规则。
port-security{permint|denyip-addressstart-ip-address[toend-ip-address]}
noport-security{permint|denyip-addressstart-ip-address[toend-ip-address]}
语法
描述
permit
规则执行动作为允许
deny
规则执行动作为拒绝
start-ip-address
规则应用的起始IP地址
end-ip-address
规则应用的结束IP地址
【缺省情况】无
如果只增加某一个IP地址规则,可以不使用[toend-ip-address]部分
注:
对于permit规则和IP地址为单地址时系统将跟据配置的IP地址并在端口的默认VLAN域内从本端口发送ARP请求报文
⏹port-securitymaximum
该命令配置端口的MAX规则,相关的no命令删除该规则。
port-securitymaximum{0-4000}
noport-securitymaximum
语法
描述
0-4000
MAX规则的地址数
【缺省情况】0
⏹port-securityagingtime
该命令配置端口的地址老化时间(分钟),相关的no命令将该配置设置为1分钟。
port-securityagingtime{0-1440}
noport-securityagingtime
语法
描述
0-1440
老化时间,0表示不进行老化。
【缺省情况】1
注:
默认情况下只有通过MAX规则学习到的MAC地址才被老化,通过MAC和IP规则配置的MAC地址不会被老化。
⏹port-securityagingstatic
该命令启用端口的静态地址老化功能,相关的no命令取消静态地址老化功能。
port-securityagingstatic
noport-securityagingstatic
【缺省情况】未启用
注:
该命令只针对通过MAC和IP规则配置的MAC地址生效,对通过MAX规则学习到的地址只要配置的老化时间不为0就会进行老化。
⏹port-securityviolation
该命令配置端口收到非法报文(匹配deny规则或者超过MAX最大值)时的处理方式
port-securityviolation{protect|restrict|shutdown}
语法
描述
protect
丢弃非法报文
restrict
丢弃非法报文和trap告警
shutdown
丢弃非法报文和trap告警,并将端口shutdown
【缺省情况】protect模式
注:
当端口shutdown后可以通过两种方法恢复,1,将端口shutdown和noshutdown,2,设置端口错误恢复模式(详见端口管理)。
注:
收到非法报文时trap告警不会马上发生,将在两分钟内发出trap告警。
⏹noport-securityactive-address
该命令删除端口指定的MAC地址。
noport-securityactive-address{all|configured|learned}
语法
描述
all
删除所有MAC地址
configured
删除MAX规则外学习到的MAC地址
learned
删除MAX规则学习到的MAC地址
⏹noport-securityall
该命令将删除端口上所有的端口安全相关的配置。
noport-securityall
【缺省情况】无
24.3端口安全应用实例
交换端口port0/0/7接用户网络,要求MAC地址为0005.5de4.0e25的主机任意时刻都允许接入,MAC地址为001f.c627.3823的主机任意时刻不允许被接入,除此之外,该端口最多允许接入100台主机。
交换端口配置如下
命令
描述
router(config)#port0/0/7
进入端口
router(config-port-0/0/7)#port-securityenable
启用端口安全
router(config-port-0/0/7)#port-securitypermitmac-address0005.5de4.0e25
允许主机0005.5de4.0e25通信
router(config-port-0/0/7)#port-securitydenymac-address001f.c627.3823
拒绝主机001f.c627.3823通信
router(config-port-0/0/7)#port-securitymaximum100
允许100台主机接入
router(config-port-0/0/7)#exit
退出端口
24.4监控与维护
24.4.1监控命令
命令
描述
showport-securitymac-address[portId]
显示指定端口MAC规则对应登陆的主机信息。
showport-securityip-address[portId]
显示指定端口IP规则对应登陆的主机信息。
showport-securityactive-address[configured|learned|port|link-aggregation]
显示当前所有登陆的主机的信息。
24.4.2监控实例
环境和配置参见14.3
router#showport-securitymac-address
显示结果:
--------------------------------------------------------------------------------------
EntryPortActionMACaddressVIDIPAddrConfigType
--------------------------------------------------------------------------------------
1port0/0/7deny00:
1F:
C6:
27:
38:
23------MAC
2port0/0/7permit00:
05:
5D:
E4:
0E:
25------MAC
描述与分析:
EntryPort:
主机接入的端口
Action:
主机接入的动作(拒绝/允许)
MACaddress:
主机MAC地址
VID:
对应的VlanId
IPAddr:
主机的IP地址
ConfigType:
该MAC规则的类型
通过showport-securitymac-address命令可以看到该端口配置的两条MAC规则,允许MAC地址00:
05:
5D:
E4:
0E:
25接入,拒绝MAC地址00:
1F:
C6:
27:
38:
23接入。
router#showport-securityactive-address
显示结果:
------------------------------------------------------------------------------------
EntryPortMACaddressVIDIPAddrDerivationAge(Sec)
------------------------------------------------------------------------------------
1port0/0/700:
05:
5D:
E4:
0E:
251128.255.20.101MAC0
2port0/0/700:
01:
7A:
01:
98:
C81128.255.20.25FREE0
3port0/0/700:
01:
7A:
4C:
7D:
4B1128.255.95.254FREE0
描述与分析:
EntryPort:
主机接入的端口
MACaddress:
主机MAC地址
VID:
对应的VlanId
IPAddr:
主机的IP地址
Derivation:
主机条目的类型
Age(Sec):
主机老化计数器
通过showport-securityactive-address可以看到该端口当前接入了三台主机,其中00:
05:
5D:
E4:
0E:
25是通过MAC规则接入的,另外两台主机则是通过MAX规则接入的。
24.4.3调试命令
命令
描述
(no)debugport-security
打开(关闭)端口安全调试开关。
24.4.4调试命令实例
环境配置参加章节14.3
1、通过debugport-security查看规则的匹配信息。
(1)打开debugport-security命令
router#debugport-security
显示结果
分析
01:
02:
14:
%PS-DBG:
port[8]:
pktrecvmac[00:
05:
5d:
e4:
0e:
25],vlan[1],type[0806]
01:
02:
14:
%PS-DBG:
matchwithMAC_RULE.
01:
02:
14:
%PS-DBG:
action:
PERMIT.
01:
02:
14:
%PS-DBG:
addingaARLentry:
mac[00:
05:
5d:
e4:
0e:
25],port[8],vlan[1],ip[128.255.42.111].
01:
02:
14:
%PS-DBG:
fdbentryaddsuccessfully.mac[00:
05:
5d:
e4:
0e:
25],port[8],vlan[1]
01:
02:
14:
%PS-DBG:
entrymac[00:
05:
5d:
e4:
0e:
25],vlan[1],port[8]wasaddedsuccessfully.
端口接收到用户[00:
05:
5d:
e4:
0e:
25]的ARP报文[0806],该报文匹配一条MAC_RULE规则,执行动作为PERMIT,为该用户授权允许访问网络资源
01:
06:
15:
%PS-DBG:
port[8]:
pktrecvmac[00:
1f:
c6:
27:
38:
23],vlan[1],type[0806]
01:
06:
15:
%PS-DBG:
matchwithMAC_RULE.
01:
06:
15:
%PS-DBG:
actionDENY.
01:
06:
15:
%PS-DBG:
deletingARLentry:
mac[00:
1f:
c6:
27:
38:
23],port[8],vlan[1].
端口接收到用户[00:
1f:
c6:
27:
38:
23]的ARP报文[0806],该报文匹配一条MAC_RULE规则,执行动作为DENY,禁止该用户访问网络资源。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 第24章 端口安全配置 24 端口 安全 配置