• 产品与解决方案
  • 行业解决方案
  • 服务
  • 支持
  • 合作伙伴
  • 新华三人才研学中心
  • 关于我们

H3C S5500-EI系列以太网交换机 操作手册-Release 2102(V1.01)

35-端口安全操作

本章节下载  (252.62 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S5500/S5500-EI/Configure/Operation_Manual/S5500-EI_OM(V1.01)/200712/325628_30005_0.htm

35-端口安全操作

  录

第1章 端口安全配置

1.1 端口安全简介

1.1.1 概述

1.1.2 端口安全的特性

1.1.3 端口安全模式

1.2 端口安全配置任务简介

1.3 使能端口安全功能

1.3.1 配置准备

1.3.2 使能端口安全功能

1.4 配置端口允许的最大安全MAC地址数

1.5 配置端口安全模式

1.5.1 配置autoLearn模式

1.5.2 配置userLoginWithOUI模式

1.5.3 配置其它模式

1.6 配置端口安全的特性

1.6.1 配置NeedToKnow特性

1.6.2 配置入侵检测特性

1.6.3 配置Trap特性

1.7 配置安全MAC地址

1.7.1 配置准备

1.7.2 配置安全MAC地址

1.8 配置当前端口不应用服务器下发的授权信息

1.9 端口安全显示和维护

1.10 端口安全典型配置举例

1.10.1 端口安全autoLearn模式配置举例

1.10.2 端口安全userLoginWithOUI模式配置举例

1.10.3 端口安全macAddressElseUserLoginSecure模式配置举例

1.11 常见配置错误举例

1.11.1 端口安全模式无法设置

1.11.2 无法配置端口安全MAC地址

1.11.3 用户在线情况下无法更换端口安全模式

 


第1章  端口安全配置

1.1  端口安全简介

1.1.1  概述

端口安全是一种基于MAC地址对网络接入进行控制的安全机制,是对已有的802.1x认证和MAC地址认证的扩充。这种机制通过检测数据帧中的源MAC地址来控制非授权设备对网络的访问,通过检测数据帧中的目的MAC地址来控制对非授权设备的访问。

端口安全的主要功能是通过定义各种端口安全模式,让设备学习到合法的源MAC地址,以达到相应的网络管理效果。启动了端口安全功能之后,当发现非法报文时,系统将触发相应特性,并按照预先指定的方式进行处理,既方便用户的管理又提高了系统的安全性。

非法报文包括:

l              禁止MAC地址学习时,收到的源MAC地址为未知MAC的报文;

l              端口学习到的MAC地址达到端口所允许的最大MAC地址数后,收到的源MAC地址为未知MAC的报文;

l              未通过认证的用户发送的报文。

1.1.2  端口安全的特性

1. NeedToKnow特性

NeedToKnow特性通过检测从端口发出的数据帧的目的MAC地址,保证数据帧只能被发送到已经通过认证的设备上,从而防止非法设备窃听网络数据。

2. 入侵检测(IntrusionProtection)特性

入侵检测特性指通过检测从端口收到的数据帧的源MAC地址,对接收非法报文的端口采取相应的安全策略,包括端口被暂时断开连接、永久断开连接或MAC地址被过滤(默认3分钟,不可配),以保证端口的安全性。

3. Trap特性

Trap特性是指当端口有特定的数据包(由非法入侵,用户上下线等原因引起)传送时,设备将会发送Trap信息,便于网络管理员对这些特殊的行为进行监控。

1.1.3  端口安全模式

对于端口安全模式的具体描述,请参见表1-1

表1-1 端口安全模式描述表

安全模式类型

描述

特性说明

noRestrictions

表示端口的安全功能关闭,端口处于无限制状态

此时NeedToKnow特性和入侵检测特性无效

autoLearn

此模式下,端口学习到的MAC地址被保存在安全MAC地址表项中;

当端口下的安全MAC地址数超过端口允许学习的最大安全MAC地址数后,端口模式会自动转变为secure模式。之后,该端口不会再添加新的安全MAC,只有源MAC地址为安全MAC地址、已配置的静态MAC地址的报文,才能通过该端口

在这两种模式下,当设备发现非法报文后,将触发NeedToKnow特性和入侵检测特性

secure

禁止端口学习MAC地址,只有源MAC地址为端口上的安全MAC地址、已配置的静态MAC地址的报文,才能通过该端口

userLogin

对接入用户采用基于端口的802.1x认证

此模式下NeedToKnow特性和入侵检测特性不会被触发

userLoginSecure

端口必须通过802.1x认证才能开启,且只允许认证成功的用户报文通过;

此模式下,端口最多只允许一个802.1x认证用户接入

在左侧列出的模式下,当设备发现非法报文后,将触发NeedToKnow特性和入侵检测特性

userLoginWithOUI

与userLoginSecure模式类似,端口最多只允许一个802.1x认证用户接入;

除此之外,端口还允许一个指定OUI的源MAC地址的报文认证通过

macAddressWithRadius

对接入用户采用MAC地址认证

macAddressOrUserLoginSecure

端口同时处于userLoginSecure模式和macAddressWithRadius模式,但802.1x认证优先级大于MAC地址认证;

对于非802.1x报文直接进行MAC地址认证。对于802.1x报文先进行802.1x认证,如果802.1x认证失败再进行MAC地址认证

macAddressElseUserLoginSecure

端口同时处于macAddressWithRadius模式和userLoginSecure模式,但MAC地址认证优先级大于802.1x认证;

对于非802.1x报文直接进行MAC地址认证。对于802.1x报文先进行MAC地址认证,如果MAC地址认证失败再进行802.1x认证

userLoginSecureExt

对接入用户采用基于MAC的802.1x认证,且允许端口下有多个802.1x用户

macAddressOrUserLoginSecureExt

与macAddressOrUserLoginSecure类似,但允许端口下有多个802.1x和MAC地址认证用户

macAddressElseUserLoginSecureExt

与macAddressElseUserLoginSecure类似,但允许端口下有多个802.1x和MAC地址认证用户

 

&  说明:

l      目前端口安全特性对用户的认证主要有两种方式:MAC地址认证和802.1x认证,不同的安全模式对应不同的认证方式或认证方式组合。

l      当多个用户通过认证时,端口下所允许的最大用户数根据不同的端口安全模式,取最大安全MAC地址数与相应模式下允许认证用户数的最小值。例如,userLoginSecureExt模式下,端口下所允许的最大用户为配置的最大安全MAC地址数与802.1x认证所允许的最大用户数的最小值。

 

1.2  端口安全配置任务简介

表1-2 端口安全配置任务简介

配置任务

说明

详细配置

使能端口安全功能

必选

1.3 

配置端口允许的最大安全MAC地址数

可选

1.4 

配置端口安全模式

必选

1.5 

配置端口安全的特性

配置NeedToKnow特性

可选

根据实际组网需求选择其中一种或多种特性

1.6 

配置入侵检测特性

配置Trap特性

配置安全MAC地址

可选

1.7 

配置当前端口不应用服务器下发的授权信息

可选

1.8 

 

1.3  使能端口安全功能

1.3.1  配置准备

在使能端口安全功能之前,需要关闭全局的802.1x和MAC地址认证功能。

1.3.2  使能端口安全功能

表1-3 使能端口安全功能

操作

命令

说明

进入系统视图

system-view

-

使能端口安全功能

port-security enable

必选

缺省情况下,端口安全功能处于关闭状态

 

  注意:

端口安全功能使能后,端口的如下配置会被自动恢复为(括弧内的)缺省情况:

l      802.1x认证(关闭)、端口接入控制方式(macbased、端口接入控制模式(auto);

l      MAC地址认证(关闭)。

且以上配置不能再进行手动配置,只能随端口安全模式的改变由系统配置。

端口安全功能关闭时,端口的如下配置会被自动恢复为(括弧内的)缺省情况:

l      端口安全模式(noRestrictions);

l      802.1x认证(关闭)、端口接入控制方式(macbased、端口接入控制模式(auto);

l      MAC地址认证(关闭)。

端口上有用户在线的情况下,端口安全功能无法关闭。

 

&  说明:

有关802.1x认证和MAC地址认证配置的详细介绍可参见“802.1x-HABP-MAC地址认证”。

 

1.4  配置端口允许的最大安全MAC地址数

端口安全允许某个端口下有多个用户通过认证,但是允许的用户数不能超过规定的最大值。

配置端口允许的最大安全MAC地址数有两个作用:

l              控制能够通过某端口接入网络的最大用户数;

l              控制端口安全能够添加的安全MAC地址数。

该配置与MAC地址管理中配置的端口最多可以学习到的MAC地址数无关。

表1-4 配置端口允许的最大安全MAC地址数

操作

命令

说明

进入系统视图

system-view

-

进入端口视图

interface interface-type interface-number

-

配置端口允许的最大安全MAC地址数

port-security max-mac-count count-value

必选

缺省情况下,最大安全MAC地址数不受限制

 

1.5  配置端口安全模式

在配置端口安全模式之前,端口上需要满足以下条件:

l              802.1x认证关闭、端口接入控制方式为macbased、端口接入控制模式为auto

l              MAC地址认证关闭。

否则,系统提示错误信息,无法进行配置。反之,若端口上配置了端口安全模式,以上配置也不允许改变。

&  说明:

l      在端口安全功能未使能的情况下,端口安全模式可以进行配置但不会生效。

l      当端口安全已经使能且当前端口安全模式不是noRestrictions时,若要改变端口安全模式,必须首先执行undo port-security port-mode命令恢复端口安全模式为noRestrictions模式。

l      端口上有用户在线的情况下,端口安全模式无法改变。

l      端口安全模式的配置与端口加入聚合组互斥。

 

1.5.1  配置autoLearn模式

1. 配置准备

在配置端口安全autoLearn模式之前,需要设置端口允许的最大安全MAC地址数。

2. 配置autoLearn模式

表1-5 配置autoLearn模式

操作

命令

说明

进入系统视图

system-view

-

进入端口视图

interface interface-type interface-number

-

配置autoLearn模式

port-security port-mode autolearn

必选

缺省情况下,端口处于noRestrictions模式

 

&  说明:

当端口工作于autoLearn模式时,无法更改端口允许的最大安全MAC地址数。

 

1.5.2  配置userLoginWithOUI模式

在端口安全模式为userLoginWithOUI时,端口除了可以允许一个802.1x的接入用户通过认证之外,还可以允许一个指定OUI值的源MAC地址的用户通过认证。

表1-6 配置userLoginWithOUI模式

操作

命令

说明

进入系统视图

system-view

-

配置允许通过认证的用户OUI值

port-security oui oui-value index index-value

可选

缺省情况下,没有配置允许通过认证的用户OUI值

进入端口视图

interface interface-type interface-number

-

配置userLoginWithOUI模式

port-security port-mode userlogin-withoui

必选

缺省情况下,端口处于noRestrictions模式

 

&  说明:

l      OUI(Organizationally Unique Identifier)是MAC地址的前24位(二进制),是IEEE(Institute of Electrical and Electronics Engineers,电气和电子工程师学会)为不同设备供应商分配的一个全球唯一的标识符。

l      允许通过认证的用户OUI值可以配置多条。

 

1.5.3  配置其它模式

表1-7 配置其它安全模式

操作

命令

说明

进入系统视图

system-view

-

进入端口视图

interface interface-type interface-number

-

配置端口的安全模式

port-security port-mode { mac-authentication | mac-else-userlogin-secure | mac-else-userlogin-secure-ext | secure | userlogin | userlogin-secure | userlogin-secure-ext | userlogin-secure-or-mac | userlogin-secure-or-mac-ext }

必选

缺省情况下,端口处于noRestrictions模式

 

&  说明:

macAddressElseUserLoginSecure或macAddressElseUserLoginSecureExt安全模式下工作的端口,对于同一个报文,只有MAC地址认证和802.1x认证均失败后,才会触发入侵检测特性。

 

1.6  配置端口安全的特性

1.6.1  配置NeedToKnow特性

表1-8 配置NeedToKnow特性

操作

命令

说明

进入系统视图

system-view

-

进入端口视图

interface interface-type interface-number

-

配置端口NeedToKnow特性

port-security ntk-mode { ntk-withbroadcasts | ntk-withmulticasts | ntkonly }

必选

缺省情况下,端口没有配置NeedToKnow特性,即所有报文都可成功发送

 

1.6.2  配置入侵检测特性

表1-9 配置入侵检测特性

操作

命令

说明

进入系统视图

system-view

-

进入端口视图

interface interface-type interface-number

-

配置入侵检测特性

port-security intrusion-mode { blockmac | disableport | disableport-temporarily }

必选

缺省情况下,不进行入侵检测处理

退回系统视图

quit

-

配置系统暂时关闭端口连接的时间

port-security timer disableport time-value

可选

缺省情况下,系统暂时关闭端口连接的时间为20秒

 

&  说明:

port-security timer disableport命令设置的时间值,是port-security intrusion-mode命令设置为disableport-temporarily模式时,系统暂时关闭端口连接的时间。

 

1.6.3  配置Trap特性

表1-10 配置Trap特性

操作

命令

说明

进入系统视图

system-view

-

打开指定告警功能

port-security trap { addresslearned | dot1xlogfailure | dot1xlogoff | dot1xlogon | intrusion | ralmlogfailure | ralmlogoff | ralmlogon }

必选

缺省情况下,所有告警功能处于关闭状态

 

1.7  配置安全MAC地址

安全MAC地址是一种特殊的MAC地址,不会被老化,保存后重启设备,不会丢失。在同一个VLAN内,一个安全MAC地址只能被添加到一个端口上,利用该特点,可以实现同一VLAN内MAC地址与端口的绑定。

安全MAC地址可以由使能端口安全功能的端口自动学习,也可以通过命令行或者MIB手动配置。

1.7.1  配置准备

在配置安全MAC地址之前,需要完成以下任务:

l              使能端口安全功能

l              设置端口允许的最大安全MAC地址数

l              配置端口安全模式为autoLearn

1.7.2  配置安全MAC地址

表1-11 配置安全MAC地址

操作

命令

说明

进入系统视图

system-view

-

配置安全MAC地址

在系统视图下

port-security mac-address security mac-address interface interface-type interface-number vlan vlan-id

二者必选其一

缺省情况下,未配置安全MAC地址

在端口视图下

interface interface-type interface-number

port-security mac-address security mac-address vlan vlan-id

 

&  说明:

配置的安全MAC地址会被写入配置文件,端口up或down时不会丢失。保存配置文件后,即使设备重启,安全MAC地址也不会被删除。

 

1.8  配置当前端口不应用服务器下发的授权信息

802.1x用户或MAC地址认证用户在RADIUS服务器上通过认证时,服务器会把授权信息下发给设备端。通过此配置可实现基于端口是否忽略RADIUS服务器下发的授权信息。

表1-12 配置当前端口不应用服务器下发的授权信息

操作

命令

说明

进入系统视图

system-view

-

进入端口视图

interface interface-type interface-number

-

配置当前端口不应用RADIUS服务器下发的授权信息

port-security authorization ignore

必选

缺省情况下,端口应用RADIUS服务器下发的授权信息

 

1.9  端口安全显示和维护

在完成上述配置后,在任意视图下执行display命令可以显示配置后端口安全的运行情况,通过查看显示信息验证配置的效果。

表1-13 端口安全显示和维护

操作

命令

显示端口安全的配置信息、运行情况和统计信息

display port-security [ interface interface-list ]

显示安全MAC地址信息

display port-security mac-address security [ interface interface-type interface-number ] [ vlan vlan-id ] [ count ]

显示阻塞MAC地址信息

display port-security mac-address block [ interface interface-type interface-number ] [ vlan vlan-id ] [ count ]

 

1.10  端口安全典型配置举例

1.10.1  端口安全autoLearn模式配置举例

1. 组网需求

在交换机的端口GigabitEthernet1/0/1上对接入用户做如下的限制:

l              允许64个用户自由接入,不进行认证,将学习到的用户MAC地址添加为安全MAC地址;

l              当安全MAC地址数量达到64后,停止学习;当再有新的MAC地址接入时,触发入侵检测,并将此端口关闭30秒;

2. 组网图

图1-1 端口安全autoLearn模式组网图

3. 配置步骤

(1)        具体的配置步骤

<Switch> system-view

# 使能端口安全功能。

[Switch] port-security enable

# 打开入侵检测Trap开关。

[Switch] port-security trap intrusion

[Switch] interface GigabitEthernet 1/0/1

# 设置端口允许的最大安全MAC地址数为64。

[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-security max-mac-count 64

 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地址数达到64后,用命令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

并且可以通过下述命令看到端口安全将此端口关闭:

[Switch-GigabitEthernet1/0/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.10.2  端口安全userLoginWithOUI模式配置举例

1. 组网需求

客户端通过端口GigabitEthernet1/0/1连接到交换机上,交换机通过RADIUS服务器对客户端进行身份认证,如果认证成功,客户端被授权允许访问Internet资源。

交换机的管理者希望对接入用户的端口GigabitEthernet1/0/1做如下限制:

l              允许一个802.1x用户上线;

l              最多可以配置16个OUI值,还允许端口上有一个与OUI值匹配的MAC地址用户通过。

2. 组网图

图1-2 端口安全userLoginWithOUI模式组网图

3. 配置步骤

&  说明:

l      下述配置步骤包含了部分AAA/RADIUS协议配置命令,具体介绍请参见“AAA–RADIUS-HWTACACS配置”。

l      接入用户和RADIUS服务器上的配置略。

 

(1)        具体的配置步骤

l              配置RADIUS协议

<Switch> system-view

# 创建名为radsun的RADIUS方案。

[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

l              配置端口安全特性

# 使能端口安全功能。

[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方案的配置信息:

<Switch> 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域的配置信息:

<Switch> 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

查看端口安全的配置信息:

<Switch> 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用户的情况:

<Switch> 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

 EAD quick deploy configuration:

                EAD timeout:   30 m

 

 The 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

   802.1X Multicast-trigger is enabled

   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地址的用户通过,可以通过下述命令查看:

<Switch> 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.10.3  端口安全macAddressElseUserLoginSecure模式配置举例

1. 组网需求

客户端通过端口GigabitEthernet1/0/1连接到交换机上,交换机通过RADIUS服务器对客户端进行身份认证。如果认证成功,客户端被授权允许访问Internet资源。

交换机的管理者希望对接入用户的端口GigabitEthernet1/0/1做如下的限制:

l              可以有多个MAC认证用户上线;

l              如果是802.1x用户请求认证,先进行MAC地址认证,MAC地址认证失败,再进行802.1x认证。802.1x用户限制为1个;

l              MAC地址认证设置用户名格式为自定义用户名和密码的形式,上线的MAC地址认证用户和802.1x认证用户总和不能超过64个;

l              为防止报文发往未知目的MAC地址,启动NeedToKnow特性。

2. 组网图

图1-2所示。

3. 配置步骤

&  说明:

l      RADIUS认证/计费配置同1.10.2  ,这里不再赘述。

l      接入用户和RADIUS服务器上的配置略。

 

(1)        具体的配置步骤

<Switch> system-view

# 使能端口安全功能。

[Switch] port-security enable

# 配置MAC认证的用户名为aaa,密码为123456。

[Switch] mac-authentication user-name-format fixed account aaa password simple 123456

[Switch] interface gigabitethernet 1/0/1

# 设置端口允许的最大安全MAC地址数为64。

[Switch-GigabitEthernet1/0/1] port-security max-mac-count 64

# 设置端口安全模式为macAddressElseUserLoginSecure。

[Switch-GigabitEthernet1/0/1] port-security port-mode mac-else-userlogin-secure

# 设置端口NeedToKnow模式为ntkonly。

[Switch-GigabitEthernet1/0/1] port-security ntk-mode ntkonly

(2)        验证配置结果

查看端口安全的配置信息:

<Switch> display port-security interface gigabitethernet 1/0/1

 Equipment port-security is enabled

 Trap is disabled

 Disableport Timeout: 20s

 OUI value:

 

 GigabitEthernet1/0/1 is link-up

   Port mode is macAddressElseUserLoginSecure

   NeedToKnow mode is NeedToKnowOnly

   Intrusion Protection mode is NoAction

   Max MAC address number is 64

   Stored MAC address number is 0

   Authorization is permitted

 

查看MAC地址认证情况:

<Switch> display mac-authentication interface gigabitethernet 1/0/1

MAC address authentication is enabled.

 User name format is fixed account

 Fixed username:aaa

 Fixed password:123456

          Offline detect period is 300s

          Quiet period is 60s

          Server response timeout value is 100s

          The max allowed user number is 1024 per slot

          Current user number amounts to 0

          Current domain: not configured, use default domain

 

Silent MAC User info:

          MAC Addr         From Port                    Port Index

 

GigabitEthernet1/0/1 is link-up

  MAC address authentication is enabled

  Authenticate success: 3, failed: 1

  Current online user number is 3

    MAC Addr         Authenticate State           Auth Index

    1234-0300-0011   MAC_AUTHENTICATOR_SUCCESS     13

    1234-0300-0012   MAC_AUTHENTICATOR_SUCCESS     14

    1234-0300-0013   MAC_AUTHENTICATOR_SUCCESS     15

 

查看802.1x认证情况:

<Switch> 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

 EAD quick deploy configuration:

                EAD timeout:   30 m

 

 The 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

   802.1X Multicast-trigger is enabled

   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              

此外,因为设置了NeedToKnow特性,目的MAC地址未知、广播和多播报文都被丢弃。

1.11  常见配置错误举例

1.11.1  端口安全模式无法设置

1. 故障现象

无法配置端口安全模式。

[Switch-GigabitEthernet1/0/1] port-security port-mode autolearn

 Error:When we change port-mode, we should first change it to noRestrictions, then change it to the other.

2. 故障分析

在当前端口安全模式已配置的情况下,无法直接对端口安全模式进行设置。

3. 处理过程

首先设置端口安全模式为noRestrictions状态。

[Switch-GigabitEthernet1/0/1] undo port-security port-mode

[Switch-GigabitEthernet1/0/1] port-security port-mode autolearn

1.11.2  无法配置端口安全MAC地址

1. 故障现象

无法配置端口安全MAC地址。

[Switch-GigabitEthernet1/0/1] port-security mac-address security 1-1-2 vlan 1

 Error:Can not operate security MAC address for current port mode is not autoLearn!

2. 故障分析

端口安全模式为非autoLearn时,不能对安全MAC地址进行设置。

3. 处理过程

设置端口安全模式为autoLearn状态。

[Switch-GigabitEthernet1/0/1] undo port-security port-mode

[Switch-GigabitEthernet1/0/1] port-security max-mac-count 64

[Switch-GigabitEthernet1/0/1] port-security port-mode autolearn

[Switch-GigabitEthernet1/0/1] port-security mac-address security 1-1-2 vlan 1

1.11.3  用户在线情况下无法更换端口安全模式

1. 故障现象

802.1x或MAC地址认证用户在线的情况下,更换端口安全模式失败。

[Switch-GigabitEthernet1/0/1] undo port-security port-mode

 Error:Cannot configure port-security for there is 802.1X user(s) on line on port GigabitEthernet1/0/1.  

2. 故障分析

有802.1x或MAC认证用户在线的情况下,禁止更换端口安全模式。

3. 处理过程

断开端口与用户的连接后再进行端口安全模式更换,可以通过cut命令强制切断连接。

[Switch-GigabitEthernet1/0/1] cut connection interface gigabitethernet 1/0/1

[Switch-GigabitEthernet1/0/1] undo port-security port-mode

 

 

不同款型规格的资料略有差异, 详细信息请向具体销售和400咨询。H3C保留在没有任何通知或提示的情况下对资料内容进行修改的权利!

新华三官网
联系我们