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

H3C SOHO交换机 典型配置举例(Comware V5)-6W102

26-端口安全典型配置举例

本章节下载 26-端口安全典型配置举例  (183.11 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S5110/S5110/Configure/Typical_Configuration_Example/H3C_SOHO_CE(Comware_V5)-6W102/201809/1107301_30005_0.htm

26-端口安全典型配置举例


1  端口安全典型配置举例

1.1  简介

本章介绍了使用端口安全功能实现用户安全接入的典型配置举例。

1.2  使用限制

·     如果已全局开启了802.1X或MAC地址认证功能,则无法使能端口安全功能。

·     当端口安全功能开启后,端口上的802.1X功能以及MAC地址认证功能将不能被手动开启,且802.1X端口接入控制方式和端口接入控制模式也不能被修改,只能随端口安全模式的改变由系统更改。

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

·     端口安全模式的配置与端口加入聚合组或业务环回组互斥。

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

1.3  端口安全autolearn模式典型配置举例

1.3.1  组网需求

图1所示,用户通过Switch连接到网络。通过配置端口安全autolearn模式,实现对接入用户的控制,具体需求如下:

·     最多同时允许64个用户通过交换机接入Internet,用户无需进行认证;

·     当用户数量超过设定值后,新用户无法通过Switch接入Internet。

图1 端口安全autolearn模式配置组网图

 

1.3.2  配置思路

·     配置交换机与用户相连端口的安全模式为autolearn。

·     为防止交换机与用户相连端口学习到的MAC地址的丢失,及安全MAC地址不老化会带来一些问题,需配置安全MAC地址并设定安全MAC地址老化时间(例如30分钟)。

·     设置最大安全MAC地址数为64,当再有新的MAC地址接入时,触发入侵检测,交换机输出对应的Trap信息,且交换机与用户相连端口被暂时断开连接,30秒后自动恢复端口的开启状态。

1.3.3  配置注意事项

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

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

1.3.4  配置步骤

# 使能端口安全功能。

<Switch> system-view

[Switch] port-security enable

 Please wait............................... Done.

# 设置Sticky MAC地址的老化时间为30分钟。

[Switch] port-security timer autolearn aging 30

# 打开入侵检测Trap开关。

[Device] port-security trap intrusion

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

[Switch] interface GigabitEthernet 1/0/1

[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

1.3.5  验证配置

上述配置完成后,可以用display命令显示端口安全配置情况,如下:

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

 Equipment port-security is enabled

 Intrusion trap is enabled

 AutoLearn aging time is 30 minutes

 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

   Security MAC address learning mode is sticky

   Security MAC address aging type is absolute

可以看到端口的最大安全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 intrusion-mode disableport-temporarily

 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地址到达将触发入侵保护,Trap信息如下:

#Apr 26 12:47:14:210 2000 Switch PORTSEC/4/VIOLATION: Trap1.3.6.1.4.1.25506.2.26.1.3.2<hh3cSecureViolation>

 An intrusion occurs!

 IfIndex: 17825797

 Port: 17825797

 MAC Addr: E8:39:35:5F:31:91

 VLAN ID: 1

 IfAdminStatus: 2

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

<Switch> display interface gigabitethernet 1/0/1

 gigabitEthernet1/0/1 current state: DOWN (  Port Security Disabled  )

 IP Packet Frame Type: PKTFMT_ETHNT_2, Hardware Address: 0023-8927-ad7d

 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

 ......

此时,如通过命令undo port-security mac-address security手动删除几条安全MAC地址后,端口安全的状态重新恢复为autoLearn,可以继续学习MAC地址。

1.3.6  配置文件

#

 port-security enable

 port-security trap intrusion

 port-security timer autolearn aging 30

 port-security timer disableport 30

#

interface GigabitEthernet1/0/1

 port-security max-mac-count 64

 port-security port-mode autolearn

 port-security intrusion-mode disableport-temporarily

#

1.4  端口安全userLoginWithOUI模式典型配置举例

1.4.1  组网需求

图2所示,用户Host(已安装802.1X客户端软件)和打印机Printer通过交换机Switch连接到网络,交换机通过RADIUS服务器对用户进行身份认证,如果认证成功,用户被授权允许访问Internet资源。

通过配置端口安全userLoginWithOUI模式,实现对接入用户的控制,具体需求如下:

·     最多允许一个802.1X用户通过该端口接入Internet;

·     允许打印机通过与交换机相连端口实现与Internet资源正常连接;

·     当有非法用户接入时,触发入侵检测,将非法报文丢弃(不对端口进行关闭)。

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

 

1.4.2  配置思路

·     配置交换机与用户端相连的端口安全模式为userLoginWithOUI,即:该端口最多只允许一个802.1X认证用户接入,还允许一个指定OUI的源MAC地址的报文认证通过。为userLoginWithOUI端口安全模式配置5个OUI值(对应不同厂商的打印机MAC地址的OUI)。

·     配置端口安全的入侵检测功能:当交换机与用户端相连的端口接收到非法报文后,触发入侵检测,将非法报文丢弃,同时将其源MAC地址加入阻塞MAC地址列表中。

·     为认证用户添加认证域和RADIUS方案。

1.4.3  配置步骤

说明

·     按照组网图配置设备各接口的IP地址,保证各主机、服务器和设备之间的路由可达。

·     如下服务器配置以H3C S5500-HI系列交换机作为RADIUS server为例,详细信息可参考相关产品手册。

 

1. Switch的配置

·     配置RADIUS方案

# 创建名为radsun的RADIUS方案,并配置主认证服务器IP和交互密钥。

<Switch> system-view

[Switch] radius scheme radsun

New Radius scheme

[Switch-radius-radsun] primary authentication 10.1.1.1 1645 key aabbcc

# 设置RADIUS服务器应答超时时间为5秒,RADIUS报文的超时重传次数的最大值为5。

[Switch-radius-radsun] timer response-timeout 5

[Switch-radius-radsun] retry 5

# 设置将去除域名的用户名发送给RADIUS服务器。

[Switch-radius-radsun] user-name-format without-domain

[Switch-radius-radsun] quit

# 创建名为sun的ISP域,并进入其视图。

[Switch] domain sun

# 指定名为radsun的RADIUS方案为该域lan-access用户的缺省RADIUS认证、授权方案。

[Switch-isp-sun] authentication default radius-scheme radsun

[Switch-isp-sun] authorization default radius-scheme radsun

[Switch-isp-sun] accounting default none

[Switch-isp-sun] quit

·     配置802.1X

# 配置802.1X的认证方式为CHAP。(该配置可选,缺省情况下802.1X的认证方式为CHAP)

[Switch] dot1x authentication-method chap

 CHAP authentication enabled already. 

·     配置端口安全特性

# 添加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

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

[Switch] interface GigabitEthernet 1/0/1

[Switch-GigabitEthernet1/0/1] port-security port-mode userlogin-withoui

# 设置触发入侵检测功能后,将非法报文丢弃,同时将其源MAC地址加入阻塞MAC地址列表中。

[Switch-GigabitEthernet1/0/1] port-security intrusion-mode blockmac

[Switch-GigabitEthernet1/0/1] quit

# 使能端口安全功能。

[Switch] port-security enable

 Please wait............................... Done.

2. RADIUS server的配置

# 创建RADIUS用户“aaa”并进入RADIUS服务器用户视图

<Sysname> system-view

[Sysname] radius-server user aaa

# 指定用户aaa的密码为明文123456。

[Sysname -rdsuser-aaa] password simple 123456

[Sysname -rdsuser-aaa] quit

# 配置RADIUS客户端IP为10.1.1.2,共享密钥为明文aabbcc。

[Sysname] radius-server client-ip 10.1.1.2 key simple aabbcc

1.4.4  验证配置

查看名为radsun的RADIUS方案的配置信息:

[Switch] display radius scheme radsun

SchemeName  : radsun

  Index : 1                           Type : standard

  Primary Auth Server:

    IP: 10.1.1.1                                 Port: 1645   State: active

    Encryption Key : ******

    VPN instance   : N/A

    Probe username : N/A

    Probe interval : N/A

  Auth Server Encryption Key : N/A

  Acct Server Encryption Key : N/A

  VPN instance               : N/A

  Accounting-On packet disable, send times : 50 , interval : 3s

  Interval for timeout(second)                            : 5

  Retransmission times for timeout                        : 5

  Interval for realtime accounting(minute)                : 12

  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: Disabled

   Accounting method: Required

   Default authentication scheme      : radius:radsun

   Default authorization scheme       : radius:radsun

   Default accounting scheme          : none

   Domain User Template:

   Idle-cut : Disabled

   Self-service : Disabled

   Authorization attributes:

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

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

 Equipment port-security is enabled

 Trap is disabled

 AutoLearn aging time is 0 minutes

 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 BlockMacAddress

   Max MAC address number is not configured

   Stored MAC address number is 0

   Authorization is permitted

   Security MAC address learning mode is sticky

   Security MAC address aging type is absolute

配置完成后,如果有802.1X用户上线,则可以看到存储的安全MAC地址数为1。还可以通过下述命令查看802.1X用户的情况:

<Switch> display dot1x interface gigabitethernet 1/0/1

 Equipment 802.1X protocol is enabled

 CHAP authentication is enabled

 Proxy trap checker is disabled

 Proxy logoff checker is disabled

 

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

                Reauth Period   3600 s

                The maximal retransmitting times    2

 

 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

   Proxy trap checker is   disabled

   Proxy logoff checker is disabled

   Handshake is enabled

   Handshake secure is disabled

   802.1X unicast-trigger is enabled

   Periodic reauthentication is disabled

   The port is an authenticator

   Authentication Mode is Auto

   Port Control Type is Mac-based

   802.1X Multicast-trigger is enabled

   Mandatory authentication domain: NOT configured

   Guest VLAN: NOT configured

   Auth-Fail VLAN: NOT configured

   Critical VLAN: NOT configured

   Critical recovery-action: NOT configured

   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.4.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 10.1.1.1 1645 key cipher $c$3$krBjik3mdDkyVGW9JRInyID3GMYJOw==

 timer response-timeout 5

 user-name-format without-domain

 retry 5

#

domain sun

 authentication default radius-scheme radsun

 authorization default radius-scheme radsun

 accounting default none

 access-limit disable

 state active

 idle-cut disable

 self-service-url disable

#

interface GigabitEthernet1/0/1

 port-security port-mode userlogin-withoui

 port-security intrusion-mode blockmac

#

 

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

新华三官网
联系我们