交換機端口安全的配置
1.本實驗是將switch中的f0/1的端口做成安全端口,構建mac地址綁定,只讓pc0能夠進入這個單口,pc1不能進入。
情況一:
情況一:動態啟用安全端口
步驟:
1、配置網絡拓撲
2、配置主機ip和掩碼
3、打開端口1安全功能
4、測試連通
結果:pc0連通,pc1不連通
# 主要代碼
1>Switch(config)#int f0/1
2>Switch(config-if)#switch mode access
(把端口改為訪問模式,用來接入計算機)
3>Switch(config-if)#switch port-security
4>Switch(config-if)#exit
5>Switch#show prot-security address
查看mac地址綁定
情況二:
情況二:靜態綁定
步驟:
1、配置網絡拓撲
2、配置主機ip和掩碼
3、打開端口3的靜態配置
4、測試連通
結果:連通
端口1的違例處理模式是protect
用PC2連接端口1測試
# 主要代碼
1>Switch(config)#int f0/1
2>Switch(config-if)#switch mode access
(把端口改為訪問模式,用來接入計算機)
3>switchport port-security mac-address 主機的mac地址
4>Switch(config-if)#exit
5>Switch#show prot-security address
查看mac地址綁定
情況三:
情況三:粘滯綁定
步驟:
1、配置網絡拓撲
2、配置主機ip和掩碼
3、打開端口5安全功能
4、測試連通
結果:連通
端口5的違例處理模式是restrict
用PC2連接端口1測試
# 主要代碼
1>Switch(config)#int f0/1
2>Switch(config-if)#switch mode access
(把端口改為訪問模式,用來接入計算機)
3>Switch(config-if)#switchport port-security mac-address sticky
4>Switch(config-if)#exit
5>Switch#show prot-security address
查看mac地址綁定
情況四:
設置交換機的端口安全模式為以下三種:
switch port-security violation {protest | shutdown | restrict}
參考文章:
https://blog.csdn.net/weixin_34007020/article/details/89901247