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

H3C S5600系列以太网交换机 命令手册-Release 1702(V1.00)

11-端口安全-端口绑定命令

本章节下载  (279.1 KB)

docurl=/cn/Service/Document_Software/Document_Center/Switches/Catalog/S5600/S5600/Command/Command_Manual/H3C_S5600_CM-Release_1702(V1.00)/201006/679947_30005_0.htm

11-端口安全-端口绑定命令


1 端口安全命令

l          新增“端口安全支持Guest VLAN”特性相关命令,具体请参见1.1.6  port-security guest-vlan1.1.14  port-security timer guest-vlan-reauth

l          新增“配置自动学习到的Secure MAC地址表项的老化时间”特性相关命令,具体请参见1.1.12  port-security timer autolearn

 

1.1  端口安全命令

1.1.1  display mac-address security

【命令】

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

【视图】

任意视图

【参数】

interface interface-type interface-number:显示指定端口的Secure MAC地址信息。其中,interface-type interface-number表示端口类型和端口编号。

vlan vlan-id:显示指定VLAN中的Secure MAC地址信息。其中,vlan-id表示VLAN的编号,取值范围为1~4094。

count:统计符合条件的Secure MAC地址的数量。

【描述】

display mac-address security命令用来显示Secure MAC地址的相关信息,包括:MAC地址所对应的VLAN ID、MAC地址的当前状态为Secure MAC、MAC地址所对应的端口编号和MAC地址的老化时间。

需要注意的是,如果不指定任何参数,则显示所有Secure MAC地址的信息。

根据该命令的输出信息,用户可以确认当前的配置,有助于故障的监控和诊断。

【举例】

# 显示所有Secure MAC地址的相关信息。

<Sysname> display mac-address security

MAC ADDR        VLAN ID   STATE          PORT INDEX               AGING TIME(s)

0000-0000-0001  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0002  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0003  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0004  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0001  2        Security      GigabitEthernet1/0/22         NOAGED

0000-0000-0007  2        Security      GigabitEthernet1/0/22         NOAGED

 

  ---  6 mac address(es) found  ---

# 显示端口GigabitEthernet1/0/20的Secure MAC地址的相关信息。

<Sysname> display mac-address security interface GigabitEthernet 1/0/20

MAC ADDR        VLAN ID   STATE          PORT INDEX               AGING TIME(s)

0000-0000-0001  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0002  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0003  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0004  1        Security      GigabitEthernet1/0/20         NOAGED

 

  ---  4 mac address(es) found on port GigabitEthernet1/0/20 ---

# 显示VLAN1中的Secure MAC地址的相关信息。

<Sysname> display mac-address security vlan 1

MAC ADDR        VLAN ID   STATE          PORT INDEX               AGING TIME(s)

0000-0000-0001  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0002  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0003  1        Security      GigabitEthernet1/0/20         NOAGED

0000-0000-0004  1        Security      GigabitEthernet1/0/20         NOAGED

 

  ---  4 mac address(es) found in vlan 1 ---

# 显示所有Secure MAC地址的数量。

<Sysname> display mac-address security count

 6 mac address(es) found

# 显示VLAN1中的Secure MAC地址的数量。

<Sysname> display mac-address security vlan 1 count

 4 mac address(es) found in vlan 1

表1-1 display mac-address security命令显示信息描述表

字段

描述

MAC ADDR

Secure MAC地址

VLAN ID

端口所属VLAN

STATE

MAC地址类型

Security:表示该项是安全MAC地址

PORT INDEX

Secure MAC地址所在端口

AGING TIME(s)

Secure MAC地址的存活时间

NOAGED:表示该安全MAC地址不会被老化

 mac address(es) found

当前的Secure MAC地址数目

 

1.1.2  display port-security

【命令】

display port-security [ interface interface-list ]

【视图】

任意视图

【参数】

interface-list:以太网端口列表,表示多个以太网端口,表示方式为interface-list={ interface-type interface-number [ to interface-type interface-number ] } & <1-10>。

其中,interface-type为端口类型,interface-number为端口编号。& <1-10>表示前面的参数最多可以输入10次。

interface interface-list显示指定端口的端口安全配置信息。

【描述】

display port-security命令用来显示端口安全配置的相关信息,包括:全局的配置信息(如交换机的端口安全功能是否开启、指定Trap信息的发送开关是否开启)和端口的配置信息(如端口的安全模式、端口安全的相关特性)。

需要注意的是,如果不指定参数interface interface-list则显示所有端口的端口安全信息。

根据该命令的输出信息,用户可以确认当前的配置,有助于故障的监控和诊断。

【举例】

# 显示全局和所有端口的端口安全配置信息。

<Sysname> display port-security

 Equipment port-security is enabled

 AddressLearn trap is Enabled

 Intrusion trap is Enabled

 Dot1x logon trap is Enabled

 Dot1x logoff trap is Enabled

 Dot1x logfailure trap is Enabled

 RALM logon trap is Enabled

 RALM logoff trap is Enabled

 RALM logfailure trap is Enabled

 Disableport Timeout: 20 s

 OUI value:

   Index is 5,  OUI value is 000100

 GigabitEthernet1/0/1 is link-up

   Port mode is AutoLearn

   NeedtoKnow mode is needtoknowonly

   Intrusion mode is BlockMacaddress

   Max mac-address num is 4

   Stored mac-address num is 0

   Authorization is ignore

(以下显示信息略)

# 显示端口GigabitEthernet1/0/1到GigabitEthernet1/0/3之间的端口安全配置信息。

<Sysname> display port-security interface gigabitethernet 1/0/1 to gigabitethernet 1/0/3

 GigabitEthernet1/0/1 is link-up

   Port mode is AutoLearn

   NeedtoKnow mode is needtoknowonly

   Intrusion mode is BlockMacaddress

   Max mac-address num is 4

   Stored mac-address num is 0

   Authorization is ignore

 GigabitEthernet1/0/2 is link-down

   Port mode is AutoLearn

   NeedtoKnow mode is disabled

   Intrusion mode is no action

   Max mac-address num is not configured

   Stored mac-address num is 0

   Authorization is ignore

 GigabitEthernet1/0/3 is link-down

   Port mode is AutoLearn

   NeedtoKnow mode is disabled

   Intrusion mode is BlockMacaddress

   Max mac-address num is not configured

   Stored mac-address num is 0

   Authorization is ignore          

表1-2 display port-security命令显示信息描述表

字段

描述

Equipment port-security

交换机端口安全的开启状态

AddressLearn trap

端口学习告警的开启状态。若为enabled,则表示端口学习到新MAC地址时发出告警信息

Intrusion trap

入侵检测告警的开启状态。若为enabled,则表示端口发现非法报文时发出告警信息

Dot1x logon trap

802.1X认证成功告警的开启状态。若为enabled,则表示802.1X用户认证成功时发出告警信息

Dot1x logoff trap

802.1x认证用户下线告警的开启状态。若为enabled,则表示802.1X用户下线时发出告警信息

Dot1x logfailure trap

802.1x认证失败告警的开启状态。若为enabled,则表示802.1X用户认证失败时发出告警信息

RALM logon trap

MAC地址认证成功告警的开启状态。若为enabled,则表示MAC地址认证成功时发出告警信息

RALM logoff trap

MAC地址认证用户下线告警的开启状态。若为enabled,则表示MAC地址认证用户下线时发出告警信息

RALM logfailure trap

MAC地址认证失败告警的开启状态。若为enabled,则表示MAC地址认证用户认证失败时发出告警信息

Disableport Timeout:

收到非法报文的端口暂时被关闭的时间,单位为秒

OUI value

允许通过认证的用户的24位OUI值

Index

OUI的索引

Port mode

端口安全模式,包括以下几种:

l      autoLearn

l      macAddressAndUserLoginSecure

l      macAddressAndUserLoginSecureExt macAddressWithRadius macAddressElseUserLoginSecure macAddressElseUserLoginSecureExt

l      secure

l      userLoginSecure

l      userLoginSecureExt macAddressOrUserLoginSecure macAddressOrUserLoginSecureExt userLoginWithOUI

NeedtoKnow mode

NeedtoKnow模式,包括以下三种:

l      ntkonly:表示只有目的MAC地址是已认证的MAC地址的单播报文才能被成功发送

l      ntk-withbroadcasts:表示广播报文和目的MAC地址是已认证的MAC地址的单播报文能够被成功发送

l      ntk-withmulticasts:表示组播报文、广播报文以及目的MAC地址是已认证的MAC地址的单播报文能够被成功发送

Intrusion mode

入侵检测特性模式,包括以下四种:

l      blockmac:表示将非法报文的源MAC地址加入阻塞MAC地址列表中,源MAC地址为阻塞MAC地址的报文将被过滤。此MAC地址在被阻塞3分钟(系统默认,不可配)后恢复正常

l      disableport:表示将发现非法报文或非法事件的端口永久地断开端口连接

l      disableport-temporarily:表示将发现非法报文或非法事件的端口暂时断开端口连接,经过port-security timer disableport命令预先设置的时间之后再启用端口

Max mac-address num

端口下允许学习的安全MAC地址的最大数目

Stored mac-address num

端口下保存的安全MAC地址数目

Authorization

服务器的授权信息是否被忽略的情况

l      permit:表示当前端口应用RADIUS服务器下发的授权信息

l      ignore:表示当前端口不应用RADIUS服务器下发的授权信息

 

1.1.3  mac-address security

【命令】

系统视图下:

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

undo mac-address security [ [ mac-address [ interface interface-type interface-number ] ] vlan vlan-id ]

以太网端口视图下:

mac-address security mac-address vlan vlan-id

undo mac-address security [ [ mac-address ] vlan vlan-id ]

【视图】

系统视图/以太网端口视图

【参数】

mac-address:Secure MAC地址,格式为H-H-H。

interface interface-type interface-number:指定添加Secure MAC地址的端口。其中,interface-type interface-number表示端口类型和端口编号。

vlan vlan-id:指定添加Secure MAC地址的端口所属的VLAN。其中,vlan-id表示VLAN的编号,取值范围为1~4094。

【描述】

mac-address security命令用来添加Secure MAC地址。undo mac-address security命令用来删除配置的Secure MAC地址。

缺省情况下,系统没有配置Secure MAC地址。

l          mac-address security命令只有在端口安全功能打开且指定端口的端口安全模式为autoLearn的时候才能配置成功。

l          在添加Secure MAC地址时,命令中interface参数指定的端口必须属于vlan参数指定的VLAN,否则将添加失败。

 

【举例】

# 启动端口安全功能,在Ethernet1/0/1端口下配置端口安全模式为autolearn,并将0001-0001-0001作为Securiy MAC地址添加到该端口中,Ethernet1/0/1属于VLAN 1。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security enable

[Sysname] interface Ethernet 1/0/1

[Sysname-Ethernet1/0/1] port-security max-mac-count 100

[Sysname-Ethernet1/0/1] port-security port-mode autolearn

[Sysname-Ethernet1/0/1] mac-address security 0001-0001-0001 vlan 1

# 通过display mac-address interface命令查看配置结果。

[Sysname]display mac-address interface Ethernet 1/0/1

MAC ADDR        VLAN ID   STATE          PORT INDEX               AGING TIME(s)

0001-0001-0001  1         Security       Ethernet1/0/1            NOAGED

 

  ---  1 mac address(es) found on port Ethernet1/0/1 ---

1.1.4  port-security authorization ignore

【命令】

port-security authorization ignore

undo port-security authorization ignore

【视图】

以太网端口视图

【参数】

【描述】

port-security authorization ignore命令用来配置当前端口不应用RADIUS服务器下发的授权信息。undo port-security authorization ignore命令用来恢复系统的缺省配置。

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

通过执行display port-security命令,可查看当前端口是否应用RADIUS服务器下发的授权信息。

当用户通过远程RADIUS认证后,RADIUS服务器会根据用户帐号配置的相关属性进行授权,比如动态VLAN下发等。如果用户不希望下发动态VLAN,可以使用该命令使当前端口不应用RADIUS服务器下发的授权信息。

 

【举例】

# 配置端口GigabitEthernet1/0/2不应用RADIUS服务器下发的授权信息。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] interface gigabitethernet 1/0/2

[Sysname-GigabitEthernet1/0/2] port-security authorization ignore

1.1.5  port-security enable

【命令】

port-security enable

undo port-security enable

【视图】

系统视图

【参数】

【描述】

port-security enable命令用来启动端口安全功能。undo port-security enable命令用来关闭端口安全功能。

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

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

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

l          MAC地址认证(关闭)。

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

 

相关配置可参考命令display port-security

【举例】

# 启动端口的安全功能。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security enable

 Notice: The port-control of 802.1x will be restricted to auto when port-security is enabled.

 Please wait... Done.

1.1.6  port-security guest-vlan

【命令】

port-security guest-vlan vlan-id

undo port-security guest-vlan

【视图】

以太网端口视图

【参数】

vlan-id:端口上指定的Guest VLAN ID,取值范围为1~4094。该VLAN必须已经创建。

【描述】

port-security guest-vlan命令用来指定某个已创建的VLAN为当前端口可访的Guest VLAN。

undo port-security guest-vlan命令用来取消指定的Guest VLAN。

缺省情况下,没有指定Guest VLAN。

需要注意的是:

l              指定某VLAN为当前端口可访的Guest VLAN前,需要确保该VLAN已经创建、并且该VLAN内包含用户需要访问的资源。

l              若当前端口下有接入用户正在进行认证或已经通过认证,则无法为其指定Guest VLAN。

l              当指定了端口可访问的Guest VLAN后,若端口下挂的用户认证失败,该端口将被加入到Guest VLAN中、下挂的用户只能访问Guest VLAN中的资源。

l              每个端口下可连接一个或多个认证用户,若该端口指定了可访问的Guest VLAN则同一时刻每个端口最多只允许一个用户通过安全认证(其余的802.1x认证用户的客户端会显示认证失败;由于MAC地址认证时没有客户端,因此认证失败且无任何提示)。

l              当端口已经指定了Guest VLAN的情况下、若要改变端口安全模式,必须首先执行undo port-security guest-vlan 命令取消给该端口指定的Guest VLAN。

l              端口只有在macAddressOrUserLoginSecure安全模式下才能指定其可访问的Guest VLAN。

l              若用户在端口同时指定Guest VLAN和配置port-security intrusion-mode disableport命令,当认证失败后,只触发入侵检测特性,不会再将该端口加入Guest VLAN。

l              建议不要在端口上将指定Guest VLAN功能和配置port-security intrusion-mode blockmac命令同时使用。因为如果认证失败,触发入侵检测blockmac特性后,该接入用户发出的报文将被丢弃,用户无法访问Guest VLAN。

【举例】

# 设置GigabitEthernet1/0/1端口的安全模式为macAddressOrUserLoginSecure,并指定已创建的VLAN 100为Guest VLAN。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] port-security port-mode userlogin-secure-or-mac

[Sysname-GigabitEthernet1/0/1] port-security guest-vlan 100

1.1.7  port-security intrusion-mode

【命令】

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

undo port-security intrusion-mode

【视图】

以太网端口视图

【参数】

blockmac:表示将非法报文的源MAC地址加入阻塞MAC地址列表中,源MAC地址为阻塞MAC地址的报文将被过滤,从而实现在端口上过滤非法流量的目的。此MAC地址在被阻塞3分钟(系统默认,不可配)后恢复正常。

disableport:表示将发现非法报文或非法事件的端口永久地断开端口连接。

disableport-temporarily:表示将发现非法报文或非法事件的端口暂时断开端口连接,经过port-security timer disableport命令预先设置的时间之后再启用端口。

可以通过undo shutdown命令或关闭端口安全功能的方式,将永久断开的端口连接恢复。

 

【描述】

port-security intrusion-mode命令用来设置Intrusion Protection特性。undo port-security intrusion-mode命令用来取消设置的Intrusion Protection特性。

缺省情况下,没有设置Intrusion Protection特性。

Intrusion Protection特性是指端口通过检测接收到的数据帧的源MAC地址或802.1x认证的用户名密码,发现非法报文或非法事件,比如:

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

l          当端口允许接入的MAC地址数达到设置的最大值时,收到的源地址为未知MAC地址的报文;

l          用户使用802.1x认证和MAC地址认证失败。

此时会触发Intrusion Protection特性,并采取相应的动作,包括暂时断开端口连接、永久断开端口连接或是过滤此MAC地址的报文,保证了端口的安全性。

 

当用户配置了port-security intrusion-mode blockmac后,只能通过display port-security命令查看处于Blocked状态的MAC地址信息。

相关配置可参考命令display port-security、port-security timer disableport

【举例】

# 设置端口GigabitEthernet1/0/1的Intrusion Protection特性为blockmac

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] interface gigabitethernet 1/0/1

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

# 当Intrusion Protection特性被触发后,查看处于Blocked状态的MAC地址信息。

<Sysname> display port-security

 Equipment port-security is enabled

 AddressLearn trap is Enabled

 Intrusion trap is Enabled

 Dot1x logon trap is Enabled

 Dot1x logoff trap is Enabled

 Dot1x logfailure trap is Enabled

 RALM logon trap is Enabled

 RALM logoff trap is Enabled

 RALM logfailure trap is Enabled

 Disableport Timeout: 20 s

 OUI value:

   Index is 5,  OUI value is 000100

 Blocked Mac info:

          MAC ADDR             From Port                  Vlan

          --- On unit 1, 2 blocked mac address(es) found. ---

          0000-0000-0003       GigabitEthernet1/0/1         1

          0000-0000-0004       GigabitEthernet1/0/1         1

          --- 2 blocked mac address(es) found. ---

GigabitEthernet1/0/1 is link-up

   Port mode is Secure

   NeedtoKnow mode is disabled

   Intrusion mode is BlockMacaddress

   Max mac-address num is 2

   Stored mac-address num is 2

   Authorization is permit     

以上显示信息的解释请参见表1-2

# 设置端口GigabitEthernet1/0/1的Intrusion Protection特性为disableport-temporarily,当Intrusion Protection特性被触发后,暂时断开端口连接,经过30秒之后再启用端口。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security timer disableport 30

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] port-security intrusion-mode disableport-temporarily

# 设置端口GigabitEthernet1/0/1的Intrusion Protection特性为disableport,当Intrusion Protection特性被触发后,永久地断开端口连接。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] port-security intrusion-mode disableport

可以通过undo shutdown命令或关闭端口安全功能的方式,将永久断开的端口连接恢复。

 

1.1.8  port-security max-mac-count

【命令】

port-security max-mac-count count-value

undo port-security max-mac-count

【视图】

以太网端口视图

【参数】

count-value:允许接入的最大MAC地址数,取值范围为1~1024。

【描述】

port-security max-mac-count命令用来设置端口允许接入的最大MAC地址数。undo port-security max-mac-count命令用来取消该限制。

缺省情况下,端口允许接入的最大MAC地址数不受限制。

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

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

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

当某一端口上的MAC地址数达到该端口允许接入的最大MAC地址数后,端口将不会再允许新的用户通过该端口接入网络。

 

l          port-security max-mac-count命令与MAC地址管理中配置的端口最多可以学习到的MAC地址数无关。

l          端口上有用户在线的情况下,无法更改端口允许接入的最大MAC地址数。

 

【举例】

# 设置端口允许接入的最大MAC地址数为100。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security enable

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] port-security max-mac-count 100

1.1.9  port-security ntk-mode

【命令】

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

undo port-security ntk-mode

【视图】

以太网端口视图

【参数】

ntkonly:表示只有目的MAC地址是已认证的MAC地址的单播报文才能被成功发送。

ntk-withbroadcasts:表示广播报文和目的MAC地址是已认证的MAC地址的单播报文能够被成功发送。

ntk-withmulticasts:表示组播报文、广播报文以及目的MAC地址是已认证的MAC地址的单播报文能够被成功发送。

【描述】

port-security ntk-mode命令用来配置端口Need To Know特性。undo port-security ntk-mode命令用来恢复缺省配置。

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

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

 

【举例】

# 设置端口GigabitEthernet1/0/1的NTK特性为ntk-withbroadcasts

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security enable

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] port-security ntk-mode ntk-withbroadcasts

1.1.10  port-security oui

【命令】

port-security oui OUI-value index index-value

undo port-security oui index index-value

【视图】

系统视图

【参数】

OUI-value:OUI值,输入格式为H-H-H的48位MAC地址。系统会自动取输入的前24位做为OUI值,忽略后24位。

index-value:OUI的索引值,取值范围为1~16。

OUI(Organizationally Unique Identifier)是IEEE为不同设备供应商分配的一个全球唯一的标识符,是MAC地址的前24位。

 

【描述】

port-security oui命令用来设置认证中需要的OUI值。undo port-security oui命令用来取消设置的OUI值。

缺省情况下,未设置认证中需要的OUI值。

缺省情况下,没有设置用户认证的OUI值。

OUI指的是MAC地址的前24位(二进制),是IEEE为不同设备供应商分配的一个全球唯一的标识符。因此,当需要允许某些特殊设备的(有线接入)报文总是可以通过认证或仅允许这些设备的(无线接入)报文可以进行认证的情况下,就可以通过本命令来指定这些设备的OUI值,例如,某公司仅允许A厂商的IP电话在企业网中使用,则该值就为A厂商设备的OUI。

需要注意的是,本命令设置的OUI值,只在端口安全模式为userLoginWithOUI时生效。

【举例】

# 设置一个OUI值为000f-e200-0000,索引号为5。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security oui 000f-e200-0000 index 5

1.1.11  port-security port-mode

【命令】

port-security port-mode  { autolearnmac-and-userlogin-secure | mac-and-userlogin-secure-ext | mac-authenticationmac-else-userlogin-securemac-else-userlogin-secure-ext | secureuserlogin | userlogin-secure userlogin-secure-ext userlogin-secure-or-mac | userlogin-secure-or-mac-ext | userlogin-withoui }

undo port-security port-mode

【视图】

以太网端口视图

【参数】

有关安全模式与命令参数对应关系,请参见表1-3

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

命令参数

安全模式类型

描述

autolearn

autolearn

此模式下,可通过手工配置或通过动态进行MAC学习,该MAC称为Secure MAC;

只有源MAC为Secure MAC或已配置的动态MAC的报文,才能通过该端口;

当端口下的Secure MAC地址表项数超过port-security max-mac-count命令配置的数目后,该端口不会再添加新的Secure MAC,并且端口模式会自动转变为secure

mac-and-userlogin-secure

macAddressAndUserLoginSecure

对接入用户先进行MAC地址认证,当MAC地址认证成功后,再进行802.1x认证。只有在这两种认证都成功的情况下,才允许该用户接入网络;

此模式下,端口最多只允许一个用户接入网络

mac-and-userlogin-secure-ext

macAddressAndUserLoginSecureExt

与macAddressAndUserLoginSecure类似。但此模式下,端口允许接入网络的用户可以有多个

mac-authentication

macAddressWithRadius

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

mac-else-userlogin-secure

macAddressElseUserLoginSecure

对接入用户先进行MAC地址认证,如果成功则表明认证通过,如果失败再进行802.1x认证;

此模式下,端口最多只允许接入一个经过认证的802.1x用户,但端口下经过认证的MAC地址认证用户可以有多个

mac-else-userlogin-secure-ext

macAddressElseUserLoginSecureExt

macAddressElseUserLoginSecure类似。但此模式下,端口允许经过认证的802.1x用户可以有多个

secure

secure

禁止端口学习MAC地址,只有已配置的静态或动态MAC的报文,才能通过该端口

除此之外,当端口模式从autolearn转变为secure后,源MAC为端口已经学习到的Secure MAC也可以通过该端口

userlogin

userlogin

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

userlogin-secure

userLoginSecure

对接入用户采用基于MAC的802.1x认证,认证成功后端口开启,但也只允许认证成功的用户报文通过;

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

当端口从noRestriction模式进入此安全模式时,端口下原有的动态MAC地址表项和已认证的MAC地址表项将被自动删除

userlogin-secure-ext

userLoginSecureExt

userLoginSecure类似,但端口下的802.1x认证用户可以有多个

userlogin-secure-or-mac

macAddressOrUserLoginSecure

MAC地址认证和802.1x认证可以同时共存,但802.1x认证优先级大于MAC地址认证

接入用户通过MAC地址认证后,仍然可以进行802.1x认证;

接入用户通过802.1x认证后,不再进行MAC地址认证;

此模式下,端口最多只允许接入一个经过认证的802.1x用户,但端口下经过认证的MAC地址认证用户可以有多个

userlogin-secure-or-mac-ext

macAddressOrUserLoginSecureExt

macAddressOrUserLoginSecure类似。但此模式下,端口允许经过认证的802.1x用户可以有多个

userlogin-withoui

userLoginWithOUI

userLoginSecure类似,端口最多只允许一个802.1x认证用户,但同时,端口还允许一个OUI(Organizationally Unique Identifier 是一个全球唯一的标识符,是MAC地址的前24位)地址的报文通过;

当端口从noRestriction模式进入此模式时,端口下原有的动态MAC地址表项和已认证的MAC地址表项将被自动删除

 

【描述】

port-security port-mode命令用来配置端口的安全模式。undo port-security port-mode命令用来恢复缺省情况。

缺省情况下,端口处于noRestriction模式,此时该端口处于无限制状态。

l          当用户配置端口安全模式为autolearn时,首先需要使用port-security max-mac-count命令设置端口允许接入的最大MAC地址数。

l          当端口工作于autolearn模式时,无法更改端口允许接入的最大MAC地址数。

l          在用户配置端口安全模式为autolearn后,不能在该端口上配置静态或黑洞MAC地址。

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

 

在已经配置了安全模式的端口下,将不能再进行以下配置:

l              配置最大MAC地址学习个数;

l              配置镜像反射端口;

l              配置Fabric端口;

l              配置端口汇聚。

相关命令可以参考display port-security

【举例】

# 设置交换机GigabitEthernet1/0/1端口为userlogin模式。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security enable

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] port-security port-mode userlogin

1.1.12  port-security timer autolearn

【命令】

port-security timer autolearn age

undo port-security timer autolearn

【视图】

系统视图

【参数】

age:Secure MAC地址的老化时间,age的取值范围为1~30240,单位为分钟。

【描述】

port-security timer autolearn命令用来配置端口自动学习到的Secure MAC地址表项的老化时间。undo port-security timer autolearn命令用来恢复缺省情况。

缺省情况下,端口自动学习到的Secure MAC地址表项的老化时间为0,即不进行老化处理。

配置Secure MAC地址表项的老化时间后,可通过display mac-address security命令查看端口学习到的Secure MAC地址表项信息时,虽然老化时间显示为“NOAGED”,但此时交换机已经开始对Secure MAC地址表项进行老化处理了。

【举例】

# 配置端口安全模式为autolearn,端口允许接入的最大MAC地址数为4,端口自动学习到的Secure MAC地址的老化时间为10分钟。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security timer autolearn 10  

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] port-security max-mac-count 4 

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

1.1.13  port-security timer disableport

【命令】

port-security timer disableport timer

undo port-security timer disableport

【视图】

系统视图

【参数】

timer:单位为秒,取值范围为20~300。

【描述】

port-security timer disableport命令用来设置系统暂时断开端口连接的时间。undo port-security timer disableport命令用来恢复缺省情况。

缺省情况下,系统暂时断开端口连接的时间为20秒。

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

 

相关命令可以参考port-security intrusion-mode

【举例】

# 设置端口GigabitEthernet1/0/1的Intrusion Protection特性为disableport-temporarily,当Intrusion Protection特性被触发后,暂时断开端口连接,经过30秒之后再启用端口。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security timer disableport 30

[Sysname] interface gigabitethernet 1/0/1

[Sysname-GigabitEthernet1/0/1] port-security intrusion-mode disableport-temporarily

1.1.14  port-security timer guest-vlan-reauth

【命令】

port-security timer guest-vlan-reauth interval

undo port-security timer guest-vlan-reauth

【视图】

系统视图

【参数】

interval:单位为秒,取值范围为1~3600。

【描述】

port-security timer guest-vlan-reauth命令用来配置在端口加入Guest VLAN后,交换机触发MAC地址认证的周期。

undo port-security timer guest-vlan-reauth命令用来恢复缺省情况。

缺省情况下,交换机触发MAC认证的周期为30秒。

交换机每隔一定时间自动利用该端口下学习到的Guest VLAN内的首个MAC地址触发MAC地址认证,如果认证成功,端口会离开Guest VLAN。

【举例】

# 配置交换机触发MAC地址认证的周期为60秒。

<Sysname> system-view

[Sysname] port-security timer guest-vlan-reauth 60

1.1.15  port-security trap

【命令】

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

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

【视图】

系统视图

【参数】

addresslearned:端口学习到新的MAC地址的Trap信息。

dot1xlogfailure:802.1x认证失败的Trap信息。

dot1xlogoff:802.1x认证用户下线的Trap信息。

dot1xlogon:802.1x认证成功上线的Trap信息。

intrusion:发现入侵报文的Trap信息。

ralmlogfailure:MAC地址认证失败的Trap信息。

ralmlogoff:MAC地址认证用户下线的Trap信息。

ralmlogon:MAC地址认证成功上线的Trap信息。

RALM(RADIUS Authenticated Login using MAC-address)是指基于MAC地址的RADIUS认证。

 

【描述】

port-security trap命令用来打开指定Trap信息的发送开关。undo port-security trap命令用来关闭指定Trap信息的发送开关。

缺省情况下,Trap信息的发送开关处于关闭状态。

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

 

当使用display port-security查看全局信息时,系统将显示哪些Trap信息发送开关已经打开。

相关命令可以参考display port-security

【举例】

# 打开发现入侵报文的Trap信息发送开关。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] port-security trap intrusion

# 通过display port-security查看相关的配置信息。

<Sysname> display port-security

 Equipment port-security is enabled

 Intrusion trap is Enabled

 Disableport Timeout: 20 s

 OUI value:

 GigabitEthernet1/0/1 is link-down

   Port mode is AutoLearn

   NeedtoKnow mode is needtoknowonly

   Intrusion mode is disableportTemporarily

   Max mac-address num is 4

   Stored mac-address num is 0

   Authorization is ignore

<略>

以上显示信息的解释请参见表1-2

 


2 端口绑定命令

2.1  端口绑定命令

2.1.1  am user-bind

【命令】

系统视图下:

am user-bind mac-addr mac-address ip-addr ip-address interface interface-type interface-number

undo am user-bind mac-addr mac-address ip-addr ip-address interface interface-type interface-number

以太网端口视图下:

am user-bind mac-addr mac-address ip-addr ip-address

undo am user-bind mac-addr mac-address ip-addr ip-address

【视图】

系统视图/以太网端口视图

【参数】

interface interface-type interface-number:指定绑定的端口。其中interface-type interface-number表示端口类型和端口编号。

ip-addr ip-address:指定需要绑定的IP地址。其中ip-address表示绑定的IP地址。

mac-addr mac-address:指定需要绑定的MAC地址。其中mac-address表示绑定的MAC地址,格式为H-H-H。

【描述】

am user-bind命令用来将用户的MAC地址和IP地址绑定到指定的端口上。undo am user-bind命令用来取消MAC地址和IP地址与指定端口的绑定。

进行绑定操作后,交换机只对从该端口收到的指定MAC地址和IP地址的用户发出的报文进行转发。

缺省情况下,未将用户的MAC地址和IP地址绑定到指定端口上。

对同一个MAC地址和IP地址,系统只允许在端口上进行一次绑定操作。

【举例】

# 在系统视图下将MAC地址为000f-e200-5101,IP地址为10.153.1.1的合法用户与端口GigabitEthernet1/0/1进行绑定。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] am user-bind mac-addr 000f-e200-5101 ip-addr 10.153.1.1 interface GigabitEthernet1/0/1

# 在端口视图下将MAC地址为000f-e200-5102,IP地址为10.153.1.2的合法用户与端口GigabitEthernet1/0/2进行绑定。

<Sysname> system-view

System View: return to User View with Ctrl+Z.

[Sysname] interface GigabitEthernet1/0/2

[Sysname-GigabitEthernet1/0/2] am user-bind mac-addr 000f-e200-5102 ip-addr 10.153.1.2

2.1.2  display am user-bind

【命令】

display am user-bind [ interface interface-type interface-number | ip-addr ip-address | mac-addr mac-address ]

【视图】

任意视图

【参数】

interface interface-type interface-number:显示指定端口的绑定信息。其中interface-type interface-number表示端口类型和端口编号。

ip-addr ip-address:显示指定IP地址的绑定信息。其中ip-address表示绑定的IP地址。

mac-addr mac-address:显示指定MAC地址的绑定信息。其中mac-address表示绑定的MAC地址,格式为H-H-H。

【描述】

display am user-bind命令用来显示端口绑定的配置信息。

需要注意的是,如果不指定任何参数,则显示所有端口绑定的配置信息。

相关配置可参考命令am user-bind

【举例】

# 显示当前所有端口绑定的配置信息。

<Sysname> display am user-bind

Following User address bind have been configured:

  Mac                   IP                    Port

  000f-e200-5101        10.153.1.1            GigabitEthernet1/0/1

  000f-e200-5102        10.153.1.2            GigabitEthernet1/0/2

 Unit 1:Total 2 found, 2 listed.

 

 Total: 2 found.

以上显示信息表示,设备Unit 1当前总共有两条端口绑定的配置:

l              MAC地址000f-e200-5101、IP地址10.153.1.1已经与端口GigabitEthernet1/0/1进行了绑定;

l              MAC地址000f-e200-5102、IP地址10.153.1.2已经与端口GigabitEthernet1/0/2进行了绑定。

 

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

新华三官网
联系我们