首页 > 其他分享 >思科交换机的密码策略与端口安全设置

思科交换机的密码策略与端口安全设置

时间:2023-03-05 22:22:45浏览次数:53  
标签:思科 switchport 端口 地址 Switch 交换机 security config port

#所有password用思科私有方式加密 系统密码作为可逆密文存储在配置中
conf t service password-encryption

交换机的端口安全-port-security的概念

port-security的功能:

1. 通过对限制接口的最大mac数量从而限制接入的主机用户 

2. 限定接口所连接的特定MAC,从而实现接入用户的限制 

依据: 通过安全地址判断-security MAC address

port-security 安全地址 secure mac address

当我们将接口允许的MAC地址数量设置为1并且为接口设置一个安全地址,那么这个接口将只为该MAC所属的PC服务,也就是源为该MAC的数据帧能够进入该接口

惩罚激活模式 violation

   当一个激活了Port-Security的接口上,MAC地址数量已经达到了配置的最大安全地址数量,并且又收到了一个新的数据帧,而这个数据帧的源MAC并不在这些安全地址中,那么启动惩罚措施    当在一个Port-Security接口上配置了某个安全地址,而这个安全地址的MAC又企图在同VLAN的另一个Port-Security接口上接入时,启动惩罚措施

port-security 和sticky mac

  通过接口动态学习的MAC地址构成的安全地址表项,在接口出现up/down后,将会丢失这些通过动态学习到的MAC构成的安全地址表项,但是所有的接口都用switchport port-security mac-address手工来配置,工作量又太大。因此这个sticky mac地址,可以让我们将这些动态学习到的MAC变成“粘滞状态”,可以简单的理解为,我先动态的学,学到之后我再将你粘起来,形成一条”静态“ (实际上是SecureSticky)的表项。    在up/down现象出现后仍能保存。而在使用wr后,这些sticky安全地址将被写入start-up config,即使设备重启也不会被丢失

默认的port-security配置

port-security disable

默认的最大允许安全MAC地址数量 1

惩罚模式   shutdown (进入err-disable状态)  #除了shutdown模式还有protect和restrict模式

port-security配置步骤

1. 进入接口激活port-security

2. 配置每个接口的安全地址(secure mac address)

3. 配置port-security惩罚机制  shutdown | protect | restrict 

4. (选做) 配置安全地址老化时间

port-security配置

1. 激活port-security(access口)
 1 Switch(config)#int f0/1
 2 Switch(config-if)#switchport mode access
 3 Switch(config-if)#switchport access vlan 10
 4 % Access VLAN does not exist. Creating vlan 10
 5 Switch(config-if)#exit
 6 Switch(config)#vlan 10
 7 Switch(config-vlan)#exit
 8 Switch(config)#vlan 20
 9 Switch(config-vlan)#exit
10 Switch(config)#switch access vlan 10 
11                 ^
12 % Invalid input detected at '^' marker.
13     
14 Switch(config)#int f0/1
15 Switch(config-if)#switchport access vlan 10
16 Switch(config-if)#switch port-security
17 Switch(config-if)#do sh port-security int f0/1 #查看接口的port-security状态
18 Port Security              : Enabled
19 Port Status                : Secure-up  
20 Violation Mode             : Shutdown    #违反策略的惩罚措施 
21 Aging Time                 : 0 mins     
22 Aging Type                 : Absolute
23 SecureStatic Address Aging : Disabled
24 Maximum MAC Addresses      : 1        #最大的安全地址个数 默认为1
25 Total MAC Addresses        : 0
26 Configured MAC Addresses   : 0        #手工静态配置的安全mac地址
27 Sticky MAC Addresses       : 0        #sticky的安全地址
28 Last Source Address:Vlan   : 0000.0000.0000:0 #最近的一个安全地址+vlan
29 Security Violation Count   : 0        #接口历史上出现过的违例次数
2. port-security的惩罚措施
1 Switch(config-if)#int f0/1
2 Switch(config-if)#switchport port-security violation restrict

protect :仅丢弃非法数据帧

restrict 丢弃非法数据帧同时产生一个syslog消息

shutdown 端口设置成err-disable,接口不可用 同时产生要给syslog消息

3.配置port-security最大允许的安全地址数量
Switch(config-if)#switchport port-security ?
  aging        Port-security aging commands  #老化时间
  mac-address  Secure mac address        #安全mac地址
  maximum      Max secure addresses       # 最大安全地址数量
  violation    Security violation mode     #惩罚措施

Switch(config-if)#switchport port-security maximum 1
4.配置port-security接口手工配置安全地址
 1 Switch(config-if)#int f0/1
 2 Switch(config-if)#switchport mode access
 3 Switch(config-if)#switchport access vlan 10
 4 Switch(config-if)#switc
 5 Switch(config-if)#switchport port-se
 6 Switch(config-if)#switchport port-security maxim
 7 Switch(config-if)#switchport port-security maximum 2
 8 Switch(config-if)#switchport prot
 9 Switch(config-if)#switchport port
10 Switch(config-if)#switchport port-security ?
11   aging        Port-security aging commands
12   mac-address  Secure mac address
13   maximum      Max secure addresses
14   violation    Security violation mode
15   <cr>
18 Switch(config-if)#switchport port-security mac-address xx
最大安全地址数设置为2,然后使用手工配置了一个安全地址,那么剩下1个,交换机可以通过动态学习的方式来构建安全地址。
5.port-security接口使用sticky mac地址
1 Switch(config-if)#int f0/1
2 Switch(config-if)#switchport mode access
3 Switch(config-if)#switchport access vlan 10
4 Switch(config-if)#switchport port-security maximum 2
5 Switch(config-if)#switchport port-security mac-address sticky 

Switch(config-if)#do sh mac-address-table

Mac Address Table

-------------------------------------------

Vlan Mac Address Type Ports

---- ----------- -------- -----

10 0006.2ae9.575e STATIC Fa0/1

Switch(config-if)#switchport port-security mac-address sticky 0006.2ae9.575e

Found duplicate mac-address 0006.2ae9.575e.

标签:思科,switchport,端口,地址,Switch,交换机,security,config,port
From: https://www.cnblogs.com/lisenMiller/p/17177137.html

相关文章

  • 华为交换机开机配置(一)
    默认情况下,通过Console口登录无密码,任何人都可以直接连接到设备,进行配置。为了避免由此带来的风险,可以将Console接口登录方式配置为密码认证方式,密码为明文形式的“hua......
  • 使用Python开发端口扫描检测工具
    fromsocketimport*importtimestartTime=time.time()target=input('需要扫描的主机:')t_IP=gethostbyname(target)print('开始扫描主机:',t_IP)......
  • 端口占用问题查看及解决
    端口占用问题查看及解决方法一:通过cmd处理打开cmd输入命令netstat可以查看活动连接:继续输入cmd命令查看占用端口的进程号:netstat-ano|findstr8080从图......
  • nginx中多ip多域名多端口配置
    1、Nginx中多IP配置:server{listen80;server_name192.168.15.7;location/{root/opt/Super_Marie;indexindex.html;}}server......
  • linux修改ssh默认端口
    1.登录服务器,打开sshd_config文件vim/etc/ssh/sshd_config2.找到#Port22,默认是注释掉的,先把前面的#号去掉,再插入一行设置成你想要的端口号,注意不要跟现有端口号......
  • H3C Switch通过IP确定端口
    在Coreswitch上查看IP所对应的MAC地址disarp10.20.2.125根据MAC地址确定端口所连接的二层交换机为10.20.1.202disarp|include GigabitEthernet1/1/2到二层交换机10.......
  • 修改远程桌面连接的默认端口号
    我们都知道,远程桌面连接的默认端口号为3389,很多时候我们都需要修改该默认端口号,不然时常会被一些别有用心的人利用(如:暴力力破解账号密码登录到服务器)。1、......
  • 思科vlan简单配置
    实验拓扑 实验目标:2台交换机,4台pc,分别处于10,20vlan中可以跨交换机相互通信tips:vlan是2层技术可以配置在交换机上实验ipPC210.1.1.2/24PC110.1.1.1/24PC6......
  • 国标 华为交换机 RTCP抓包过程记录
    场景雄安项目从下级推送UDP音视频数据流到上级,排查过程中,发现RTCP控制数据丢失了排查过程1确定本地服务器已经发送出去抓包2直连交换机抓包有接收抓包指令capture-packet ......
  • prometheus 监控华为交换机
    一、环境交换机:huaweiS5735prometheus:使用docker镜像,监听9090端口granfana:使用docker镜像,监听3000端口(华为交换机使用11169模板)snmp-exporter:​​https://g......