設定鎖定
或
馬上生效(動作後只學到第1個mac)
——————–參考資料—————————
思科 Port Security feature 可以防止 MAC 和 MAC/CAM 攻擊。
通過配置 Port Security 可以控制:
‧ 埠上最大可以通過的 MAC 位址數量
‧ 埠上學習或通過哪些 MAC 地址
‧ 對於超過規定數量的 MAC 處理進行處理
埠上學習或通過哪些 MAC 位址,可以通過靜態手工定義,也可以在交換機自動學習
交換機動態學習埠 MAC ,直到指定的 MAC 位址數量,交換機關機後重新學習。
目前較新的技術是 Sticky Port Security ,交換機將學到的 mac 位址寫到埠配置中,交換機重啟後配置仍然存在。
交換機動態學習埠 MAC ,直到指定的 MAC 位址數量,交換機關機後重新學習。
目前較新的技術是 Sticky Port Security ,交換機將學到的 mac 位址寫到埠配置中,交換機重啟後配置仍然存在。
對於超過規定數量的 MAC 處理進行處理一般有三種方式(針對交換機型號會有所不同):
‧ Shutdown 。這種方式保護能力最強,但是對於一些情況可能會為管理帶來麻煩。
‧ Protect 。丟棄非法流量,不報警。
‧ Restrict 。丟棄非法流量,報警,對比上面會是交換機 CPU 利用率上升但是不影響交換機使用。推薦使用這種方式。
‧ Shutdown 。這種方式保護能力最強,但是對於一些情況可能會為管理帶來麻煩。
‧ Protect 。丟棄非法流量,不報警。
‧ Restrict 。丟棄非法流量,報警,對比上面會是交換機 CPU 利用率上升但是不影響交換機使用。推薦使用這種方式。
配置方式:只接受第一次接入該埠電腦的mac位址, 預設maxumum = 1
Switch#config terminal
Switch(config)#interface f0/9 進入需要配置的埠
Switch(config-if)#switchport mode access 設置為交換模式
Switch(config-if)#switchport port-security 打開埠安全模式
Switch(config-if)#switchport port-security violation {protect | restrict | shutdown }
//針對非法接入電腦,埠處理模式:
| protect: 丟棄資料包,不發警告
| restrict: 丟棄數據包,在console發警告
| shutdown: 關閉埠為err-disable狀態,除非管理員手工啟動,否則該埠失效
Switch#config terminal
Switch(config)#interface f0/9 進入需要配置的埠
Switch(config-if)#switchport mode access 設置為交換模式
Switch(config-if)#switchport port-security 打開埠安全模式
Switch(config-if)#switchport port-security violation {protect | restrict | shutdown }
//針對非法接入電腦,埠處理模式:
| protect: 丟棄資料包,不發警告
| restrict: 丟棄數據包,在console發警告
| shutdown: 關閉埠為err-disable狀態,除非管理員手工啟動,否則該埠失效
配置 port-security 最大 mac 數目為2,違背處理方式,恢復方法Cat4507(config)#int fastEthernet 3/48
Cat4507 (config-if)#switchport port-security
Cat4507 (config-if)#switchport port-security maximum 2
Cat4507 (config-if)#switchport port-security violation shutdown
Cat4507 (config)#errdisable recovery cause psecure-violation
Cat4507 (config)#errdisable recovery interval 30
Cat4507 (config-if)#switchport port-security
Cat4507 (config-if)#switchport port-security maximum 2
Cat4507 (config-if)#switchport port-security violation shutdown
Cat4507 (config)#errdisable recovery cause psecure-violation
Cat4507 (config)#errdisable recovery interval 30
通過配置 sticky port-security學得的MAC
interface FastEthernet3/29
switchport mode access
switchport port-security
switchport port-security maximum 5
switchport port-security mac-address sticky
switchport port-security mac-address sticky 000b.db1d.6ccd
switchport port-security mac-address sticky 000b.db1d.6cce
switchport port-security mac-address sticky 000d.6078.2d95
switchport port-security mac-address sticky 000e.848e.ea01—————————————————–
綁定某PORT只允許哪些MAC進出
Switch(config)#Mac access-list extended MAC20
Switch(config)#permit host 0011.5b18.a56f any
Switch(config)#permit any host 0011.5b18.a56f
Switch(config-if )#interface Fa0/2
Switch(config-if )#mac access-group MAC20 in—————————————————–
mac地址與ip地址綁定
基本原理:
在交換機內建立mac位址和ip位址對應的映射表。埠獲得的ip和mac位址將匹配該表,不符合則丟棄該埠發送的資料包。
interface FastEthernet3/29
switchport mode access
switchport port-security
switchport port-security maximum 5
switchport port-security mac-address sticky
switchport port-security mac-address sticky 000b.db1d.6ccd
switchport port-security mac-address sticky 000b.db1d.6cce
switchport port-security mac-address sticky 000d.6078.2d95
switchport port-security mac-address sticky 000e.848e.ea01—————————————————–
綁定某PORT只允許哪些MAC進出
Switch(config)#Mac access-list extended MAC20
Switch(config)#permit host 0011.5b18.a56f any
Switch(config)#permit any host 0011.5b18.a56f
Switch(config-if )#interface Fa0/2
Switch(config-if )#mac access-group MAC20 in—————————————————–
mac地址與ip地址綁定
基本原理:
在交換機內建立mac位址和ip位址對應的映射表。埠獲得的ip和mac位址將匹配該表,不符合則丟棄該埠發送的資料包。
實現方法:
Switch(config)#arp 1.1.1.1 0001.0001.1111 arpa
Switch(config)#arp 1.1.1.1 0001.0001.1111 arpa
配置MAC位址持續時間
1) 進入介面模式 interface 介面
2) 配置持續時間
switchport port-security aging time type [absolute | inactivity]
absolute模式:當持續時間過後,安全埠上的地址將被絕對刪除
inactivity模式:在持續時間內,沒有使用的埠將被刪
1) 進入介面模式 interface 介面
2) 配置持續時間
switchport port-security aging time type [absolute | inactivity]
absolute模式:當持續時間過後,安全埠上的地址將被絕對刪除
inactivity模式:在持續時間內,沒有使用的埠將被刪
該配置的主要注意事項:
需要將網段內所有IP都建立MAC位址映射,沒有使用的IP位址可以與0000.0000.0000建立映射。
否則該綁定對於網段內沒有建立映射的IP位址無效。
需要將網段內所有IP都建立MAC位址映射,沒有使用的IP位址可以與0000.0000.0000建立映射。
否則該綁定對於網段內沒有建立映射的IP位址無效。
沒有留言:
張貼留言