【参考】switchport port-security aging端口地址老化配置

2013-05-08 16:44:15|  分类: 网络技术 |  标签: |举报 |字号大中小 订阅

在某些应用场景下,需要对交换机下联地址做控制,比如:控制下联接口主机数量。但如果下联主机的二层地址是变动的——今天来五个人,明天走了,后天又来五个,该怎么办?针对这种场景需要在交换机port-security 功能的基础上,启用“port-security aging ”功能。

其命令格式为:

switchport port-security aging {static | time time | type {absolute | inactivity}}
no switchport port-security aging {static | time | type}

在实际环境中,做了如下配置:

interface FastEthernet0/28
 switchport access vlan 123
 switchport mode access
 switchport port-security maximum 32
 switchport port-security
 switchport port-security aging time 60
 switchport port-security violation restrict
 switchport port-security mac-address sticky
 switchport port-security aging type inactivity
 switchport port-security aging static

switchport port-security mac-address sticky 0021.6b93.feca vlan access
 switchport port-security mac-address sticky 0021.6bc6.fc78 vlan access
 switchport port-security mac-address sticky 0023.4edb.2323 vlan access
 switchport port-security mac-address sticky 0023.7666.4d77 vlan access
 switchport port-security mac-address sticky 0026.c75d.764a vlan access
  spanning-tree portfast
 spanning-tree bpduguard enable

但是发现,sticky学到的这几个地址,始终在 F0/28的配置里。也就是说并没有按照原先以为的“老化”(aging)掉!那是因为 “switchport port-security aging ”命令没有生效嘛?

下面就这个问题展开讨论——

看起来简单,但在具体应用时还是有两个需要注意的地方。

1):“ switchport port-security aging static

端口下配置“switchport port-security aging static”时:

--------------------------------------------------------------------------------------------
  Vlan    Mac Address         Type                              Ports   Remaining Age

(mins)   
  ----      -----------                  ----                              -----   ----------------------
  34    0026.c75d.764a    SecureConfigured       Fa0/28      60 (I)
  34    00f4.b99c.dc71     SecureDynamic            Fa0/28      60 (I)
  34    1c65.9dee.d99b    SecureDynamic              Fa0/28      60 (I)
  34    5891.cf37.2a3f     SecureConfigured           Fa0/28      60 (I)
  34    5891.cf3c.ec5e     SecureDynamic               Fa0/28      60 (I)
  34    5891.cf3c.ec5f      SecureConfigured           Fa0/28      60 (I)
  34    5cf9.dd50.b61e    SecureConfigured           Fa0/28      60 (I)
  34    6894.2335.4fa9    SecureDynamic               Fa0/28      60 (I)
  34    9c2a.701e.2ba3    SecureDynamic              Fa0/28      60 (I)
  34    c014.3ddc.4203    SecureConfigured           Fa0/28      60 (I)
  34    c014.3ddc.6eed    SecureConfigured           Fa0/28      60 (I)
  34    d0c2.82e7.cd64    SecureDynamic              Fa0/28       58 (I)
-------------------------------------------------------------------------------------------

2):端口下不配置“switchport port-security aging static”时( aging static 默认为disable)

------------------------------------------------------------------------------------------
 Vlan    Mac Address       Type                             Ports     Remaining Age
                                                                                                (mins)    
 ----     -----------                ----                                 -----        -------------
  34    0026.c75d.764a    SecureConfigured       Fa0/28       -
  34    00f4.b99c.dc71     SecureDynamic            Fa0/28      59 (I)
  34    1c65.9dee.d99b    SecureDynamic              Fa0/28      60 (I)
  34    5891.cf37.2a3f      SecureConfigured          Fa0/28       -
  34    5891.cf3c.ec5e      SecureDynamic              Fa0/28      60 (I)
  34    5891.cf3c.ec5f       SecureConfigured          Fa0/28       -
  34    5cf9.dd50.b61e     SecureConfigured           Fa0/28       -
  34    6894.2335.4fa9     SecureDynamic               Fa0/28      60 (I)
  34    9c2a.701e.2ba3    SecureDynamic               Fa0/28      60 (I)
  34    c014.3ddc.4203    SecureConfigured           Fa0/28       -
  34    c014.3ddc.6eed    SecureConfigured           Fa0/28       -
  34    d0c2.82e7.cd64    SecureDynamic               Fa0/28      58 (I)
------------------------------------------------------------------------------------------

通过上面的举例不难看出"switchport port-security aging static"命令影响到的是"switchport port-security aging time "的作用范围。即port-security 老化时间是对SecureDynamic地址和 SecureConfigured 地址都生效还是只针对SecureDynamic地址生效。那么,如果配置no switchport port-security aging time时,自然会想到如下的状态结果:

--------------------------------------------------------------------------------------------------
  Vlan    Mac Address          Type                              Ports        Remaining Age

(mins)   
  ----      -----------                 ----                                 -----        --------------
  34       0026.c75d.764a    SecureConfigured          Fa0/28         -
  34       00f4.b99c.dc71     SecureDynamic            Fa0/28         -
  34       1c65.9dee.d99b    SecureDynamic            Fa0/28         -
  34       5891.cf37.2a3f      SecureConfigured          Fa0/28         -
  34       5891.cf3c.ec5e     SecureDynamic            Fa0/28         -
  34       5891.cf3c.ec5f      SecureConfigured          Fa0/28          -
  34       5cf9.dd50.b61e     SecureConfigured          Fa0/28         -
  34       6894.2335.4fa9     SecureDynamic            Fa0/28         -
  34       9c2a.701e.2ba3    SecureDynamic            Fa0/28         -
  34       c014.3ddc.4203    SecureConfigured          Fa0/28         -
  34       c014.3ddc.6eed    SecureConfigured          Fa0/28         -
  34       d0c2.82e7.cd64    SecureDynamic            Fa0/28         -
-------------------------------------------------------------------------------------------

这些现象本质上是"switchport port-security aging static"与"switchport port-security aging time "共同影响的结果。

最后,再回到开头提到的那个问题上!为什么配置了“switchport port-security mac-address sticky H.H.H vlan access” 反而不会被“ switchport port-security aging static”老化掉?

回顾一下“switchport port-security mac-address sticky”命令产生的背景——将交换机动态学习到的主机条目转化为静态主机条目,从而减轻管理员人工输入“switchport port-security mac-address H.H.H”的工作量。

为了验证"switchport port-security aging *”命令对“switchport port-security mac-address sticky”命令的影响,在交换机端口下做了如下配置:

switchport port-security maximum 12
 switchport port-security
 switchport port-security aging time 2
 switchport port-security violation restrict
 switchport port-security aging type inactivity
 switchport port-security mac-address sticky

交换机动态地学习到一个MAC,生成“switchport port-security mac-address sticky 5891.cf3c.ec5e vlan access”的条目,并把它放进port-security maximum地址池中。此时通过“sh port-security address ”查看端口port-security 地址列表:

可以看出,5891.cf3c.ec5e 这一通过“switchport port-security mac-address sticky”方式学到的地址没有像“SecureDynamic ”方式的学到的MAC地址那样老化!

又在上面配置基础上增加“sw port-security aging static”配置,现在的配置为:
 switchport port-security maximum 12
 switchport port-security
 switchport port-security aging time 2
 switchport port-security violation restrict
 switchport port-security aging type inactivity
 switchport port-security mac-address sticky
 switchport port-security aging static

再通过“sh port-security address ”查看端口port-security 地址列表:

可以看出,5891.cf3c.ec5e 这一通过“switchport port-security mac-address sticky”方式学到的地址也没有像“SecureConfigured ”方式的学到的MAC地址那样老化!

最终,可以归纳出一条——"switchport port-security aging static"与"switchport port-security aging time "命令对“switchport port-security mac-address sticky”方式学到的地址不生效!

根据上面分析的几点和port-security的基本功能,归纳出这样几个应用场景和相对应的模板:

1)控制端口下二层主机数量(不区分活动的还是非活动的):

switch port-security

switch port-security max *(数量以端口下主机情况为准)

switchport port-security violation {restrict | shutdown}

注:从安全的角度说,这种配置方式还起到了防止mac 泛洪和mac欺骗***的作用。

2)在1)的基础上,进一步限定具体的主机地址(根据第一次在线情况自动生成配置并保存):

switch port-security

switch port-security max *

switchport port-security violation {restrict | shutdown}

switchport port-security mac-address sticky

3)在1)的基础上,进一步限定具体的主机地址(人工手动设置):

switch port-security

switch port-security max *

switchport port-security violation {restrict | shutdown}

switchport port-security mac-address H.H.H

4)在1)的基础上,区分活动的主机(一定时间周期内不活动的主机被淘汰):

switch port-security

switch port-security max *

switchport port-security violation {restrict | shutdown}

switchport port-security aging time * (时间值根据环境设定,范围为1——1440,单位“分钟”)

switchport port-security aging  type {absolute | inactivity}  (老化时间的计时方式可选)

5)在3)的基础上,除了限定具体主机地址外,还希望通过检测主机活动情况“动态”地刷新这个“限定的主机”列表:

switch port-security

switch port-security max *

switchport port-security violation {restrict | shutdown}

switchport port-security mac-address H.H.H (限定具体主机地址)

switchport port-security aging time *

switchport port-security aging type {absolute | inactivity}

switchport port-security aging static

讨论到这里,开头提及的场景中的配置就确定了——使用配置模板4)的配置即可。之所以开头那段配置没有达到预期效果,是因为自己对命令"switchport port-security aging static"望文生义了!

————————————————————————————————————————————————

参考原文地址:http://www.zhanggy.com/blog/switchport-port-security%E5%91%BD%E4%BB%A4%E8%A7%A3%E9%87%8A

Use the switchport port-security aging interface configuration command to set the aging time and type for secure address entries or to change the aging behavior for secure addresses on a particular port. Use the no form of this command to disable port security aging or to set the parameters to their default states.
switchport port-security aging {static | time time | type {absolute | inactivity}}
no switchport port-security aging {static | time | type}
Syntax Description

static Enable aging for statically configured secure addresses on this port.
time Specify the aging time for this port. The range is 0 to 1440 minutes. If the time is 0, aging is disabled for this port.
type Set the aging type.
absolute Set absolute aging type. All the secure addresses on this port age out exactly after the time (minutes) specified and are removed from the secure address list.
inactivity Set the inactivity aging type. The secure addresses on this port age out only if there is no data traffic from the secure source address for the specified time period.

Defaults The port security aging feature is disabled. The default static aging behavior is disabled.

The default time is 0 minutes.
The default aging type is absolute.

Usage Guidelines To enable secure address aging for a particular port, set the aging time to a value other than 0 for that port.

To allow limited time access to particular secure addresses, set the aging type as absolute. When the aging time lapses, the secure addresses are deleted.
To allow continuous access to a limited number of secure addresses, set the aging type as inactivity. This removes the secure address when it become inactive, and other addresses can become secure.
To allow unlimited access to a secure address, configure it as a secure address, and disable aging for the statically configured secure address by using the no switchport port-security aging static interface configuration command.

转载于:https://blog.51cto.com/oppoa10000k/1582601

switchport port-security aging相关推荐

  1. Port Security:没有绝对安全的系统

      这篇文章是我一个月之前在我的公众号上发布的,故图片带有水印,个人公众号名称即水印名称 这篇我们主要Port Security在实际中的应用,基于这个前提,我们首先要了解,什么是IP地址欺骗: IP ...

  2. port security violation protect retrict shutdown 之具体解释

    2007-07-30 12:32 可以通过 port-security 来限制端口所接PC个数 但对具体超出限制的行为应采取什么动作呢? 可以通过命令port-security   violation ...

  3. 浙江师范大学网络改造总结(博达交换机网络安全防御技术应用)

                    浙江师范大学网络改造总结(博达交换机网络安全防御技术应用)                                                        ...

  4. 网络安全 - Harden CISCO Devices

    Introduction 介绍 This document lists all the option that is recommended to help you secure your CISCO ...

  5. 中兴zxr10路由器重启命令_中兴交换机常用命令

    中兴交换机配置命令 ZTE交换机配置常用命令汇总 命令的使用要注意各种用户模式. 配成普通交换机:把2-24端口归到VLAN1下,2-24端口如果互相隔离,可以用PVLAN删除隔离端口即可. 2852 ...

  6. 实战演练!CISCO交换机端口安全一点通 (

    http://net.itwaka.com/ 对于很多的企业网络管理人员来说,交换机自然是最常打交道的设备.那么,你对交换机到底了解多少呢?下面我们就通过一个实例,先来探讨一下对于交换机端口配置和接入 ...

  7. cisco交换机MAC/CAW***防范

    一.前言 本文所提到的***和欺骗行为主要针对链路层和网络层.在网络实际环境中,其来源可概括为两个途径:人为实施:病毒或蠕虫.人为实施通常是指使用一些***的工具对网络进行扫描和嗅探,获取管理帐户和相 ...

  8. 史上最详细全中文 Cisco 3560交换机使用手册

    史上最详细全中文 Cisco 3560交换机使用手册 (末尾送交换机安全技术) 目 录 CISCO Catalyst 3560-E系列交换机的功能应用及安全解决方案 3 一.Cisco? Cataly ...

  9. 最全Cisco 3560交换机使用手册

                                                                       目   录 CISCO Catalyst 3560-E系列交换机的 ...

最新文章

  1. 赠书 | 新手指南——如何通过HuggingFace Transformer整合表格数据
  2. python中列表数据汇总和平均值_对数据进行分类,计算每个类别的平均值和标准差...
  3. GIT项目管理工具(part3)--初始化仓库及查看仓库状况
  4. 在线编辑_水墨-在线 Markdown 编辑器
  5. 基于JAVA+SpringMVC+Mybatis+MYSQL的旅游景点门票售票管理系统
  6. POJ 3734 Blocks 矩阵递推
  7. 项目解析jsx文件_React 基础:JSX 扩展语法
  8. 算数运算符与关系运算符_Swift进阶三——运算符相关
  9. [swift] LeetCode 169. Majority Element
  10. dedeCms在首页显示要搜索的关键词
  11. python随机数据库_关于Python的随机数模块,你必须要掌握!-后台/架构/数据库-敏捷大拇指-一个敢保留真话的IT精英社区...
  12. SQL Sever — 建表语句,设置种子数量与增量以及设置主键 代码
  13. php获取字段中的第几个数字_php提取字符串中的数字
  14. WPF 一个简单的颜色选择器
  15. 看着夜晚城市的广告都是用CorelDRAW发光字体效果很感叹
  16. 深度学习与ArcGIS概述(1)
  17. Tensorflow1.7+cuda9.0+cudnn7.0中的各种意(da)外(keng)
  18. 【python】OCR
  19. 苹果开发者账号可以创建多少测试证书_苹果开发者账号对应生成的证书都有哪些...
  20. unity中碰撞检测方法

热门文章

  1. c语言编程题蓄水池,C语言中蓄水池抽样
  2. 珞珈-B生所学 跟学笔记 PPT(一)
  3. Appium移动端自动化测试--搭建模拟器和真机环境一
  4. C/C++ 点和箭头操作符的区别
  5. HBM(高带宽内存)、GDDR SDRAM(图形双倍速率同步动态随机存储器)
  6. 多核 CPU 和多个 CPU 有何区别?
  7. 国务院智囊建议全面放开二胎:越晚越被动
  8. LTE连接态读取系统消息SIB24疑问
  9. 详细讲解BM字符串搜索算法
  10. 速度来看mac电脑怎么彻底关闭系统更新