詳談DHCP SNOOP等多方面的安全設置
我們知道DHCP協議,管理網絡IP的協議。在其服務器的應用中,我們也通常遇到有關的管理知識。那么對于網絡安全方面,DHCP有著更多值得注意的地方。那么今天我們就來講解一下交換機安全 802.1X、port-security、DHCP SNOOP、DAI、VACL、SPAN RSPAN的內容。
交換機安全 802.1X、port-security、DHCP SNOOP、DAI、VACL、SPAN RSPAN
端口和MAC綁定:port-security
基于DHCP的端口和IP,MAC綁定:ip source guard
基于DHCP的防止ARP攻擊:DAI
防止DHCP攻擊:DHCP Snooping
cisco所有局域網緩解技術都在這里了!
常用的方式:
802.1X,端口認證,dot1x,也稱為IBNS(注:IBNS包括port-security):基于身份的網絡安全; 很多名字,有些煩.當流量來到某個端口,需要和ACS交互,認證之后得到授權,才可以訪問網絡,前提是CLIENT必須支持802.1X方式,如安裝某個軟件
Extensible Authentication Protocol Over Lan(EAPOL) 使用這個協議來傳遞認證授權信息
示例配置:
- Router#configure terminal
- Router(config)#aaa new-model
- Router(config)#aaa authentication dot1x default group radius
- Switch(config)#radius-server host 10.200.200.1 auth-port 1633 key radkey
- Router(config)#dot1x system-auth-control 起用DOT1X功能
- Router(config)#interface fa0/0
- Router(config-if)#dot1x port-control auto
AUTO是常用的方式,正常的通過認證和授權過程
強制授權方式:不通過認證,總是可用狀態
強制不授權方式:實質上類似關閉了該接口,總是不可用
可選配置:
- Switch(config)#interface fa0/3
- Switch(config-if)#dot1x reauthentication
- Switch(config-if)#dot1x timeout reauth-period 7200
2小時后重新認證
- Switch#dot1x re-authenticate interface fa0/3
現在重新認證,注意:如果會話已經建立,此方式不斷開會話
- Switch#dot1x initialize interface fa0/3
初始化認證,此時斷開會話
- Switch(config)#interface fa0/3
- Switch(config-if)#dot1x timeout quiet-period 45
45秒之后才能發起下一次認證請求
- Switch(config)#interface fa0/3
- Switch(config-if)#dot1x timeout tx-period 90 默認是30S
- Switch(config-if)#dot1x max-req count 4
客戶端需要輸入認證信息,通過該端口應答AAA服務器,如果交換機沒有收到用戶的這個信息,交換機發給客戶端的重傳信息,30S發一次,共4次
- Switch#configure terminal
- Switch(config)#interface fastethernet0/3
- Switch(config-if)#dot1x port-control auto
- Switch(config-if)#dot1x host-mode multi-host
默認是一個主機,當使用多個主機模式,必須使用AUTO方式授權,當一個主機成功授權,其他主機都可以訪問網絡;
當授權失敗,例如重認證失敗或LOG OFF,所有主機都不可以使用該端口
- Switch#configure terminal
- Switch(config)#dot1x guest-vlan supplicant
- Switch(config)#interface fa0/3
- Switch(config-if)#dot1x guest-vlan 2
未得到授權的進入VLAN2,提供了靈活性#p#
注意:
1、VLAN2必須是在本交換機激活的,計劃分配給游客使用;2?VLAN2信息不會被VTP傳遞出去
- Switch(config)#interface fa0/3
- Switch(config-if)#dot1x default
回到默認設置
- show dot1x [all] | [interface interface-id] | [statistics interface interface-id] [{ | begin | exclude | include} expression]
- Switch#sho dot1x all
- Dot1x Info for interface FastEthernet0/3
- ----------------------------------------------------
- Supplicant MAC 0040.4513.075b
- AuthSM State = AUTHENTICATED
- BendSM State = IDLE
- PortStatus = AUTHORIZED
- MaxReq = 2
- HostMode = Single
- Port Control = Auto
- QuietPeriod = 60 Seconds
- Re-authentication = Enabled
- ReAuthPeriod = 120 Seconds
- ServerTimeout = 30 Seconds
- SuppTimeout = 30 Seconds
- TxPeriod = 30 Seconds
- Guest-Vlan = 0debug dot1x {errors | events | packets | registry | state-machine | all}
2、端口安全,解決CAM表溢出攻擊(有種MACOF的工具,每分鐘可以產生155000個MAC地址,去轟擊CAM表,從而使合法主機的要求都必須被FLOOD)
示例配置:
- Switch#configure terminal
- Switch(config)#interface fastethernet0/0
- Switch(config-if)#switchport mode access
- Switch(config-if)#switchport port-security
- Switch(config-if)#switchport port-security maximum 20 這里默認是1
- Switch(config-if)#switchport port-security mac-address sticky
保存學習到的地址到RUN CONFIG文件中,避免手動配置的麻煩,并省去動態學習所消耗的資源
- switchport port-security violation {protect | restrict | shutdown}
三個參數解釋:
保護:當達到某個設定的MAC數量,后來的未知MAC不再解析,直接丟棄,且不產生通知
限制:當達到某個設定的MAC數量,后來的未知MAC不再解析,直接丟棄,產生通知,如SNMP TRAP?SYSLOG信息,并增加違反記數;這里有個問題,惡意攻擊會產生大量的類似信息,給網絡帶來不利.
關閉:當達到某個設定的MAC數量,后來的未知MAC不再解析,直接關閉該端口,除非手動開啟,或改變端口安全策略
端口安全需要全部手動配置,增加工作量,下面的兩種方式
DHCP SNOOP
如網吧的管理員使用DHCP分配地址的時候執行IP和MAC地址的捆綁
- Switch#configure terminal
- Switch(config)#ip dhcp snooping
- Switch(config)#ip dhcp snooping vlan 34
- Switch(config)#ip dhcp snooping information option
- Switch(config)#interface fa0/0 連接DHCP服務器的接口
- Switch(config-if)#ip dhcp snooping limit rate 70
- Switch(config-if)#ip dhcp snooping trust
指定該接口為信任接口,將獲得DHCP服務器所分配的地址,其他接口所發生的DHCP行為將被否決DAI動態ARP審查,調用ACL和DHCP SNOOP的IP-TO-MAC數據庫
- Switch#configure terminal
- Switch(config)#ip arp inspection filter這里調用ACL
注意,只能調用ARP ACL,該ACL優先與IP-TO-MAC表被審查,也就是說,即使有綁定項存在,如果被ARP-ACL拒絕,也不能通過
- Switch(config)#ip arp inspection vlan 34
- Switch(config)#interface fa0/0
- Switch(config-if)#ip arp inspection trust
連接到DHCP服務器的接口,調用該接口上的DHCP SNOOP的IP-TO-MAC表,默認連接到主機的接口都是不信任的接口
- Switch(config-if)#ip arp inspection limit rate 20 burst interval 2
不信任接口限制為每秒14個ARP請求,信任接口默認不受限制,這里修改為每秒20
- Switch(config-if)#exit
- Switch(config)#ip arp inspection log-buffer entries 64 記錄拒絕信息64條
注意:DHCP SNOOP只提供IP-TO-MAC綁定表,本身不參與流量策略,只是防止DHCP欺騙,而對任何IP和MAC欺騙
是沒有能力阻止的,但是它提供這樣一張表給DAI調用,以防止MAC欺騙
- ip arp-inspection 僅僅對違規的ARP包進行過濾,不對IP包和其他包起作用
- ip source verify 會對綁定接口的IP或者IP+MAC進行限制
3、VACL
- Configuring VACLs for Catalyst 6500 Traffic Capture
- Router(Config)# access-list 110 permit tcp any 172.12.31.0.0.0.0.255 eq 80
- Router(config)# vlan access-map my_map
- Router(config-access-map)# match ip address 110
- Router(config-access-map)# action forward capture
- Router(config)# vlan filter my_map 10-12,15
- Router(config)# interface fa 5/7
- Router(config-if) switchport capture allowed vlan 10-12, 15
4、SPAN RSPAN
基于源端口和基于源VLAN的兩種監控方式
RX TX BOTH 三種流量方向
VLAN MONITOR只能監控入站流,即RX,在該源VLAN中的物理端口都將成為源端口向目標端口COPY流.可以分配多個源端口或VLAN的RX流量到目的端口.不能監控多個端口的出站流,可以監控單個端口的出站流.最多只能配置兩個監控會話.源端口和目標端口是分離的.可以將TRUNK端口配置成源端口,然后使用VLAN過濾想要被分析的流,但是此命令不影響正常的流量轉發.過濾功能不能使用在基于源VLAN的情況下.#p#
目標端口
不能是源端口或反射端口
不參加二層協議:CDP VTP PAGP LACP DTP STP
在本地SPAN中,目標端口和源端口是同一交換機.一次只能參加一個SPAN會話,即不能在一個端口上配置兩個SPAN會話.不能是EC成員.如果目標端口是一個源VLAN成員,則這個VLAN的流量不能被MONITOR,其他VLAN可以被MONITOR.802.1X與SWITCHPORT PORT-SECURITY必須在目標端口關閉.SPAN可以MONITOR二層協議信息,RSPAN則不能.IDS或IPS設備對流量唯一的影響是:根據IPS IDS策略,對可能的攻擊行為做出處理,如RESET TCP連接等;并不去干涉正常流量的轉發.SPAN交換機端口分析,簡單的SPAN只需要兩個命令即可
- monitor sess 1 sour int f1/4
- monitor sess 1 dest int f1/9
此例將F1/4的流量發送到F1/9被分析
- Switch(config)# no monitor session 2 刪除語法
- Switch(config)# monitor session 2 source vlan 1 - 3 rx
- Switch(config)# monitor session 2 destination interface gigabitethernet0/7
- Switch(config)# monitor session 2 source vlan 10 rx
- Switch(config)# end
在所有的端口上監控VLAN1-3的收到的流量,發送到G0/7被分析,然后附加VLAN10的流量也被分析
- Switch(config)# monitor session 2 source interface gigabitethernet0/4 rx
- Switch(config)# monitor session 2 filter vlan 1 - 5 , 9
- Switch(config)# monitor session 2 destination interface gigabitethernet0/8
- Switch(config)# end
監控G0/4上收到的只包括VLAN1-5 VLAN9的流量,發送到G0/8端口被分析.注意與上例的區別:也就是說在定義源流量的時候是有兩種方式的,一種是源端口的流量,一種是VLAN流量#p#
RSPAN配置:
第一步:在所有交換機上將一個指定的VLAN提供給遠程SPAN使用
- Switch(config)# vlan 901
- Switch(config-vlan)# remote span
- Switch(config-vlan)# end
第二步,配置源交換機
- Switch(config)# monitor session 1 source interface fastethernet0/10 tx
- Switch(config)# monitor session 1 source interface fastethernet0/2 rx
- Switch(config)# monitor session 1 source interface fastethernet0/3 rx
- Switch(config)# monitor session 1 source interface port-channel 102 rx
- Switch(config)# monitor session 1 destination remote vlan 901 reflector-port
- fastethernet0/1
- Switch(config)# end
第三步,目標交換機配置
- Switch(config)# monitor session 1 source remote vlan 901
- Switch(config)# monitor session 1 destination interface fastethernet0/5
- Switch(config)# end
- This example shows how to disable received traffic monitoring on port 1, which was configured for
- bidirectional monitoring:
- Switch(config)# no monitor session 1 source interface fastEthernet0/1 rx
- The monitoring of traffic received on port 1 is disabled, but traffic sent from this port continues to be
- monitored.
遠程VLAN的監控
- Switch(config)# no monitor session 2
- Switch(config)# monitor session 2 source vlan 1 - 3 rx
- Switch(config)# monitor session 2 destination remote vlan 902 reflector-port
- gigabitethernet0/7
- Switch(config)# monitor session 2 source vlan 10 rx
- Switch(config)# end
- Switch(config)# no monitor session 2
- Switch(config)# monitor session 2 source interface gigabitethernet0/4 rx
- Switch(config)# monitor session 2 filter vlan 1 - 5 , 9
- Switch(config)# monitor session 2 destination remote vlan 902 reflector-port
- gigabitethernet0/8
- Switch(config)# end