01-登錄設備典型配置舉例
本章節下載: 01-登錄設備典型配置舉例 (429.75 KB)
資料版本:6W100-20190628
Copyright © 2019 bobty下载软件 版權所有,保留一切權利。
非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部,並不得以任何形式傳播。
除bobty下载软件 的商標外,本手冊中出現的其它公司的商標、產品標識及商品名稱,由各自權利人擁有。
本文檔中的信息可能變動,恕不另行通知。
目 錄
本文檔介紹了登錄設備的典型配置案例,以及如何通過命令行授權和計費對登錄的用戶進行控製。
本文檔中的配置均是在實驗室環境下進行的配置和驗證,配置前設備的所有參數均采用出廠時的缺省配置。如果您已經對設備進行了配置,為了保證配置效果,請確認現有配置和以下舉例中的配置不衝突。
本文檔假設您已了解登錄設備的特性。
主機通過配置電纜與設備的Console口連接。現要求:用戶通過設備的Console口登錄到設備,對設備進行管理和配置,並且配置本地認證方式為AAA認證,以提高設備的安全性。
· 通過Console口登錄設備,需要使用戶終端的通信參數配置和交換機Console口的缺省配置保持一致。
· 當通過Console口采用本地認證方式登錄時,由於本地用戶缺省的授權用戶角色為network-operator,且本地是無服務類型的。因此,需要設置本地用戶的服務類型為terminal(通過Console口登錄使用的是terminal服務類型),授權用戶角色為network-admin,才能使用戶下次成功登錄並在登錄後對設備進行管理和配置。
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
連接時請認準接口上“Console”的標識,以免誤插入其它接口。
(1) 主機斷電。因為PC機串口不支持熱插拔,請不要在PC帶電的情況下,將配置電纜插入或者拔出PC機。
(2) 請使用產品隨機附帶的配置電纜連接PC機和設備。請先將配置口電纜的DB-9(孔)插頭插入PC機的9芯(針)串口中,再將RJ-45插頭端插入設備的Console口中。
圖1 將設備與PC通過配置口電纜進行連接
(3) 將PC上電。
(4) 在通過Console口搭建本地配置環境時,需要通過超級終端或PuTTY等終端仿真程序與設備建立連接。用戶可以運行這些程序來連接網絡設備、Telnet或SSH站點,這些程序的詳細介紹和使用方法請參見該程序的使用指導。打開終端仿真程序後,請按如下要求設置終端參數:
· 波特率:9600
· 數據位:8
· 停止位:1
· 奇偶校驗:無
· 流量控製:無
設備上電,終端上顯示設備自檢信息,自檢結束後提示用戶鍵入回車,出現命令行提示符即可鍵入命令來配置設備或查看設備運行狀態,需要幫助可以隨時鍵入“?”。
(5) 進入AUX用戶線視圖,並進行後續配置:
# 進入AUX用戶線視圖。
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] line aux 0
# 設置通過Console口登錄交換機的用戶進行AAA認證。
[Sysname-line-aux0] authentication-mode scheme
# 退出到係統視圖,創建本地用戶admin,並進入本地用戶視圖。
[Sysname-line-aux0] quit
[Sysname] local-user admin class manage
New local user added.
# 設置本地用戶的認證口令為明文方式,口令為123。
[Sysname-luser-manage-admin] password simple 123
# 設置本地用戶的服務類型為Terminal,授權用戶角色為network-admin,刪除默認角色。
[Sysname-luser-manage-admin] service-type terminal
[Sysname-luser-manage-admin] authorization-attribute user-role network-admin
[Sysname-luser-manage-admin] undo authorization-attribute user-role network-operator
[Sysname-luser-manage-admin] quit
配置完成後,當用戶再次通過Console口登錄設備時,會出現如下界麵。用戶輸入用戶名“admin”和密碼“123”成功登錄設備後,登錄界麵中將出現命令行提示符。
******************************************************************************
* Copyright (c) 2004-2018 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
Line aux0 is available.
Press ENTER to get started.
login: admin
Password:
<Sysname>
#
line aux 0
authentication-mode scheme
user-role network-admin
#
local-user admin class manage
password hash $h$6$RgG+mm4RKXICN1tY$ld6pV+qB2a/BBFXVnqocFJjYgx/EKCYod9tHmGRP8AA
1qnbeRcB6Bd4jW+cteG9aY2Gc+J8JqLHsWwvtnLyEAw==
service-type terminal
authorization-attribute user-role network-admin
#
如圖2所示,要求僅允許使用IP地址為192.168.0.46/24和192.168.0.52/24的主機以Telnet方式登錄設備,且在登錄時必須進行基於用戶名和密碼的身份驗證。這兩個主機在相同的認證方式下使用兩個不同的用戶名登錄設備時,具有兩種不同的權限,分別為管理權限和可執行所有特性中讀類型的命令權限。
圖2 通過Telnet登錄交換機組網圖
· 缺省情況下,設備的Telnet服務器處於關閉狀態,需要通過Console口登錄後開啟設備的Telnet服務功能。
· 可以通過ACL來限製IP地址為192.168.0.58的主機不能以Telnet方式登錄設備。
· 缺省情況下,本地用戶的角色為network-operator。因此,對於用戶權限僅為允許執行所有特性中讀類型的命令,需要重新創建一個具有此權限的角色。
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
缺省情況下,S6890係列交換機的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
# 通過Console口登錄設備,進入係統視圖,開啟Telnet服務。
<Sysname> system-view
[Sysname] telnet server enable
# 設置通過VTY用戶線登錄交換機使用AAA的認證方式。
[Sysname] line vty 0 63
[Sysname-line-vty0-63] authentication-mode scheme
[Sysname-line-vty0-63] quit
# 創建本地用戶userA,授權其用戶角色為network-admin,為其配置密碼,刪除默認角色。
[Sysname] local-user userA class manage
New local user added.
[Sysname-luser-manage-userA] authorization-attribute user-role network-admin
[Sysname-luser-manage-userA] service-type telnet
[Sysname-luser-manage-userA] password simple 123
[Sysname-luser-manage-userA] undo authorization-attribute user-role network-operator
[Sysname-luser-manage-userA] quit
# 創建用戶角色roleB,權限為允許執行所有特性中讀類型的命令。
[Sysname] role name roleB
[Sysname-role-roleB] rule 1 permit read feature
[Sysname-role-roleB] quit
# 創建本地用戶userB,為其配置密碼,授權其用戶角色為roleB,刪除默認角色。
[Sysname] local-user userB class manage
New local user added.
[Sysname-luser-manage-userB] authorization-attribute user-role roleB
[Sysname-luser-manage-userB] service-type telnet
[Sysname-luser-manage-userB] password simple 123
[Sysname-luser-manage-userB] undo authorization-attribute user-role network-operator
[Sysname-luser-manage-userB] quit
# 創建ACL視圖,定義規則,僅允許來自192.168.0.46和192.168.0.52的用戶訪問交換機。
[Sysname] acl basic 2000
[Sysname-acl-basic-2000] rule 1 permit source 192.168.0.46 0
[Sysname-acl-basic-2000] rule 2 permit source 192.168.0.52 0
[Sysname-acl-basic-2000] rule 3 deny source any
[Sysname-acl-basic-2000] quit
# 引用訪問控製列表2000,通過源IP對Telnet用戶進行控製。
[Sysname] telnet server acl 2000
配置完成後,各用戶的權限為:
· 當用戶使用userA作為用戶名以Telnet方式登錄設備時,會出現如下界麵。用戶輸入用戶名“userA”和密碼“123”後能夠成功登錄到設備上,具有對設備進行管理和配置的權限。
******************************************************************************
* Copyright (c) 2004-2018 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
login: userA
Password:
<Sysname> ?
User view commands:
archive Archive configuration
arp Address Resolution Protocol (ARP) module
backup Backup operation
boot-loader Software image file management
bootrom Update/read/backup/restore bootrom
bootrom-access Bootrom access control
cd Change current directory
cfd Connectivity Fault Detection (CFD) module
clock Specify the system clock
copy Copy a file
debugging Enable system debugging functions
delete Delete a file
diagnostic Generic OnLine Diagnostics (GOLD) module
diagnostic-logfile Diagnostic log file configuration
dir Display files and directories on the storage media
display Display current system information
emulate-ping Emulate ping function
erase Alias for 'delete'
exception Exception information configuration
exit Alias for 'quit'
fdisk Partition a storage medium
fixdisk Check and repair a storage medium
format Format a storage medium
free Release a connection
ftp Open an FTP connection
---- More ----
· 當用戶使用userB作為用戶名以Telnet方式登錄到設備上時,會出現如下界麵,要求輸入用戶名和密碼,輸入用戶名和密碼123後能夠成功登錄到設備上,隻允許該用戶執行所有特性中讀類型的命令。
******************************************************************************
* Copyright (c) 2004-2018 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
login: userB
Password:
<Sysname> ?
User view commands:
dir Display files and directories on the storage media
display Display current system information
erase Alias for 'delete'
exit Alias for 'quit'
md5sum Compute the hash digest of a file using the MD5 algorithm
more Display the contents of a file
no Alias for 'undo'
pwd Display current working directory
quit Exit from current command view
sha256sum Compute the hash digest of a file using the SHA256 algorithm
show Alias for 'display'
system-view Enter the System View
write Alias for 'save'
<Sysname>
· Host C無法通過Telnet登錄設備。
#
telnet server enable
telnet server acl 2000
#
acl basic 2000
rule 1 permit source 192.168.0.46 0
rule 2 permit source 192.168.0.52 0
rule 3 deny
#
line vty 0 63
authentication-mode scheme
user-role network-operator
#
local-user userA class manage
password hash $h$6$I2Sg4Llj1qVUWQZ3$JA6KkU3zfVVRg48MM92X6cVpdiqR2JF887PKi3GQMwn
XXXcsWBuz7GIeJZeeNFMmMBaV7DPkKblnb0sGT2axvg==
service-type telnet
authorization-attribute user-role network-admin
#
local-user userB class manage
password hash $h$6$q+c3OcSxrPpDpsDf$BWkgfOyxBLyR5zyYgF/+VvN/1ofy81zoHDlFf80OjDl
a6/EiSJbSBl33PeazilSkWSYcttkg5v5bGecB7oYwAw==
service-type telnet
authorization-attribute user-role roleB
#
role name roleB
rule 1 permit read feature
#
某公司組網如圖3所示,為了保證交換機能夠安全的運行,在交換機使用過程中,需要對登錄用戶進行認證、命令行執行限製以及對用戶執行過的所有命令進行記錄。
· 本案例使用遠程認證、授權和計費功能,需要配置HWTACACS方案(本舉例使用HWTACACS服務器)。
· 如果需要HWTACACS服務器記錄用戶執行過的命令,可以通過創建一個可用Telnet方式登錄設備的用戶名,為其授權權限。則使用該用戶登錄時,隻能執行HWTACACS服務器授權的命令,且這些命令都會被記錄。
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
缺省情況下,S6890係列交換機的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
執行command authorization命令後,命令行授權功能將立即生效,用戶執行的命令隻有被授權後才被允許執行。因此,在執行此命令之前,請先在HWTACACS服務器上配置相應用戶及用戶可以使用的命令行,再在設備上配置命令行授權功能對應的HWTACACS方案。
下麵以iMC為例(使用iMC版本為:iMC PLAT 7.1(E0302)、iMC EIA 7.1(E0301)),說明HWTACACS服務器的基本配置。
# 增加設備區域。
選擇“用戶”頁簽,單擊導航樹中的[設備用戶策略管理/授權場景條件/設備區域管理]菜單項,進入設備區域列表頁麵。單擊<增加>按鈕,進入增加設備區域頁麵。
· 輸入區域名稱system。
· 其它參數采用缺省值。
· 單擊<確定>按鈕,完成增加設備區域。
圖4 增加設備區域
# 增加設備。
選擇“用戶”頁簽,單擊導航樹中的[設備用戶策略管理/設備管理]菜單項,進入設備管理頁麵。單擊<增加>按鈕,進入增加設備頁麵。
· 輸入共享密鑰和確認共享密鑰expert。
· 輸入認證端口,缺省為49。
· 選擇設備區域為system。
· 選擇是否支持單一連接,選擇“不支持”,表示設備與TAM通信時不支持在同一個TCP連接中建立多個會話。
· 選擇是否支持Watchdog報文,選擇“不支持”,表示用戶在線時設備不發送Watchdog報文。
· 單擊設備管理中的<手工增加>按鈕,打開設備增加窗口。輸入設備IP地址192.168.2.1,單擊<確定>按鈕即可增加設備。
· 單擊<確定>按鈕,完成增加設備的操作。
圖5 增加設備
# 增加Shell Profile。
選擇“用戶”頁簽,單擊導航樹中的[設備用戶策略管理/授權命令配置/Shell Profie配置]菜單項,進入Shell Profie列表頁麵。單擊<增加>按鈕,進入增加Shell Profie頁麵。
· 輸入Shell Profile名稱Shell Profile1。
· 輸入授權級別,這裏選擇級別1。
· 其它參數采用缺省值。
· 單擊<確定>按鈕,完成增加Shell Profile。
圖6 增加Shell Profile
# 接入授權信息。
選擇“用戶”頁簽,單擊導航樹中的[設備用戶策略管理/授權策略管理]菜單項,進入授權策略列表頁麵。單擊<增加>按鈕,進入增加授權策略頁麵。輸入策略的名稱tac。單擊接入授權信息區域的<增加>按鈕,打開增加授權項的頁麵。
· 設備區域選擇“system”,表示任意設備區域都符合要求。
· 設備類型選擇“不限”,表示任意設備類型都符合要求。
· 授權時段選擇“不限”,表示任意時間段都符合要求。
· 選擇Shell Profile為Shell Profile1。
· 選擇命令集選擇“不限”,表示用戶登錄設備後可以執行任何命令。
· 單擊<確定>按鈕,完成增加授權項。
圖7 接入授權信息
單擊<確定>按鈕,完成增加授權策略。
圖8 增加授權策略
# 增加設備用戶。
選擇“用戶”頁簽,單擊導航樹中的[設備用戶管理/所有設備用戶]菜單項,進入設備用戶列表頁麵。
單擊<增加>按鈕,進入增加設備用戶頁麵。
· 輸入帳號名monitor。
· 輸入用戶名telnet-user。
· 輸入登錄密碼和登錄密碼確認為123。
· 選擇用戶使用的授權策略為tac。
· 輸入在線數量限製為5,表示最多允許5個該用戶同時在線。
· 其它參數采用缺省值。
· 單擊<確定>按鈕,完成增加設備用戶。
圖9 增加設備用戶
# 在設備上配置IP地址及路由,以保證Device、Host A、HWTACACS server之間相互路由可達。(配置步驟略)
# 開啟設備的Telnet服務器功能,以便用戶訪問。
<Sysname> system-view
[Sysname] telnet server enable
# 配置HWTACACS方案:
· 授權計費服務器的IP地址:TCP端口號為192.168.2.20:49(該端口號必須和HWTACACS服務器上的設置一致)。
· 報文的加密密碼是expert。
· 登錄時不需要輸入域名,使用缺省域。
[Sysname] hwtacacs scheme tac
[Sysname-hwtacacs-tac] primary authentication 192.168.2.20 49
[Sysname-hwtacacs-tac] primary authorization 192.168.2.20 49
[Sysname-hwtacacs-tac] primary accounting 192.168.2.20 49
[Sysname-hwtacacs-tac] key authentication simple expert
[Sysname-hwtacacs-tac] key authorization simple expert
[Sysname-hwtacacs-tac] key accounting simple expert
[Sysname-hwtacacs-tac] user-name-format without-domain
[Sysname-hwtacacs-tac] quit
# 配置缺省域的命令行授權計費的AAA方案,使用HWTACACS方案tac進行認證,並且使用本地認證local作為備選認證方法。
[Sysname] domain system
[Sysname-isp-system] authentication login hwtacacs-scheme tac local
[Sysname-isp-system] authorization login hwtacacs-scheme tac local
[Sysname-isp-system] authorization command hwtacacs-scheme tac local
[Sysname-isp-system] accounting login hwtacacs-scheme tac local
[Sysname-isp-system] accounting command hwtacacs-scheme tac
[Sysname-isp-system] quit
# 配置本地認證所需參數:創建本地用戶monitor,密碼為123,可使用的服務類型為telnet。刪除用戶缺省角色,配置用戶角色為level-1,限製用戶權限。
[Sysname] local-user monitor class manage
[Sysname-luser-manage-monitor] password simple 123
[Sysname-luser-manage-monitor] service-type telnet
[Sysname-luser-manage-monitor] authorization-attribute user-role level-1
[Sysname-luser-manage-monitor] undo authorization-attribute user-role network-operator
[Sysname-luser-manage-monitor] quit
#設置通過VTY用戶線登錄交換機使用AAA的認證方式。
[Sysname] line vty 0 63
[Sysname-line-vty0-63] authentication-mode scheme
# 使能命令行授權和命令行計費功能。
[Sysname-line-vty0-63] command authorization
[Sysname-line-vty0-63] command accounting
[Sysname-line-vty0-63] quit
(1) 驗證命令行授權功能
# 在用戶主機上通過telnet方式登錄設備,進入登錄界麵下。用戶輸入用戶名“monitor”和密碼“123”。
C:\Documents and Settings\Administrator> telnet 192.168.2.1
******************************************************************************
* Copyright (c) 2004-2018 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
login:monitor
Password:
<Sysname>
# 輸入“?”,可以查看登錄設備後能操作的命令行權限,此處顯示僅能輸入用戶角色level-1允許執行的命令。
<Sysname> ?
User view commands:
display Display current system information
erase Alias for 'delete'
exit Alias for 'quit'
mtrace Configure the multicast traceroute
no Alias for 'undo'
ping Ping function
quit Exit from current command view
show Alias for 'display'
ssh2 Establish an Stelnet connection to an Stelnet server
super Switch to a user role
system-view Enter the System View
telnet Establish a telnet connection
tracert Tracert function
write Alias for 'save'
<Sysname> system-view
System View: return to User View with Ctrl+Z.
[Sysname] ?
System view commands:
access-list Alias for 'acl'
display Display current system information
end Alias for 'return'
erase Alias for 'delete'
exit Alias for 'quit'
hostname Alias for 'sysname'
logging Alias for 'info-center'
mtrace Configure the multicast traceroute
no Alias for 'undo'
ping Ping function
quit Exit from current command view
return Exit to User View
show Alias for 'display'
tracert Tracert function
write Alias for 'save'
(2) 驗證命令行計費功能
# 選擇“用戶”頁簽,單擊導航樹中的[設備用戶管理/日誌管理/審計日誌]菜單項,進入審計日誌列表頁麵。
· 輸入賬號名“monitor”。
· 選擇審計起始時間。
單擊<查詢>按鈕,查詢出符合條件的審計日誌。
圖10 審計日誌查詢
可以看到帳號名為monitor有命令行system-view,審計通過。
圖11 查看審計日誌詳細信息
圖12 查看審計日誌詳細信息
#
telnet server enable
#
hwtacacs scheme tac
primary authentication 192.168.2.20
primary authorization 192.168.2.20
primary accounting 192.168.2.20
key authentication cipher $c$3$Fl1Mn3wBsh+vH6otPvoz+AdE7VaNS3c0Pw==
key authorization cipher $c$3$2x6XI5xU7UGX6VqWFXNp2n3FG07uTNjiQw==
key accounting cipher $c$3$2oKsuCOAZX1+3ibvTPxnJ1YvJ1MHqv73Lw==
user-name-format without-domain
#
domain system
authentication login hwtacacs-scheme tac local
authorization login hwtacacs-scheme tac local
accounting login hwtacacs-scheme tac local
authorization command hwtacacs-scheme tac local
accounting command hwtacacs-scheme tac
#
local-user monitor class manage
password hash $h$6$5BqWnAJTpBbU5NbY$PbdgF+43eE5WMvj2iHPySfd5nGqj5AhDCDOXTiUMJvR
FFVsZaF8EW1tgpsQPRSq7SDKaGqwHTy9nsabAoGNaYg==
service-type telnet
authorization-attribute user-role level-1
#
line vty 0 63
authentication-mode scheme
user-role network-operator
idle-timeout 0 0
command authorization
command accounting
#
如圖13所示,將Host A的網口通過網線與Device設備的Ten-GigabitEthernet1/0/1接口連接。通過在Device設備上進行配置,實現以下要求:
· 設備通過Telnet登錄的同時在線的最大用戶連接數為10,每屏顯示20行,設備曆史命令緩衝區大小為100;
· 用戶通過Telnet方式登錄Device設備時采用scheme本地認證方式,需要輸入用戶名和密碼(用戶名和密碼均為test);
· 登錄後,當用戶20分鍾沒有對設備進行操作,設備會自動斷開連接。
圖13 通過Telnet登錄交換機組網圖
· 缺省情況下,設備的Telnet服務器處於關閉狀態,需要通過Console口登錄後開啟設備的Telnet服務功能。
· 缺省情況下,本地用戶的角色為network-operator,為了使用戶登錄後能正常使用設備上的所有命令,建議將本地用戶的用戶角色配置為network-admin。
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
缺省情況下,S6890係列交換機的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
# 通過Console口登錄設備,進入係統視圖,修改設備名稱,開啟Telnet服務。
<Sysname> system-view
[Sysname] sysname Device
[Device] telnet server enable
# 創建接口地址。
[Device] interface Ten-GigabitEthernet 1/0/1
[Device-Ten-GigabitEthernet1/0/1] port link-mode route
[Device-Ten-GigabitEthernet1/0/1] ip address 192.168.3.1 24
[Device-Ten-GigabitEthernet1/0/1] quit
# 配置所有的Telnet用戶登錄設備的認證方式為scheme,設置VTY用戶線的公共屬性。
[Device] line vty 0 63
[Device-line-vty0-63] authentication-mode scheme
[Device-line-vty0-63] screen-length 20
[Device-line-vty0-63] history-command max-size 100
[Device-line-vty0-63] idle-timeout 20
[Device-line-vty0-63] quit
# 配置通過Telnet登錄的同時在線的最大用戶連接數為10。
[Device] aaa session-limit telnet 10
# 配置本地用戶,用戶名為test,密碼為test,配置服務類型為telnet,用戶角色為network-admin,刪除默認角色。
[Device] local-user test class manage
[Device-luser-manage-test] password simple test
[Device-luser-manage-test] authorization-attribute user-role network-admin
[Device-luser-manage-test] undo authorization-attribute user-role network-operator
[Device-luser-manage-test] service-type telnet
[Device-luser-manage-test] quit
# 在Host A命令窗口執行Telnet命令登錄到設備,會出現如下界麵。用戶輸入用戶名“test”和密碼“test”後能夠成功登錄到設備上對設備進行操作。
******************************************************************************
* Copyright (c) 2004-2018 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
login: test
Password:
<Device>
# 當在線人數到達10個時,超出最大限製的用戶不能Telnet登錄到設備。
C:\Users\zhangsan>telnet 192.168.3.1
Trying 192.168.3.1 ...
Press CTRL+K to abort
Connected to 192.168.3.1 ...
Failed to connect to the remote host!
# 當用戶20分鍾沒有對設備進行操作時,會自動退出登錄,此時需要重新登錄。
******************************************************************************
* Copyright (c) 2004-2018 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
login:
#
sysname Device
#
telnet server enable
#
interface Ten-GigabitEthernet1/0/1
port link-mode route
ip address 192.168.3.1 255.255.255.0
#
line vty 0 63
authentication-mode scheme
user-role network-operator
idle-timeout 20 0
screen-length 20
history-command max-size 100
#
aaa session-limit telnet 10
#
local-user test class manage
password hash $h$6$/Xa6qIOrThQEVqbK$C00MPM5UaYoigaOfflWhpTskb/uB80yZ9O06tpztnDe
vrFEHqkvxfkSb4hUadHuknPSnjLNQByztfr30cP/Hlg==
service-type telnet
authorization-attribute user-role network-admin
#
如圖14所示,將Host A的網口通過網線與Device A的Ten-GigabitEthernet1/0/2接口連接。通過在Device A設備上進行配置,實現以下要求:
· 用戶可以通過Device A Telnet登錄到Device B上,對Device B進行配置;
· 用戶通過Telnet方式登錄Device A時采用scheme本地認證方式,需要輸入用戶名和密碼(用戶名和密碼均為test);
· Device A僅允許使用IP地址為192.168.10.1的PC以Telnet方式登錄, Device B僅允許Device A以Telnet方式登錄;
· Device A和Device B設備每屏顯示20行,設備曆史命令緩衝區大小為100;
· 登錄設備後,如果用戶20分鍾沒有對Device A或Device B進行操作,Device A或Device B會自動斷開連接。
圖14 通過Telnet登錄交換機組網圖
· 缺省情況下,設備的Telnet服務器處於關閉狀態,需要通過Console口登錄後開啟設備的Telnet服務功能。
· 缺省情況下,本地用戶的角色為network-operator,為了使用戶登錄後能正常使用設備上的所有命令,建議將本地用戶的用戶角色配置為network-admin。
· 可以通過ACL來限製僅IP地址為192.168.10.1的主機以Telnet方式登錄Device A, 僅Device A設備以Telnet方式登錄Device B。
本舉例是在S6890-CMW710-R2712版本上進行配置和驗證的。
缺省情況下,S6890係列交換機的接口處於ADM(Administratively Down)狀態,請根據實際需要在對應接口視圖下使用undo shutdown命令開啟接口。
# 通過Console口登錄設備,進入係統視圖,修改設備名稱,開啟Telnet服務。
<Sysname> system-view
[Sysname] sysname DeviceA
[DeviceA] telnet server enable
# 創建接口地址。
[DeviceA] interface Ten-GigabitEthernet 1/0/1
[Device-Ten-GigabitEthernet1/0/1] port link-mode route
[DeviceA-Ten-GigabitEthernet1/0/1] ip address 192.168.3.2 24
[DeviceA-Ten-GigabitEthernet1/0/1] quit
[DeviceA] interface Ten-GigabitEthernet 1/0/2
[Device-Ten-GigabitEthernet1/0/1] port link-mode route
[DeviceA-Ten-GigabitEthernet1/0/2] ip address 192.168.10.2 24
[DeviceA-Ten-GigabitEthernet1/0/2] quit
# 配置所有的Telnet用戶登錄設備的認證方式為scheme,設置VTY用戶線的公共屬性。
[DeviceA] line vty 0 63
[DeviceA-line-vty0-63] authentication-mode scheme
[DeviceA-line-vty0-63] screen-length 20
[DeviceA-line-vty0-63] history-command max-size 100
[DeviceA-line-vty0-63] idle-timeout 20
[DeviceA-line-vty0-63] protocol inbound telnet
[DeviceA-line-vty0-63] quit
# 配置本地用戶,用戶名為test,密碼為test,配置服務類型為telnet,用戶角色為network-admin,刪除默認角色。
[DeviceA] local-user test class manage
[DeviceA-luser-manage-test] password simple test
[DeviceA-luser-manage-test] authorization-attribute user-role network-admin
[DeviceA-luser-manage-test] undo authorization-attribute user-role network-operator
[DeviceA-luser-manage-test] service-type telnet
[DeviceA-luser-manage-test] quit
# 創建ACL並進入ACL視圖,創建規則,僅允許來自192.168.10.1的用戶訪問交換機。
[DeviceA] acl basic 2000
[DeviceA-acl-basic-2000] rule 1 permit source 192.168.10.1 0
[DeviceA-acl-basic-2000] rule 2 deny source any
[DeviceA-acl-basic-2000] quit
# 引用訪問控製列表2000,通過源IP對Telnet用戶進行控製。
[DeviceA] telnet server acl 2000
# 通過Console口登錄設備,進入係統視圖,修改設備名稱,開啟Telnet服務。
<Sysname> system-view
[Sysname] sysname DeviceB
[DeviceB] telnet server enable
# 創建接口地址。
[DeviceB] interface Ten-GigabitEthernet 1/0/1
[Device-Ten-GigabitEthernet1/0/1] port link-mode route
[DeviceB-Ten-GigabitEthernet1/0/1] ip address 192.168.3.1 24
[DeviceB-Ten-GigabitEthernet1/0/1] quit
# 配置所有的Telnet用戶登錄設備的認證方式為none,設置VTY用戶線的公共屬性。
[DeviceB] line vty 0 63
[DeviceB-line-vty0-63] authentication-mode none
[DeviceB-line-vty0-63] screen-length 20
[DeviceB-line-vty0-63] history-command max-size 100
[DeviceB-line-vty0-63] idle-timeout 20
[DeviceB-line-vty0-63] protocol inbound telnet
[DeviceB-line-vty0-63] quit
# 創建ACL並進入ACL視圖,創建規則,僅允許來自192.168.3.2的用戶訪問交換機。
[DeviceB] acl basic 2000
[DeviceB-acl-basic-2000] rule 1 permit source 192.168.3.2 0
[DeviceB-acl-basic-2000] rule 2 deny source any
[DeviceB-acl-basic-2000] quit
# 引用訪問控製列表2000,通過源IP對Telnet用戶進行控製。
[DeviceB] telnet server acl 2000
# 在Host A命令窗口執行Telnet命令登錄到設備,會出現如下界麵。用戶輸入用戶名“test”和密碼“test”後能夠成功登錄到設備上對設備進行操作。
******************************************************************************
* Copyright (c) 2004-2018 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
login: test
Password:
<DeviceA>
# 其他用戶不能通過Telnet登錄到設備,會出現不能連接的提示。
C:\Users\zhangsan>telnet 192.168.10.2
Trying 192.168.10.2 ...
Press CTRL+K to abort
Connected to 192.168.10.2 ...
Failed to connect to the remote host!
# 20分鍾沒有對Device A 進行操作的話會自動退出登錄,此時需要重新登錄。
******************************************************************************
* Copyright (c) 2004-2018 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
login:
# Device A可以執行Telnet到Device B,無需密碼就能夠登錄到Device B並對其進行操作。
<DeviceA> telnet 192.168.3.1
Trying 192.168.3.1 ...
Press CTRL+K to abort
Connected to 192.168.3.1 ...
******************************************************************************
* Copyright (c) 2004-2018 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
<DeviceB>
# 其他設備不能通過Telnet登錄到Device B,會出現不能連接的提示。
[Telnet error. Number: 10061 Description: Connect method failed. No connecti
on could be made because the target machine actively refused it. This usually r
esults from trying to connect to a service that is inactive on the foreign host
- i.e. one with no server application running.]
20分鍾沒有對Device B進行操作的話會自動退出登錄,此時需要重新登錄。
· Device A
#
sysname DeviceA
#
telnet server enable
telnet server acl 2000
#
interface Ten-GigabitEthernet1/0/1
port link-mode route
ip address 192.168.3.2 255.255.255.0
#
interface Ten-GigabitEthernet1/0/2
port link-mode route
ip address 192.168.10.2 255.255.255.0
#
line vty 0 63
authentication-mode scheme
user-role network-operator
protocol inbound telnet
idle-timeout 20 0
screen-length 20
history-command max-size 100
#
acl basic 2000
rule 1 permit source 192.168.10.1 0
rule 2 deny source any
#
local-user test class manage
password hash $h$6$V5dw8qzFDLAOmDzx$upf9K29n110G6OGdSXI0t69IoE5eot/Qh9Iuv/hptq6
2vxUq3867QbUBzmc6/hHwIfVQcDC8gVWpGvDQWXQTSQ==
service-type telnet
authorization-attribute user-role network-admin
#
· Device B
#
sysname DeviceB
#
telnet server enable
telnet server acl 2000
#
interface Ten-GigabitEthernet1/0/1
port link-mode route
ip address 192.168.3.1 255.255.255.0
#
line vty 0 63
authentication-mode none
user-role network-operator
protocol inbound telnet
idle-timeout 20 0
screen-length 20
history-command max-size 100
#
acl basic 2000
rule 1 permit source 192.168.3.2 0
rule 2 deny source any
#
· H3C S6890係列交換機 基礎配置指導(R27xx)
· H3C S6890係列交換機 基礎配置命令參考(R27xx)
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!