當前位置:編程學習大全網 - 編程語言 - cisco交換機安全配置設定命令

cisco交換機安全配置設定命令

cisco交換機安全配置設定命令大全

 思科交換機的安全怎麽設置,下面為大家分交換機安全設置的配置命令,希望對同學們學習思科交換機有所幫助!

 壹、交換機訪問控制安全配置

 1、對交換機特權模式設置密碼盡量采用加密和md5 hash方式

 switch(config)#enable secret 5 pass_string

 其中 0 Specifies an UNENCRYPTED password will follow

 5 Specifies an ENCRYPTED secret will follow

 建議不要采用enable password pass_sting密碼,破解及其容易!

 2、設置對交換機明文密碼自動進行加密隱藏

 switch(config)#service password-encryption

 3、為提高交換機管理的靈活性,建議權限分級管理並建立多用戶

 switch(config)#enable secret level 7 5 pass_string7 /7級用戶進入特權模式的密碼

 switch(config)#enable secret 5 pass_string15 /15級用戶進入特權模式的密碼

 switch(config)#username userA privilege 7 secret 5 pass_userA

 switch(config)#username userB privilege 15 secret 5 pass_userB

 /為7級,15級用戶設置用戶名和密碼,Cisco privilege level分為0-15級,級別越高權限越大

 switch(config)#privilege exec level 7 commands

 /為7級用戶設置可執行的命令,其中commands可以根據分配給用戶的權限自行定義

 4、本地console口訪問安全配置

 switch(config)#line console 0

 switch(config-line)#exec-timeout 5 0 /設置不執行命令操作的超時時間,單位為分鐘和秒

 switch(config-line)#logging synchronous

 /強制對彈出的幹擾日誌信息進行回車換行,使用戶輸入的命令連續可見

 設置登錄console口進行密碼驗證

 方式(1):本地認證

 switch(config-line)#password 7 pass_sting /設置加密密碼

 switch(config-line)#login /啟用登錄驗證

 方式(2):本地AAA認證

 switch(config)#aaa new-model /啟用AAA認證

 switch(config)#aaa authentication login console-in group acsserver local

 enable

 /設置認證列表console-in優先依次為ACS Server,local用戶名和密碼,enable特權密碼

 switch(config)#line console 0

 switch(config-line)# login authentication console-in

 /調用authentication設置的console-in列表

 5、遠程vty訪問控制安全配置

 switch(config)#access-list 18 permit host x.x.x.x

 /設置標準訪問控制列表定義可遠程訪問的PC主機

 switch(config)#aaa authentication login vty-in group acsserver local

 enable

 /設置認證列表vty-in, 優先依次為ACS Server,local用戶名和密碼,enable特權密碼

 switch(config)#aaa authorization commands 7 vty-in group acsserver local

 if-authenticated

 /為7級用戶定義vty-in授權列表,優先依次為ACS Server,local授權

 switch(config)#aaa authorization commands 15 vty-in group acsserver local

 if-authenticated

 /為15級用戶定義vty-in授權列表,優先依次為ACS Server,local授權

 switch(config)#line vty 0 15

 switch(config-line)#access-class 18 in /在線路模式下調用前面定義的標準ACL 18

 switch(config-line)#exec-timeout 5 0 /設置不執行命令操作的超時時間,單位為分鐘和秒

 switch(config-line)#authorization commands 7 vty-in /調用設置的授權列表vty-in

 switch(config-line)#authorization commands 15 vty-in

 switch(config-line)#logging synchronous

 /強制對彈出的幹擾日誌信息進行回車換行,使用戶輸入的命令連續可見

 switch(config-line)#login authentication vty-in

 /調用authentication設置的vty-in列表

 switch(config-line)#transport input ssh

 /有Telnet協議不安全,僅允許通過ssh協議進行遠程登錄管理

 6、AAA安全配置

 switch(config)#aaa group server tacacs+ acsserver /設置AAA服務器組名

 switch(config-sg-tacacs+)#server x.x.x.x /設置AAA服務器組成員服務器ip

 switch(config-sg-tacacs+)#server x.x.x.x

 switch(config-sg-tacacs+)#exit

 switch(config)# tacacs-server key paa_string /設置同tacacs-server服務器通信的密鑰

 二、交換機網絡服務安全配置

 禁用不需要的各種服務協議

 switch(config)#no service pad

 switch(config)#no service finger

 switch(config)#no service tcp-small-servers

 switch(config)#no service udp-small-servers

 switch(config)#no service config

 switch(config)#no service ftp

 switch(config)#no ip http server

 switch(config)#no ip http secure-server

 /關閉http,https遠程web管理服務,默認cisco交換機是啟用的

 三、交換機防攻擊安全加固配置

 MAC Flooding(泛洪)和Spoofing(欺騙)攻擊

 預防方法:有效配置交換機port-security

 STP攻擊

 預防方法:有效配置root guard,bpduguard,bpdufilter

 VLAN,DTP攻擊

 預防方法:設置專用的native vlan;不要的接口shut或將端口模式改為access

 DHCP攻擊

 預防方法:設置dhcp snooping

 ARP攻擊

 預防方法:在啟用dhcp snooping功能下配置DAI和port-security在級聯上層交換機的trunk下

 switch(config)#int gi x/x/x

 switch(config-if)#sw mode trunk

 switch(config-if)#sw trunk encaps dot1q

 switch(config-if)#sw trunk allowed vlan x-x

 switch(config-if)#spanning-tree guard loop

 /啟用環路保護功能,啟用loop guard時自動關閉root guard

 接終端用戶的端口上設定

 switch(config)#int gi x/x/x

 switch(config-if)#spanning-tree portfast

 /在STP中交換機端口有5個狀態:disable、blocking、listening、learning、forwarding,只有處於forwarding狀態的端口才可以發送數據。但需經過從blocking-->listening

 15s,listening-->learning 15s,learning-->forwarding 20s

 ***計50s的時間,啟用portfast後將直接從blocking-->forwarding狀態,這樣大大縮短了等待的時間。

 說明:portfast僅適用於連接終端或服務器的交換機端口,不能在連接交換機的端口上使用!

 switch(config-if)#spanning-tree guard root

 /當壹端口啟用了root

 guard功能後,當它收到了壹個比根網橋優先值更優的.BPDU包,則它會立即阻塞該端口,使之不能形成環路等情況。這個端口特性是動態的,當沒有收到更優的包時,則此端口又會自己變成轉發狀態了。

 switch(config-if)#spanning-tree bpdufilter enable

 /當啟用bpdufilter功能時,該端口將丟棄所有的bpdu包,可能影響網絡拓撲的穩定性並造成網絡環路

 switch(config-if)#spanning-tree bpduguard enable

 /當啟用bpduguard功能的交換機端口接收到bpdu時,會立即將該端口置為error-disabled狀態而無法轉發數據,進而避免了網絡環路!

 註意:同時啟用bpduguard與bpdufilter時,bpdufilter優先級較高,bpduguard將失效!

 廣播、組播風暴控制設定

 switch(config-if)#storm-control broadcast level 10 /設定廣播的閥值為10%

 switch(config-if)#storm-control multicast level 10 /設定組播的閥值為10%

 switch(config-if)#storm-control action shutdown / Shutdown this interface

 if a storm occurs

 or switch(config-if)#storm-control action trap / Send SNMP trap if a storm

  • 上一篇:中學計算機編程
  • 下一篇:qtcreator裏邊能不能像vs壹樣設置"使用多字節字符集
  • copyright 2024編程學習大全網