• 全部
  • 經驗案例
  • 典型配置
  • 技術公告
  • FAQ
  • 漏洞說明
  • 全部
  • 全部
  • 大數據引擎
  • 知了引擎
產品線
搜索
取消
案例類型
發布者
是否解決
是否官方
時間
搜索引擎
匹配模式
高級搜索

S5130S-28P-EI做地址保護

2025-05-20提問
  • 0關注
  • 0收藏,392瀏覽
mr guo 零段
粉絲:0人 關注:0人

問題描述:

客戶現在是我們安裝的監控項目,攝像頭一共有61個,監控核心交換機是S5130S-28P-EI。現在的問題是客戶那邊有內部的人私自接到監控網絡裏麵下載視頻,為了阻止私自用電腦接入到監控網絡,客戶的信息中心主任向我們提出要求在咱們這台S5130S-28P-EI交換機上做配置,要求交換機隻讓現有的電腦和錄像機以及攝像頭的數據通過,如果有陌生的電話接到到監控網絡就讓這台非法接放的電腦不地址轉發,也就是說讓他接到網絡裏時交換機不讓他通過任何數據。 這對我來說是一種挑戰,之前沒有做過這種配置,好像隻在一些資料中看到過類似的案例。麻煩高手給予指點一下。腳本應如何寫。最好發個教程。謝謝。   也就是說隻能讓現有的設備通過核心交換機,有新設備接入到網絡就不讓其通過。麻煩老師們指點一下。

組網及組網描述:

最佳答案

粉絲:32人 關注:1人

1.22  端口安全典型配置舉例

1.22.1  端口安全autoLearn模式配置舉例

1. 組網需求

在Device的端口GigabitEthernet1/0/1上對接入用戶做如下的限製:

·     允許64個用戶自由接入,不進行認證,將學習到的用戶MAC地址添加為Sticky MAC地址,老化時間為30分鍾;

·     當安全MAC地址數量達到64後,停止學習;當再有新的MAC地址接入時,觸發入侵檢測,並將此端口關閉30秒。

2. 組網圖

圖1-1 端口安全autoLearn模式組網圖

3. 配置步驟

# 使能端口安全。

<Device> system-view

[Device] port-security enable

# 設置安全MAC地址的老化時間為30分鍾。

[Device] port-security timer autolearn aging 30

# 設置端口安全允許的最大安全MAC地址數為64。

[Device] interface gigabitethernet 1/0/1

[Device-GigabitEthernet1/0/1] port-security max-mac-count 64

# 設置端口安全模式為autoLearn。

[Device-GigabitEthernet1/0/1] port-security port-mode autolearn

# 設置觸發入侵檢測特性後的保護動作為暫時關閉端口,關閉時間為30秒。

[Device-GigabitEthernet1/0/1] port-security intrusion-mode disableport-temporarily

[Device-GigabitEthernet1/0/1] quit

[Device] port-security timer disableport 30

4. 驗證配置

上述配置完成後,可以使用如下顯示命令查看端口安全的配置情況。

[Device] display port-security interface gigabitethernet 1/0/1

Global port security parameters:

   Port security          : Enabled

   AutoLearn aging time   : 30 min

   Disableport timeout    : 30 s

   Blockmac timeout       : 180 s

   MAC move               : Denied

   Authorization fail     : Online

   NAS-ID profile         : Not configured

   Dot1x-failure trap     : Disabled

   Dot1x-logon trap       : Disabled

   Dot1x-logoff trap      : Disabled

   Intrusion trap         : Disabled

   Address-learned trap   : Disabled

   Mac-auth-failure trap  : Disabled

   Mac-auth-logon trap    : Disabled

   Mac-auth-logoff trap   : Disabled

   Open authentication    : Disabled

   Traffic-statistics    : Disabled

   OUI value list         :

    Index :  1           Value : 123401

 

 GigabitEthernet1/0/1 is link-up

   Port mode                      : autoLearn

   NeedToKnow mode                : Disabled

   Intrusion protection mode      : DisablePortTemporarily

   Strict intrusion protection    : Disabled

   Security MAC address attribute

       Learning mode              : Sticky

       Aging type                 : Periodical

   Max secure MAC addresses       : 64

   Current secure MAC addresses   : 0

   Authorization                  : Permitted

   NAS-ID profile                 : Not configured

   Free VLANs                     : Not configured

   Open authentication            : Disabled

   MAC-move VLAN check bypass     : Disabled

可以看到端口安全所允許的最大安全MAC地址數為64,端口模式為autoLearn,入侵檢測保護動作為DisablePortTemporarily,入侵發生後端口被禁用時間為30秒。

配置生效後,端口允許地址學習,學習到的MAC地址數可在上述顯示信息的“Current number of secure MAC addresses”字段查看到,具體的MAC地址信息可以在接口視圖下用display this命令查看。

[Device] interface gigabitethernet 1/0/1

[Device-GigabitEthernet1/0/1] display this

#

interface GigabitEthernet1/0/1

 port-security max-mac-count 64

 port-security port-mode autolearn

 port-security mac-address security sticky 0002-0000-0015 vlan 1

 port-security mac-address security sticky 0002-0000-0014 vlan 1

 port-security mac-address security sticky 0002-0000-0013 vlan 1

 port-security mac-address security sticky 0002-0000-0012 vlan 1

 port-security mac-address security sticky 0002-0000-0011 vlan 1

#

當學習到的MAC地址數達到64後,用命令display port-security interface可以看到端口模式變為secure,再有新的MAC地址到達將觸發入侵保護,可以通過命令display interface看到此端口關閉。30秒後,端口狀態恢複。此時,如果手動刪除幾條安全MAC地址後,端口安全的狀態重新恢複為autoLearn,可以繼續學習MAC地址。

1.22.2  端口安全userLoginWithOUI模式配置舉例

1. 組網需求

客戶端通過端口GigabitEthernet1/0/1連接到Device上,Device通過RADIUS服務器對客戶端進行身份認證,如果認證成功,客戶端被授權允許訪問Internet資源。

·     IP地址為192.168.1.2的RADIUS服務器作為主認證服務器和從計費服務器,IP地址為192.168.1.3的RADIUS服務器作為從認證服務器和主計費服務器。認證共享密鑰為name,計費共享密鑰為money。

·     所有接入用戶都使用ISP域sun的認證/授權/計費方法,該域最多可同時接入30個用戶;

·     係統向RADIUS服務器重發報文的時間間隔為5秒,重發次數為5次,發送實時計費報文的時間間隔為15分鍾,發送的用戶名不帶域名。

·     端口GigabitEthernet1/0/1同時允許一個802.1X用戶以及一個與指定OUI值匹配的設備接入。

2. 組網圖

圖1-2 端口安全userLoginWithOUI模式組網圖

3. 配置步驟

說明

·     下述配置步驟包含了部分AAA/RADIUS協議配置命令,具體介紹請參見“安全配置指導”中的“AAA”。

·     保證客戶端和RADIUS服務器之間路由可達。

 

(1)     配置AAA

# 配置RADIUS方案。

<Device> system-view

[Device] radius scheme radsun

[Device-radius-radsun] primary authentication 192.168.1.2

[Device-radius-radsun] primary accounting 192.168.1.3

[Device-radius-radsun] secondary authentication 192.168.1.3

[Device-radius-radsun] secondary accounting 192.168.1.2

[Device-radius-radsun] key authentication simple name

[Device-radius-radsun] key accounting simple money

[Device-radius-radsun] timer response-timeout 5

[Device-radius-radsun] retry 5

[Device-radius-radsun] timer realtime-accounting 15

[Device-radius-radsun] user-name-format without-domain

[Device-radius-radsun] quit

# 配置ISP域。

[Device] domain sun

[Device-isp-sun] authentication lan-access radius-scheme radsun

[Device-isp-sun] authorization lan-access radius-scheme radsun

[Device-isp-sun] accounting lan-access radius-scheme radsun

[Device-isp-sun] quit

(2)     配置802.1X

# 配置802.1X的認證方式為CHAP。(該配置可選,缺省情況下802.1X的認證方式為CHAP)

[Device] dot1x authentication-method chap

# 指定端口上接入的802.1X用戶使用強製認證域sun。

[Device] interface gigabitethernet 1/0/1

[Device-GigabitEthernet1/0/1] dot1x mandatory-domain sun

[Device-GigabitEthernet1/0/1] quit

(3)     配置端口安全

# 使能端口安全。

[Device] port-security enable

# 添加5個OUI值。(最多可添加16個,此處僅為示例。最終,端口僅允許一個與某OUI值匹配的用戶通過認證)

[Device] port-security oui index 1 mac-address 1234-0100-1111

[Device] port-security oui index 2 mac-address 1234-0200-1111

[Device] port-security oui index 3 mac-address 1234-0300-1111

[Device] port-security oui index 4 mac-address 1234-0400-1111

[Device] port-security oui index 5 mac-address 1234-0500-1111

# 設置端口安全模式為userLoginWithOUI。

[Device] interface gigabitethernet 1/0/1

[Device-GigabitEthernet1/0/1] port-security port-mode userlogin-withoui

[Device-GigabitEthernet1/0/1] quit

4. 驗證配置

# 查看端口安全的配置信息。

[Device] display port-security interface gigabitethernet 1/0/1

Global port security parameters:

   Port security          : Enabled

   AutoLearn aging time   : 30 min

   Disableport timeout    : 30 s

   Blockmac timeout       : 180 s

   MAC move               : Denied

   Authorization fail     : Online

   NAS-ID profile         : Not configured

   Dot1x-failure trap     : Disabled

   Dot1x-logon trap       : Disabled

   Dot1x-logoff trap      : Disabled

   Intrusion trap         : Disabled

   Address-learned trap   : Disabled

   Mac-auth-failure trap  : Disabled

   Mac-auth-logon trap    : Disabled

   Mac-auth-logoff trap   : Disabled

   Open authentication    : Disabled

   Traffic-statistics    : Disabled

   OUI value list         :

       Index :  1       Value : 123401

       Index :  2       Value : 123402

       Index :  3       Value : 123403

       Index :  4       Value : 123404

       Index :  5       Value : 123405

 

 GigabitEthernet1/0/1 is link-up

   Port mode                      : userLoginWithOUI

   NeedToKnow mode                : Disabled

   Intrusion protection mode      : NoAction

   Strict intrusion protection    : Disabled

   Security MAC address attribute

       Learning mode              : Sticky

       Aging type                 : Periodical

   Max secure MAC addresses       : Not configured

   Current secure MAC addresses   : 1

   Authorization                  :Permitted

   NAS-ID profile                 : Not configured

   Free VLANs                     : Not configured

   Open authentication            : Disabled

   MAC-move VLAN check bypass     : Disabled

配置完成後,如果有802.1X用戶上線,則可以通過上述顯示信息看到當前端口保存的MAC地址數為1。還可以通過display dot1x命令查看該802.1X用戶的在線情況。

此外,端口還允許一個MAC地址與OUI值匹配的用戶通過,可以通過下述命令查看。

[Device] display mac-address interface gigabitethernet 1/0/1

MAC Address     VLAN ID   State          Port/Nickname            Aging

1234-0300-0011  1         Learned        GE1/0/1                  Y

1.22.3  端口安全macAddressElseUserLoginSecure模式配置舉例

1. 組網需求

客戶端通過端口GigabitEthernet1/0/1連接到Device上,Device通過RADIUS服務器對客戶端進行身份認證。如果認證成功,客戶端被授權允許訪問Internet資源。

·     可以有多個MAC認證用戶接入;

·     如果是802.1X用戶請求認證,先進行MAC地址認證,MAC地址認證失敗,再進行802.1X認證。最多隻允許一個802.1X用戶接入;

·     MAC地址認證設置用戶名格式為用戶MAC地址的形式;

·     上線的MAC地址認證用戶和802.1X認證用戶總和不能超過64個;

·     為防止報文發往未知目的MAC地址,啟動ntkonly方式的Need To Know特性。

2. 組網圖

圖1-3 端口安全macAddressElseUserLoginSecure模式組網圖

3. 配置步驟

說明

·     RADIUS認證/計費及ISP域的配置同“1.22.2  端口安全userLoginWithOUI模式配置舉例”,這裏不再贅述。

·     保證接入用戶和RADIUS服務器之間路由可達。

 

# 使能端口安全。

<Device> system-view

[Device] port-security enable

# 配置MAC認證的用戶名和密碼,使用帶連字符“-”的MAC地址格式,其中字母大寫。

[Device] mac-authentication user-name-format mac-address with-hyphen uppercase

# 配置MAC地址認證用戶所使用的ISP域。

[Device] mac-authentication domain sun

# 配置802.1X的認證方式為CHAP。(該配置可選,缺省情況下802.1X的認證方式為CHAP)

[Device] dot1x authentication-method chap

# 設置端口安全允許的最大MAC地址數為64。

[Device] interface gigabitethernet 1/0/1

[Device-GigabitEthernet1/0/1] port-security max-mac-count 64

# 設置端口安全模式為macAddressElseUserLoginSecure。

[Device-GigabitEthernet1/0/1] port-security port-mode mac-else-userlogin-secure

# 指定端口上接入的802.1X用戶使用強製認證域sun。

[Device-GigabitEthernet1/0/1] dot1x mandatory-domain sun

[Device-GigabitEthernet1/0/1] quit

# 設置端口Need To Know模式為ntkonly

[Device-GigabitEthernet1/0/1] port-security ntk-mode ntkonly

[Device-GigabitEthernet1/0/1] quit

4. 驗證配置

# 查看端口安全的配置信息。

[Device] display port-security interface gigabitethernet 1/0/1

Global port security parameters:

   Port security          : Enabled

   AutoLearn aging time   : 30 min

   Disableport timeout    : 30 s

   Blockmac timeout       : 180 s

   MAC move               : Denied

   Authorization fail     : Online

   NAS-ID profile         : Not configured

   Dot1x-failure trap     : Disabled

   Dot1x-logon trap       : Disabled

   Dot1x-logoff trap      : Disabled

   Intrusion trap         : Disabled

   Address-learned trap   : Disabled

   Mac-auth-failure trap  : Disabled

   Mac-auth-logon trap    : Disabled

   Mac-auth-logoff trap   : Disabled

   Open authentication    : Disabled

   Traffic-statistics    : Disabled

   OUI value list

 

 GigabitEthernet1/0/1 is link-up

   Port mode                      : macAddressElseUserLoginSecure

   NeedToKnow mode                : NeedToKnowOnly

   Intrusion protection mode      : NoAction

   Strict intrusion protection    : Disabled

   Security MAC address attribute

      Learning mode               : Sticky

      Aging type                  : Periodical

   Max secure MAC addresses       : 64

   Current secure MAC addresses   : 0

   Authorization                  : Permitted

   NAS-ID profile                 : Not configured

   Free VLANs                     : Not configured

   Open authentication            : Disabled

   MAC-move VLAN check bypass     : Disabled

配置完成後,如果有用戶認證上線,則可以通過下述顯示信息看到當前端口上的用戶認證信息。

# 查看MAC地址認證信息。

[Device] display mac-authentication interface gigabitethernet 1/0/1

 Global MAC authentication parameters:

   MAC authentication                  : Enabled

   Authentication method               : PAP

   User name format                    : MAC address in uppercase(XX-XX-XX-XX-XX-XX)

           Username                    : mac

           Password                    : Not configured

   MAC range accounts                  : 0

          MAC address          Mask                 Username

   Offline detect period                      : 300 s

   Quiet period                               : 180 s

   Server timeout                             : 100 s

   Reauth period                              : 3600 s

   User aging period for critical VLAN        : 1000 s

   User aging period for guest VLAN           : 1000 s

   Authentication domain                      : sun

   HTTP proxy port list                       : Not configured

   HTTPS proxy port list                      : Not configured

   Max number of silent MACs                  : 1024 (per slot)

 Online MAC-auth wired users                  : 3

 

 Silent MAC users:

          MAC address       VLAN ID  From port               Port index

 

GigabitEthernet1/0/1 is link-up

   MAC authentication                         : Enabled

   Carry User-IP                              : Disabled

   Authentication domain                      : Not configured

   Auth-delay timer                           : Disabled

   Periodic reauth                            : Disabled

   Re-auth server-unreachable                 : Logoff

   Guest VLAN                                 : Not configured

   Guest VLAN auth-period                     : 30 s

   Critical VLAN                              : Not configured

   Critical voice VLAN                        : Disabled

   Host mode                                  : Single VLAN

   Offline detection                          : Enabled

   Authentication order                       : Default

   User aging                                 : Enabled

   Server-recovery online-user-sync           : Enabled

 

   URL user logoff                            : No

   Auto-tag feature                           : Disabled

   VLAN tag configuration ignoring            : Disabled

   Max online users                           : 4294967295

   Authentication attempts                    : successful 3, failed 7

   Current online users                       : 3

          MAC address       Auth state

          1234-0300-0011    Authenticated

          1234-0300-0012    Authenticated

          1234-0300-0013    Authenticated

# 查看802.1X認證信息。

[Device] display dot1x interface gigabitethernet 1/0/1

 Global 802.1X parameters:

   802.1X authentication                      : Enabled

   CHAP authentication                        : Enabled

   Max-tx period                              : 30 s

   Handshake period                           : 15 s

   Offline detect period                      : 300 s

   Quiet timer                                : Disabled

       Quiet period                           : 60 s

   Supp timeout                               : 30 s

   Server timeout                             : 100 s

   Reauth period                              : 3600 s

   Max auth requests                          : 2

   SmartOn switch ID                          : 30

   SmartOn supp timeout                       : 30 s

   SmartOn retry counts                       : 3

   User aging period for Auth-Fail VLAN       : 1000 s

   User aging period for critical VLAN        : 1000 s

   User aging period for guest VLAN           : 1000 s

   EAD assistant function                     : Disabled

       EAD timeout                            : 30 min

   Domain delimiter                           : @

 Online 802.1X wired users                    : 1

 

 GigabitEthernet1/0/1  is link-up

   802.1X authenticaiton            : Enabled

   Handshake                        : Enabled

   Handshake reply                  : Disabled

   Handshake security               : Disabled

   Unicast trigger                  : Disabled

   Periodic reauth                  : Disabled

   Port role                        : Authenticator

   Authorization mode               : Auto

   Port access control              : MAC-based

   Multicast trigger                : Enabled

   Mandatory auth domain            : sun

   Guest VLAN                       : Not configured

   Auth-Fail VLAN                   : Not configured

   Critical VLAN                    : Not configured

   Critical voice VLAN              : Disabled

   Add Guest VLAN delay             : Disabled

   Re-auth server-unreachable       : Logoff

   Max online users                 : 4294967295

   User IP freezing                 : Disabled

   Reauth period                    : 60 s

   Send Packets Without Tag         : Disabled

   Max Attempts Fail Number         : 0

   User aging                       : Enabled

   Server-recovery online-user-sync : Enabled

   Auth-Fail EAPOL                  : Disabled

   Critical EAPOL                   : Disabled

   Discard duplicate EAPOL-Start    : No

 

   EAPOL packets: Tx 16331, Rx 102

   Sent EAP Request/Identity packets : 16316

        EAP Request/Challenge packets: 6

        EAP Success packets: 4

        EAP Failure packets: 5

   Received EAPOL Start packets : 6

            EAPOL LogOff packets: 2

            EAP Response/Identity packets : 80

            EAP Response/Challenge packets: 6

            Error packets: 0

   Online 802.1X users: 1

          MAC address         Auth state

          0002-0000-0011      Authenticated

此外,因為設置了Need To Know特性,目的MAC地址未知、廣播和多播報文都被丟棄。


暫無評論

1 個回答
粉絲:121人 關注:1人

最簡單的直接做端口安全就可以

//www.yolosolive.com/cn/d_201904/1172968_30005_0.htm



複雜一點的,配置mac地址準入

mac地址準入你可以選擇本地mac地址準入,和遠程radius mac地址準入

//www.yolosolive.com/cn/d_201912/1252315_30005_0.htm

暫無評論

編輯答案

你正在編輯答案

如果你要對問題或其他回答進行點評或詢問,請使用評論功能。

分享擴散:

提出建議

    +

親~登錄後才可以操作哦!

確定

親~檢測到您登陸的賬號未在http://hclhub.h3c.com進行注冊

注冊後可訪問此模塊

跳轉hclhub

你的郵箱還未認證,請認證郵箱或綁定手機後進行當前操作

舉報

×

侵犯我的權益 >
對根叔社區有害的內容 >
辱罵、歧視、挑釁等(不友善)

侵犯我的權益

×

泄露了我的隱私 >
侵犯了我企業的權益 >
抄襲了我的內容 >
誹謗我 >
辱罵、歧視、挑釁等(不友善)
騷擾我

泄露了我的隱私

×

您好,當您發現根叔知了上有泄漏您隱私的內容時,您可以向根叔知了進行舉報。 請您把以下內容通過郵件發送到pub.zhiliao@h3c.com 郵箱,我們會盡快處理。
  • 1. 您認為哪些內容泄露了您的隱私?(請在郵件中列出您舉報的內容、鏈接地址,並給出簡短的說明)
  • 2. 您是誰?(身份證明材料,可以是身份證或護照等證件)

侵犯了我企業的權益

×

您好,當您發現根叔知了上有關於您企業的造謠與誹謗、商業侵權等內容時,您可以向根叔知了進行舉報。 請您把以下內容通過郵件發送到 pub.zhiliao@h3c.com 郵箱,我們會在審核後盡快給您答複。
  • 1. 您舉報的內容是什麼?(請在郵件中列出您舉報的內容和鏈接地址)
  • 2. 您是誰?(身份證明材料,可以是身份證或護照等證件)
  • 3. 是哪家企業?(營業執照,單位登記證明等證件)
  • 4. 您與該企業的關係是?(您是企業法人或被授權人,需提供企業委托授權書)
我們認為知名企業應該坦然接受公眾討論,對於答案中不準確的部分,我們歡迎您以正式或非正式身份在根叔知了上進行澄清。

抄襲了我的內容

×

原文鏈接或出處

誹謗我

×

您好,當您發現根叔知了上有誹謗您的內容時,您可以向根叔知了進行舉報。 請您把以下內容通過郵件發送到pub.zhiliao@h3c.com 郵箱,我們會盡快處理。
  • 1. 您舉報的內容以及侵犯了您什麼權益?(請在郵件中列出您舉報的內容、鏈接地址,並給出簡短的說明)
  • 2. 您是誰?(身份證明材料,可以是身份證或護照等證件)
我們認為知名企業應該坦然接受公眾討論,對於答案中不準確的部分,我們歡迎您以正式或非正式身份在根叔知了上進行澄清。

對根叔社區有害的內容

×

垃圾廣告信息
色情、暴力、血腥等違反法律法規的內容
政治敏感
不規範轉載 >
辱罵、歧視、挑釁等(不友善)
騷擾我
誘導投票

不規範轉載

×

舉報說明