03-MAC地址認證命令
本章節下載: 03-MAC地址認證命令 (158.40 KB)
1.1.1 display mac-authentication
1.1.3 mac-authentication authentication-method
1.1.4 mac-authentication critical vlan
1.1.5 mac-authentication domain
1.1.6 mac-authentication guest-vlan
1.1.7 mac-authentication max-user
1.1.8 mac-authentication timer
1.1.9 mac-authentication timer auth-delay
1.1.10 mac-authentication user-name-format
1.1.11 reset mac-authentication statistics
【命令】
display mac-authentication [ interface interface-list ] [ | { begin | exclude | include } regular-expression ]
【視圖】
任意視圖
【缺省級別】
2:係統級
【參數】
interface interface-list:端口列表,表示多個端口,表示方式為interface-list = { interface-type interface-number [ to interface-type interface-number ] }&<1-10>。其中,interface-type為端口類型,interface-number為端口號。&<1-10>表示前麵的參數最多可以輸入10次。起始端口類型必須和終止端口類型一致,並且終止端口號必須大於起始端口號。
|:使用正則表達式對顯示信息進行過濾。有關正則表達式的詳細介紹,請參見“基礎配置指導”中的“CLI”。
begin:從包含指定正則表達式的行開始顯示。
exclude:隻顯示不包含指定正則表達式的行。
include:隻顯示包含指定正則表達式的行。
regular-expression:表示正則表達式,為1~256個字符的字符串,區分大小寫。
【描述】
display mac-authentication命令用來顯示MAC地址認證的相關信息,主要包括全局及端口的配置信息、認證報文統計信息以及認證用戶信息。
需要注意的是:
· 如果指定參數interface interface-list,則顯示全局及指定端口上的MAC地址認證信息。
· 如果不指定任何參數,則顯示全局及所有端口上的MAC地址認證信息。
【舉例】
# 顯示MAC地址認證信息。
<Sysname> display mac-authentication
MAC address authentication is enabled.
CHAP authentication is enabled
User name format is MAC address in lowercase, like xxxxxxxxxxxx
Fixed username:mac
Fixed password:not configured
Offline detect period is 300s
Quiet period is 60s.
Server response timeout value is 100s
the max allowed user number is 1024 per slot
Current user number amounts to 0
Current domain: not configured, use default domain
Silent Mac User info:
MAC Addr From Port Port Index
Ethernet1/0/1 is link-up
MAC address authentication is enabled
Authenticate success: 0, failed: 0
Max number of on-line users is 256
Current online user number is 0
MAC Addr Authenticate state Auth Index
……(略)
表1-1 display mac-authentication命令顯示信息描述表
字段 |
描述 |
MAC address authentication is enabled |
MAC地址認證特性已經開啟 |
CHAP authentication is enabled |
CHAP認證方法已經開啟 |
User name format is MAC address in lowercase, like xxxxxxxxxxxx |
本字段用於顯示MAC地址認證使用的用戶名格式,有以下兩種情況: · 若采用MAC地址形式,則顯示具體的用戶名格式以及是否帶連字符、字母是否大小寫,例如本例中“User name format is MAC address in lowercase, like xxxxxxxxxxxx”,它表示用戶名格式為不帶連字符的MAC地址,其中字母為小寫 · 若采用固定用戶名格式,則顯示“User name format is fixed account” |
Fixed username: |
固定用戶名 · 采用MAC地址格式時,該值顯示為“mac”,無實際意義,僅表示采用MAC地址作為用戶名和密碼 · 采用固定用戶名格式時,該值為配置的用戶名(缺省為mac) |
Fixed password: |
固定用戶名的密碼 · 采用MAC地址格式,或采用固定用戶名格式但未配置密碼時,該值顯示為“not configured” · 采用固定用戶名格式且配置密碼時,顯示為“******” |
Offline detect period |
下線檢測定時器的時間間隔 |
Quiet period |
靜默定時器的時間間隔 |
Server response timeout value |
服務器連接超時定時器的值 |
The max allowed user number |
設備每板最大支持的MAC地址認證用戶數 |
Current user number amounts |
當前用戶數 |
Current domain: not configured, use default domain |
當前認證域沒有配置,使用缺省域 |
Silent Mac User info |
靜默用戶信息 |
Ethernet1/0/1 is link-up |
端口Ethernet1/0/1鏈路處於UP狀態 |
MAC address authentication is enabled |
端口Ethernet1/0/1 MAC地址認證特性已開啟 |
Authenticate success: 0, failed: 0 |
端口上MAC地址認證的統計信息,包括認證通過和認證失敗的數目 |
Max number of on-line users |
端口最多可容納的接入用戶數 如果端口沒有開啟MAC地址認證,則顯示0 |
Current online user number |
端口當前的接入用戶數 |
MAC Addr |
MAC地址 |
Authenticate state |
端口接入用戶的狀態,共有四種: · MAC_AUTHENTICATOR_CONNECT:正在連接 · MAC_AUTHENTICATOR_SUCCESS:認證通過 · MAC_AUTHENTICATOR_FAIL:認證失敗 · MAC_AUTHENTICATOR_LOGOFF:已下線 |
AuthIndex |
認證體索引號 |
【命令】
在係統視圖下:
mac-authentication [ interface interface-list ]
undo mac-authentication [ interface interface-list ]
在以太網端口視圖下:
mac-authentication
undo mac-authentication
【視圖】
係統視圖/以太網端口視圖
【缺省級別】
2:係統級
【參數】
interface interface-list:以太網端口列表,表示多個以太網端口,表示方式為interface-list = { interface-type interface-number [ to interface-type interface-number ] }&<1-10>。其中,interface-type為端口類型,interface-number為端口號。&<1-10>表示前麵的參數最多可以輸入10次。起始端口類型必須和終止端口類型一致,並且終止端口號必須大於起始端口號。
【描述】
mac-authentication命令用來開啟指定端口上或全局的MAC地址認證特性。undo mac-authentication命令用來關閉指定端口上或全局的MAC地址認證特性。
缺省情況下,所有端口及全局的MAC地址認證特性都處於關閉狀態。
需要注意的是:
· 在係統視圖下使用該命令時,如果不輸入可選項interface interface-list,則表示開啟全局的MAC地址認證特性;如果指定了interface interface-list,則表示開啟指定端口的MAC地址認證特性。
· 隻有全局和端口的MAC地址認證特性均開啟後,MAC地址認證配置才能在端口上生效。
· 端口的MAC地址認證功能和MAC VLAN的動態觸發功能不能同時使用。MAC VLAN的動態觸發功能的相關內容請參見“二層技術-以太網交換配置指導”中的“VLAN”。
【舉例】
# 開啟全局的MAC地址認證特性。
<Sysname> system-view
[Sysname] mac-authentication
Mac-auth is enabled globally.
# 開啟以太網端口Ethernet1/0/1上的MAC地址認證特性。
<Sysname> system-view
[Sysname] mac-authentication interface ethernet 1/0/1
Mac-auth is enabled on port Ethernet1/0/1.
或者
<Sysname> system-view
[Sysname] interface ethernet 1/0/1
[Sysname-Ethernet1/0/1] mac-authentication
Mac-auth is enabled on port Ethernet1/0/1.
【命令】
mac-authentication authentication-method { chap | pap }
undo mac-authentication authentication-method
【視圖】
係統視圖
【缺省級別】
2:係統級
【參數】
chap:支持與RADIUS服務器之間采用CHAP類型的認證方法。
pap:支持與RADIUS服務器之間采用PAP類型的認證方法。
【描述】
mac-authentication authentication-method命令用來配置MAC地址認證以以下認證方法進行:
· PAP(Password Authentication Protocol,密碼驗證協議)通過用戶名和口令來對用戶進行驗證,其特點是在網絡上以明文方式傳送用戶名和口令,僅適用於對網絡安全要求相對較低的環境。
· CHAP(Challenge Handshake Authentication Protocol,質詢握手驗證協議)采用客戶端與服務器端交互挑戰信息的方式來驗證用戶身份,其特點是在網絡上以明文方式傳送用戶名,以密文方式傳輸口令。與PAP相比,CHAP認證保密性較好,更為安全可靠。
undo mac-authentication authentication-method命令用來取消MAC地址認證的認證方法。
缺省情況下,設備采用PAP認證方法進行MAC地址認證。
【舉例】
# 配置設備采用CHAP認證方法進行MAC地址認證。
<Sysname> system-view
[Sysname] mac-authentication authentication-method chap
【命令】
mac-authentication critical vlan critical-vlan-id
undo mac-authentication critical vlan
【視圖】
二層以太網端口視圖
【缺省級別】
2:係統級
【參數】
critical-vlan-id:端口上指定的Critical VLAN ID,取值範圍為1~4094。該VLAN必須已經創建。
【描述】
mac-authentication critical vlan命令用來配置MAC地址認證的Critical VLAN,即當用戶進行MAC地址認證時,對應的ISP域下所有認證服務器都不可達的情況下用戶加入的VLAN。
undo mac-authentication critical vlan命令用來取消MAC地址認證的Critical VLAN配置。
缺省情況下,端口沒有配置MAC地址認證的Critical VLAN。
需要注意的是:
· 隻有開啟MAC認證的情況下,Critical VLAN才能生效。
· 端口上必須使能MAC VLAN功能,配置的Critical VLAN才生效。
· 認證服務器不可達是指,因網絡故障等原因導致的,用於認證用戶的ISP域所引用的所有服務器都不可達。
· 禁止刪除已被配置為Critical VLAN的VLAN,若要刪除該VLAN,請先使用命令undo mac-authentication critical vlan取消MAC地址認證的Critical VLAN配置。
相關配置可參考命令mac-authentication和“二層技術-以太網交換命令參考/VLAN”中的命令mac-vlan enable。
【舉例】
# 配置以太網端口Ethernet1/0/1的MAC地址認證的Critical VLAN為已經創建的VLAN 5。
<Sysname> system-view
[Sysname] interface ethernet 1/0/1
[Sysname-Ethernet1/0/1] mac-authentication critical vlan 5
【命令】
mac-authentication domain domain-name
undo mac-authentication domain
【視圖】
係統視圖/以太網端口視圖
【缺省級別】
2:係統級
【參數】
domain-name:ISP域名,為1~24個字符的字符串,不區分大小寫,且不能包括“/”、“:”、“*”、“?”、“<”、“>”以及“@”等特殊字符。
【描述】
mac-authentication domain命令用來指定MAC地址認證用戶使用的認證域。undo mac-authentication domain命令用來恢複缺省情況。
缺省情況下,未指定MAC地址認證用戶使用的認證域,使用係統缺省的認證域。缺省認證域的介紹請參見“安全命令參考/AAA”中的命令domain default enable。
需要注意的是:
· 係統視圖下指定的認證域對所有使能了MAC地址認證的端口生效。
· 以太網端口視圖下指定的認證域僅對本端口有效。不同的端口可以指定不同的認證域。
· 端口上接入的MAC地址認證用戶將按照如下先後順序選擇認證域:端口上指定的認證域-->係統視圖下指定的認證域-->係統缺省的認證域。
相關配置可參見命令display mac-authentication。
【舉例】
# 在係統視圖下指定MAC地址認證用戶使用的認證域為domain1。
<Sysname> system-view
[Sysname] mac-authentication domain domain1
# 指定端口Ethernet1/0/1上接入的MAC地址認證用戶使用的認證域為aabbcc。
[Sysname] interface ethernet 1/0/1
[Sysname-Ethernet1/0/1] mac-authentication domain aabbcc
【命令】
mac-authentication guest-vlan guest-vlan-id
undo mac-authentication guest-vlan
【視圖】
以太網端口視圖
【缺省級別】
2:係統級
【參數】
guest-vlan-id:端口上指定的Guest VLAN ID,取值範圍為1~4094。該VLAN必須已經創建。
【描述】
mac-authentication guest-vlan命令用來配置MAC地址認證的Guest VLAN。如果配置生效,則所有經由該端口認證失敗的用戶,將被加入到指定的Guest VLAN。undo mac-authentication guest-vlan命令用來取消MAC地址認證的Guest VLAN配置。
缺省情況下,沒有配置MAC地址認證的Guest VLAN。
需要注意的是:
· 隻有開啟MAC認證特性的情況下,Guest VLAN才能生效。
· 隻有使能端口的MAC VLAN功能的情況下,Guest VLAN才生效。
· 禁止刪除已被配置為Guest VLAN的VLAN,若要刪除該VLAN,請先使用命令undo mac-authentication guest-vlan取消MAC地址認證的Guest VLAN配置。
相關配置可參考命令mac-authentication和“二層技術-以太網交換命令參考/VLAN”中的命令mac-vlan enable。
【舉例】
# 配置以太網端口Ethernet1/0/1的MAC地址認證的Guest VLAN為已經創建的VLAN 5。
<Sysname> system-view
[Sysname] interface ethernet 1/0/1
[Sysname-Ethernet1/0/1] mac-authentication guest-vlan 5
【命令】
mac-authentication max-user user-number
undo mac-authentication max-user
【視圖】
以太網端口視圖
【缺省級別】
2:係統級
【參數】
user-number:端口同時可容納接入用戶數量的最大值,取值範圍為1~256。
【描述】
mac-authentication max-user命令用來配置端口同時可容納接入的MAC地址認證用戶數量的最大值。undo mac-authentication max-user命令用來恢複該值的缺省值。
缺省情況下,端口同時可容納接入用戶數量的最大值為256。
【舉例】
# 設置端口Ethernet1/0/1最多同時可容納32個MAC地址認證用戶接入。
<Sysname> system-view
[Sysname] interface ethernet 1/0/1
[Sysname-Ethernet1/0/1] mac-authentication max-user 32
【命令】
mac-authentication timer { offline-detect offline-detect-value | quiet quiet-value | server-timeout server-timeout-value }
undo mac-authentication timer { offline-detect | quiet | server-timeout }
【視圖】
係統視圖
【缺省級別】
2:係統級
【參數】
offline-detect offline-detect-value:表示下線檢測定時器。其中,offline-detect-value表示下線檢測定時器的值,取值範圍60~2147483647,單位為秒。
quiet quiet-value:表示靜默定時器。其中quiet-value表示靜默定時器的值,取值範圍1~3600,單位為秒。
server-timeout server-timeout-value:表示服務器超時定時器。其中,server-timeout-value表示服務器超時定時器的值,取值範圍為100~300,單位為秒。
【描述】
mac-authentication timer命令用來配置MAC地址認證定時器。undo mac-authentication timer命令用來將指定的定時器恢複為缺省情況。
缺省情況下,下線定時器的值為300秒,靜默定時器的值為60秒,服務器的超時定時器的值為100秒。
MAC地址認證過程受以下定時器的控製:
· 下線檢測定時器(offline-detect):用來設置用戶空閑超時的時間間隔。如果在兩個時間間隔之內,沒有來自用戶的流量通過,設備將切斷用戶的連接,同時通知RADIUS服務器,停止對該用戶的計費。
· 靜默定時器(quiet):用來設置用戶認證失敗以後,設備需要等待的時間間隔。在靜默期間,設備不對來自該用戶的報文進行認證處理,直接丟棄。靜默期後,如果設備再次收到該用戶的報文,則依然可以對其進行認證處理。
· 服務器超時定時器(server-timeout):用來設置設備同RADIUS服務器的連接超時時間。在用戶的認證過程中,如果服務器超時定時器超時,設備將在相應的端口上禁止此用戶訪問網絡。
相關配置可參考命令display mac-authentication。
【舉例】
# 設置服務器超時定時器時長為150秒。
<Sysname> system-view
[Sysname] mac-authentication timer server-timeout 150
【命令】
mac-authentication timer auth-delay time
undo mac-authentication timer auth-delay
【視圖】
二層以太網端口視圖
【缺省級別】
2:係統級
【參數】
time:指定MAC地址認證延時的時間,取值範圍為1~180秒。
【描述】
mac-authentication timer auth-delay命令用來配置MAC地址認證延時的時間。undo mac-authentication timer auth-delay命令用來恢複缺省情況。
缺省情況下,MAC地址認證不延時。
【舉例】
# 端口Ethernet 1/0/1下啟用MAC地址認證延時功能,延時時間30秒。
<Sysname> system-view
[Sysname] interface Ethernet 1/0/1
[Sysname-Ethernet1/0/1] mac-authentication timer auth-delay 30
【命令】
mac-authentication user-name-format { fixed [ account name ] [ password { cipher | simple } password ] | mac-address [ { with-hyphen | without-hyphen } [ lowercase | uppercase ] ] }
undo mac-authentication user-name-format
【視圖】
係統視圖
【缺省級別】
2:係統級
【參數】
fixed:表示采用固定用戶名格式。
account name:指定發送給RADIUS服務器進行認證或者在本地進行認證的用戶名。其中name為用戶名,為1~55個字符的字符串,不區分大小寫,缺省為mac。
password:指定固定用戶名的密碼。
cipher:表示以密文方式設置密碼。
simple:表示以明文方式設置密碼。
password:設置的明文密碼或密文密碼,區分大小寫。明文密碼為1~63個字符的字符串;密文密碼為1~117個字符的字符串。
mac-address:表示使用用戶的MAC地址作為用戶名和密碼。
with-hyphen:帶連字符“-”的MAC地址格式,例如xx-xx-xx-xx-xx-xx。
without-hyphen:不帶連字符“-”的MAC地址格式,例如xxxxxxxxxxxx。
lowercase:MAC地址中的字母為小寫。
uppercase:MAC地址中的字母為大寫。
【描述】
mac-authentication user-name-format命令用來配置MAC地址認證的用戶名格式。undo mac-authentication user-name-format命令用來恢複缺省情況。
缺省情況下,使用用戶的MAC地址做用戶名和密碼,其中字母為小寫,MAC地址不帶連字符“-”。
需要注意的是:
· 若指定用戶的MAC地址為用戶名,則用戶密碼也為用戶的源MAC地址。
· 以明文或密文方式設置的密碼,均以密文的方式保存在配置文件中。
相關配置可參考命令display mac-authentication。
【舉例】
# 配置MAC認證的用戶名為abc,密碼為明文xyz。
<Sysname> system-view
[Sysname] mac-authentication user-name-format fixed account abc password simple xyz
# 配置MAC認證的用戶名為abc,密碼為密文$c$3$Uu9Dh4xRKWa8RHW3TFnNTafBbhdPAg。
<Sysname> system-view
[Sysname] mac-authentication user-name-format fixed account abc password cipher $c$3$Uu9Dh4xRKWa8RHW3TFnNTafBbhdPAg
# 配置用戶的MAC地址為用戶名和密碼,使用帶連字符“-”的MAC地址格式,其中字母大寫。
<Sysname> system-view
[Sysname] mac-authentication user-name-format mac-address with-hyphen uppercase
【命令】
reset mac-authentication statistics [ interface interface-list ]
【視圖】
用戶視圖
【缺省級別】
2:係統級
【參數】
interface interface-list:端口列表,表示多個端口,表示方式為interface-list = { interface-type interface-number [ to interface-type interface-number ] }&<1-10>。其中,interface-type為端口類型,interface-number為端口號。&<1-10>表示前麵的參數最多可以輸入10次。起始端口類型必須和終止端口類型一致,並且終止端口號必須大於起始端口號。
【描述】
reset mac-authentication statistics命令用來清除MAC認證的統計信息。
需要注意的是:
· 如果不指定端口類型和端口號,則清除設備上的全局及所有端口的MAC認證統計信息;
· 如果指定端口類型和端口號,則清除指定端口上的MAC認證統計信息。
相關配置可參考命令display mac-authentication。
【舉例】
# 清除以太網端口Ethernet1/0/1上的MAC認證統計信息。
<Sysname> reset mac-authentication statistics interface ethernet 1/0/1
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!