草庐IT

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

lisenMiller 2023-03-28 原文
#所有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配置

tips:f0/1 is a dynamic port 

dynamic port不能启用Port Security,只有静态接入端口或中继端口才行。需要将模式切换为access。动态端口是自动识别的,既可以为access,也可以为trunk,所以要设为access模式。

Switch(config-if)#switchport mode access
Switch(config-if)#switchport 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
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 
思科交换机spancolorstyle网络安全

有关思科交换机的密码策略与端口安全设置的更多相关文章

  1. ruby - 使用 RubyZip 生成 ZIP 文件时设置压缩级别 - 2

    我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看ruby​​zip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d

  2. ruby-openid:执行发现时未设置@socket - 2

    我在使用omniauth/openid时遇到了一些麻烦。在尝试进行身份验证时,我在日志中发现了这一点:OpenID::FetchingError:Errorfetchinghttps://www.google.com/accounts/o8/.well-known/host-meta?hd=profiles.google.com%2Fmy_username:undefinedmethod`io'fornil:NilClass重要的是undefinedmethodio'fornil:NilClass来自openid/fetchers.rb,在下面的代码片段中:moduleNetclass

  3. ruby-on-rails - 如何使用 instance_variable_set 正确设置实例变量? - 2

    我正在查看instance_variable_set的文档并看到给出的示例代码是这样做的:obj.instance_variable_set(:@instnc_var,"valuefortheinstancevariable")然后允许您在类的任何实例方法中以@instnc_var的形式访问该变量。我想知道为什么在@instnc_var之前需要一个冒号:。冒号有什么作用? 最佳答案 我的第一直觉是告诉你不要使用instance_variable_set除非你真的知道你用它做什么。它本质上是一种元编程工具或绕过实例变量可见性的黑客攻击

  4. ruby - 如何使用 Ruby aws/s3 Gem 生成安全 URL 以从 s3 下载文件 - 2

    我正在编写一个小脚本来定位aws存储桶中的特定文件,并创建一个临时验证的url以发送给同事。(理想情况下,这将创建类似于在控制台上右键单击存储桶中的文件并复制链接地址的结果)。我研究过回形针,它似乎不符合这个标准,但我可能只是不知道它的全部功能。我尝试了以下方法:defauthenticated_url(file_name,bucket)AWS::S3::S3Object.url_for(file_name,bucket,:secure=>true,:expires=>20*60)end产生这种类型的结果:...-1.amazonaws.com/file_path/file.zip.A

  5. ruby-on-rails - date_field_tag,如何设置默认日期? [ rails 上的 ruby ] - 2

    我想设置一个默认日期,例如实际日期,我该如何设置?还有如何在组合框中设置默认值顺便问一下,date_field_tag和date_field之间有什么区别? 最佳答案 试试这个:将默认日期作为第二个参数传递。youcorrectlysetthedefaultvalueofcomboboxasshowninyourquestion. 关于ruby-on-rails-date_field_tag,如何设置默认日期?[rails上的ruby],我们在StackOverflow上找到一个类似的问

  6. ruby-on-rails - 在 Rails 开发环境中为 .ogv 文件设置 Mime 类型 - 2

    我正在玩HTML5视频并且在ERB中有以下片段:mp4视频从在我的开发环境中运行的服务器很好地流式传输到chrome。然而firefox显示带有海报图像的视频播放器,但带有一个大X。问题似乎是mongrel不确定ogv扩展的mime类型,并且只返回text/plain,如curl所示:$curl-Ihttp://0.0.0.0:3000/pr6.ogvHTTP/1.1200OKConnection:closeDate:Mon,19Apr201012:33:50GMTLast-Modified:Sun,18Apr201012:46:07GMTContent-Type:text/plain

  7. ruby - 如何安全地删除文件? - 2

    在Ruby中是否有Gem或安全删除文件的方法?我想避免系统上可能不存在的外部程序。“安全删除”指的是覆盖文件内容。 最佳答案 如果您使用的是*nix,一个很好的方法是使用exec/open3/open4调用shred:`shred-fxuz#{filename}`http://www.gnu.org/s/coreutils/manual/html_node/shred-invocation.html检查这个类似的帖子:Writingafileshredderinpythonorruby?

  8. ruby-on-rails - 有没有办法为 CarrierWave/Fog 设置上传进度指示器? - 2

    我在Rails应用程序中使用CarrierWave/Fog将视频上传到AmazonS3。有没有办法判断上传的进度,让我可以显示上传进度如何? 最佳答案 CarrierWave和Fog本身没有这种功能;你需要一个前端uploader来显示进度。当我不得不解决这个问题时,我使用了jQueryfileupload因为我的堆栈中已经有jQuery。甚至还有apostonCarrierWaveintegration因此您只需按照那里的说明操作即可获得适用于您的应用的进度条。 关于ruby-on-r

  9. ruby - 用 YAML.load 解析 json 安全吗? - 2

    我正在使用ruby2.1.0我有一个json文件。例如:test.json{"item":[{"apple":1},{"banana":2}]}用YAML.load加载这个文件安全吗?YAML.load(File.read('test.json'))我正在尝试加载一个json或yaml格式的文件。 最佳答案 YAML可以加载JSONYAML.load('{"something":"test","other":4}')=>{"something"=>"test","other"=>4}JSON将无法加载YAML。JSON.load("

  10. objective-c - 在设置 Cocoa Pods 和安装 Ruby 更新时出错 - 2

    我正在尝试为我的iOS应用程序设置cocoapods但是当我执行命令时:sudogemupdate--system我收到错误消息:当前已安装最新版本。中止。当我进入cocoapods的下一步时:sudogeminstallcocoapods我在MacOS10.8.5上遇到错误:ERROR:Errorinstallingcocoapods:cocoapods-trunkrequiresRubyversion>=2.0.0.我在MacOS10.9.4上尝试了同样的操作,但出现错误:ERROR:Couldnotfindavalidgem'cocoapods'(>=0),hereiswhy:U

随机推荐