您現在的位置是:首頁 > 單機遊戲首頁單機遊戲
交換機基礎埠安全實戰,原來可以這麼玩,一分鐘瞭解下
- 2021-12-25
mtu1500什麼意思
1、實戰目的
透過本實驗,掌握如下技能:
(1) 理解交換機的 MAC 表
(2) 理解交換機的埠安全
(3) 配置交換機的埠安全特性
2. 拓撲
3. 實驗步驟
交換機埠安全特性,可以讓我們配置交換機埠,使得非法的 MAC 地址的裝置接入時,
交換機自動關閉介面或者拒絕非法裝置接入,也可以限制某個埠上最大的 MAC 地址數。我
們這裡限制 f0/1 介面只允許 R1 接入。
(1) 步驟 1:檢查 R1 的 g0/0 介面的 MAC 地址
R1(config)# int g0/0
R1(config-if)# no shutdown
R1(config-if)# ip address 172。16。0。101 255。255。0。0
R1# show int g0/0
GigabitEthernet0/0 is up, line protocol is up
Hardware is MV96340 Ethernet, address is 0019。5535。b828 (bia 0019。5535。b828)
//這裡可以看到 g0/0 介面的 MAC 地址,記下Internet address is 172。16。0。101/16
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
(2) 步驟 2:配置交換機埠安全
S1(config)# int f0/1
S1(config-if)# shutdown
S1(config-if)# switch mode access
//以上命令把埠改為訪問模式,即用來接入計算機,在下一章詳細介紹該命令的含義。
S1(config-if)# switch port-securitiy
//以上命令是開啟交換機的埠安全功能。
S1(config-if)# switch port-securitiy maximum 1
//以上命令只允許該埠下的 MAC 條目最大數量為 1,即只允許一個裝置接入
S1(config-if)# switch port-securitiy violation { protect | shutdown | restrict }
protect:當新的計算機接入時,如果該介面的 MAC 條目超過最大數量,則這個新的計算
機將無法接入,而原有的計算機不受影響
shutdown:當新的計算機接入時,如果該介面的 MAC 條目超過最大數量,則該介面將會
被關閉,則這個新的計算機和原有的計算機都無法接入,需要管理員使用“ no shutdown”
命令重新開啟。
restrict:當新的計算機接入時,如果該介面的 MAC 條目超過最大數量,則這個新的計
算機可以接入,然而交換機將向傳送警告資訊。
S1(config-if)# switchport port-security mac-address 0019。5535。b828
//允許 R1 路由器從 f0/1 介面接入
S1(config-if)# no shutdown
S1(config)# int vlan1
S1(config-if)# no shutdown
S1(config-if)# ip address 172。16。0。1 255。255。0。0
//以上配置交換機的管理地址
(3) 步驟 3:檢查 MAC 地址表
S1# show mac-address-table
Mac Address Table
——————————————————————-
Vlan Mac Address Type Ports
—— ——————- ———— ——-
All 0100。0ccc。cccc STATIC CPU
1 0018。ba11。eb91 DYNAMIC Fa0/15
1 0019。5535。b828 STATIC Fa0/1
Total Mac Addresses for this criterion: 24
//R1 的 MAC 已經被登記在 f0/1 介面,並且表明是靜態加入的
(4) 步驟 4:模擬非法接入
這時從 R1 ping 交換機的管理地址,可以 ping 通,如下:
R1# ping 172。16。0。1
Type escape sequence to abort。
Sending 5, 100-byte ICMP Echos to 172。16。0。1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
在 R1 上修改 g0/0 的 MAC 地址為另一個地址,模擬是另外一臺裝置接入。如下:
R1(config)# int g0/0
R1(config-if)# mac-address 12。12。12
幾秒鐘後,則在 S1 上,出現:
01:09:39: %PM-4-ERR_DISABLE: psecure-violation error detected on Fa0/1, putting Fa0/1 in
err-disable state
01:09:39: %PORT_SECURITY-2-PSECURE_VIOLATION: Security violation occurred, caused by MAC address
0012。0012。0012 on port FastEthernet0/1。
01:09:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
//以上提示 f0/1 介面被關閉
S1# show int f0/1
FastEthernet0/1 is down, line protocol is down (err-disabled)
Hardware is Fast Ethernet, address is 0018。ba11。f503 (bia 0018。ba11。f503)
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
//以上表明 f0/1 介面因為錯誤而被關閉。非法裝置移除後,在 f0/1 介面下,執行“ shutdown”
和“ no shutdown”命令可以重新開啟該介面。
4. 實驗除錯
S1# show port-security
Secure Port MaxSecureAddr CurrentAddr SecurityViolation Security Action
(Count) (Count) (Count)
——————————————————————————————————————-
Fa0/1 1 1 0 Shutdown
——————————————————————————————————————-
Total Addresses in System (excluding one mac per port) : 0
Max Addresses limit in System (excluding one mac per port) : 6272
//以上可以檢視埠安全的設定情況
以下是華為數通路由交換方向完整技術分享,歡迎對華為網路技術感興趣的小夥伴們訂閱。
【可點選頭像在專欄中進行檢視訂閱】
華為新版HCIA數通路由交換
華為新版HCIP數通路由交換
華為新版HCIE數通路由交換