26-SSH快速配置指南
本章節下載 (1.40 MB)
SSH快速配置指南
Copyright © 2024 bobty下载软件 版權所有,保留一切權利。
非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部,並不得以任何形式傳播。
除bobty下载软件 的商標外,本手冊中出現的其它公司的商標、產品標識及商品名稱,由各自權利人擁有。
本文檔中的信息可能變動,恕不另行通知。
本案例介紹配置設備作為SSH服務器的方法。
如圖1所示,Switch作為SSH服務器,與客戶端Host1和Host2之間路由可達。Host1和Host2需要通過SSH登錄到Switch上對其進行相關配置。並要求:
· Switch通過SSH的password認證方式和publickey認證方式分別對Host1和Host2進行認證,認證過程在Switch本地完成;
· Host1的登錄用戶名為client001,密碼為hello12345,登錄設備後可以使用所有命令。
· Host2的登錄用戶名為client002,使用的公鑰算法為RSA,登錄設備後可以使用所有命令。
圖1 設備作為SSH服務器組網圖
# 生成RSA密鑰對。
在客戶端運行PuTTYGen.exe,在參數欄中選擇“SSH-2 RSA”,點擊<Generate>,產生客戶端密鑰對。
圖2 生成客戶端密鑰(步驟1)
在產生密鑰對的過程中需不停地移動鼠標,鼠標移動僅限於下圖藍色框中除綠色標記進程條外的地方,否則進程條的顯示會不動,密鑰對將停止產生,見圖3。
密鑰對產生後,點擊<Save public key>,輸入存儲公鑰的文件名key.pub,點擊<保存>按鈕。
圖4 生成客戶端密鑰(步驟3)
點擊<Save private key>存儲私鑰,彈出警告框,提醒是否保存沒做任何保護措施的私鑰,點擊<Yes>,輸入私鑰文件名為private.ppk,點擊保存。
圖5 生成客戶端密鑰(步驟4)
客戶端生成密鑰對後,需要將保存的公鑰文件key.pub通過FTP/TFTP方式上傳到服務器,具體過程略。
# 配置設備生成RSA密鑰對。
<Switch> system-view
[Switch] public-key local create rsa
The range of public key modulus is (512 ~ 4096).
If the key modulus is greater than 512, it will take a few minutes.
Press CTRL+C to abort.
Input the modulus length [default = 1024]:
Generating Keys...
..
Create the key pair successfully.
# 配置設備生成DSA密鑰對。
[Switch] public-key local create dsa
The range of public key modulus is (512 ~ 2048).
If the key modulus is greater than 512, it will take a few minutes.
Press CTRL+C to abort.
Input the modulus length [default = 1024]:
Generating Keys...
......
Create the key pair successfully.
# 配置設備生成ECDSA密鑰對。
[Switch] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.
# 開啟SSH服務器功能。
[Switch] ssh server enable
# 創建VLAN 2,並將Ten-GigabitEthernet1/0/2加入VLAN 2。
[Switch] vlan 2
[Switch-vlan2] port ten-gigabitethernet 1/0/2
[Switch-vlan2] quit
# 配置VLAN接口2的IP地址,客戶端將通過該地址連接SSH服務器。
[Switch] interface vlan-interface 2
[Switch-Vlan-interface2] ip address 192.168.1.40 255.255.255.0
[Switch-Vlan-interface2] quit
# 配置VTY用戶線的認證方式為scheme,SSH客戶端使用VTY用戶線登錄設備。
[Switch] line vty 0 63
[Switch-line-vty0-63] authentication-mode scheme
[Switch-line-vty0-63] quit
# 創建本地用戶client001,並設置用戶密碼為hello12345、服務類型為SSH、用戶角色為network-admin。
[Switch] local-user client001 class manage
New local user added.
[Switch-luser-manage-client001] password simple hello12345
[Switch-luser-manage-client001] service-type ssh
[Switch-luser-manage-client001] authorization-attribute user-role network-admin
[Switch-luser-manage-client001] quit
# 從文件key.pub中導入遠端的公鑰,並命名為switchkey。
[Switch] public-key peer switchkey import sshkey key.pub
# 設置SSH用戶client002的認證方式為publickey,並指定公鑰為switchkey。
[Switch] ssh user client002 service-type stelnet authentication-type publickey assign publickey switchkey
# 創建設備管理類本地用戶client002,並設置服務類型為SSH,用戶角色為network-admin。
[Switch] local-user client002 class manage
New local user added.
[Switch-luser-manage-client002] service-type ssh
[Switch-luser-manage-client002] authorization-attribute user-role network-admin
[Switch-luser-manage-client002] quit
SSH客戶端軟件很多,本文中以客戶端軟件PuTTY0.60為例說明SSH客戶端的配置方法。
# 安裝PuTTY0.60軟件。
# 打開PuTTY.exe程序,點擊“Session”功能區,出現如圖6所示的客戶端配置界麵。
· 在“Host Name(or IP address)”文本框中輸入SSH服務器的IP地址為192.168.1.40。
· 在“Port”文本框中輸入SSH協議端口號22。
· 在“Connection type”區域選擇SSH協議。
圖6 SSH客戶端配置界麵
# 在圖6界麵中,單擊<Open>按鈕。彈出“PuTTY Security Alert”對話框。
圖7 SSH客戶端登錄界麵(一)
# 單擊“Yes”按鈕,並輸入用戶名“client001”和密碼“hello12345”(輸入密碼的不會顯示),即可成功登錄設備並使用所有命令。
圖8 SSH客戶端登錄界麵(二)
# 單擊左側導航欄“Connection->SSH”,出現如圖9的界麵。選擇“Preferred SSH protocol version”為“2”。
圖9 Stelnet客戶端配置界麵
單擊左側導航欄“Connection->SSH”下麵的“Auth”(認證),出現如圖10的界麵。單擊<Browse…>按鈕,彈出文件選擇窗口。選擇與配置到服務器端的公鑰對應的私鑰文件private.ppk。
圖10 Stelnet客戶端配置界麵
單擊<Open>按鈕。按提示輸入用戶名client002,即可進入Switch的配置界麵。
#
vlan 2
#
interface Vlan-interface2
ip address 192.168.1.40 255.255.255.0
#
interface Ten-GigabitEthernet1/0/2
port access vlan 2
#
line vty 0 63
authentication-mode scheme
#
ssh server enable
#
local-user client001 class manage
password hash $h$6$CqMnWdX6LIW/hz2Z$4+0Pumk+A98VlGVgqN3n/mEi7hJka9fEZpRZIpSNi9b
cBEXhpvIqaYTvIVBf7ZUNGnovFsqW7nYxjoToRDvYBg==
service-type ssh
authorization-attribute user-role network-admin
authorization-attribute user-role network-operator
#
public-key peer clientkey import sshkey key.pub
ssh user client002 service-type stelnet authentication-type publickey assign publickey ackey
#
local-user client002 class manage
service-type ssh
authorization-attribute user-role network-admin
#
· 產品配套“安全配置指導”中的“SSH”。
· 產品配套“安全命令參考”中的“SSH”。
本案例介紹配置設備作為SSH客戶端的方法。
如圖11所示,Switch A作為SSH客戶端,Switch B作為SSH服務器,Switch A采用SSH協議遠程登錄到Switch B上。並要求:
· Switch B采用本地認證的方式認證用戶,認證方式為password認證。
· 登錄用戶名為client001,密碼為hello12345,登錄設備後可以使用所有命令。
圖11 設備作為SSH客戶端配置組網圖
# 創建VLAN 2,並將Ten-GigabitEthernet1/0/2加入VLAN 2。
<SwitchA> system-view
[SwitchA] vlan 2
[SwitchA-vlan2] port ten-gigabitethernet 1/0/2
[SwitchA-vlan2] quit
# 配置VLAN接口2的IP地址。
[SwitchA] interface vlan-interface 2
[SwitchA-Vlan-interface2] ip address 192.168.1.56 255.255.255.0
[SwitchA-Vlan-interface2] quit
請參見1 配置設備作為SSH服務器配置Switch B作為SSH服務器。
# Switch A建立到服務器192.168.1.40的SSH連接。輸入正確的用戶名後根據提示輸入Y確認,然後輸入N不保存公鑰,最後輸入密碼,即可成功登錄到Switch B上,用戶角色為network-admin。
若輸入Y保存公鑰,當Switch B公鑰變化時,需要在Switch A係統視圖下執行delete ssh client server-public-key命令刪除已保存的公鑰才能再次建立連接。
<SwitchA> ssh2 192.168.1.40
Username: client001
Press CTRL+C to abort.
Connecting to 192.168.1.40 port 22.
The server is not authenticated. Continue? [Y/N]:Y
Do you want to save the server public key? [Y/N]:N
Enter password:
******************************************************************************
* Copyright (c) 2004-2021 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
<SwitchB>
· Switch A
#
vlan 2
#
interface Vlan-interface2
ip address 192.168.1.56 255.255.255.0
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 2
#
· Switch B
· 產品配套“安全配置指導”中的“SSH”。
· 產品配套“安全命令參考”中的“SSH”。
本案例介紹SSH用戶的RADIUS認證和授權的配置方法。
如圖12所示,通過在作為NAS的Device上配置遠程RADIUS認證、授權功能,實現SSH用戶的安全登錄。在網絡架構上采用主從RADIUS服務器的方式來提高用戶認證的穩定性。要求在Device上配置實現:
· 使用RADIUS服務器對登錄Device的SSH用戶進行認證和授權,登錄用戶名為hello@bbb,密碼為aabbcc;
· Device向RADIUS服務器發送的用戶名帶域名,服務器根據用戶名攜帶的域名來區分提供給用戶的服務。
· 用戶通過認證後可執行係統所有功能和資源的相關display命令。
圖12 SSH用戶的遠端RADIUS認證和授權配置組網圖
· 本節以iMC為例(使用iMC版本為:iMC PLAT 7.0(E0102)、iMC EIA 7.0(E0201)),說明該例中RADIUS服務器的基本配置。
· 主從RADIUS服務器設置相同,本節以主RADIUS服務器設置為例。
# 登錄進入iMC管理平台,選擇“用戶”頁簽,單擊導航樹中的[接入策略管理/接入設備管理/接入設備配置]菜單項,進入接入設備配置頁麵,在該頁麵中單擊“增加”按鈕,進入增加接入設備頁麵。
· 設置與Device交互報文時使用的認證和授權共享密鑰為“expert”;
· 設置認證及計費的端口號分別為“1812”(RADIUS服務器的認證端口為UDP端口1812)和“1813”(RADIUS服務器的計費端口為UDP端口1813);
· 選擇業務類型為“設備管理業務”;
· 選擇接入設備類型為“H3C(General)”;
· 選擇或手工增加接入設備,添加IP地址為10.1.1.2的接入設備;
· 其它參數采用缺省值,並單擊<確定>按鈕完成操作。
圖13 增加接入設備
# 選擇“用戶”頁簽,單擊導航樹中的[接入用戶管理視圖/設備管理用戶]菜單項,進入設備管理用戶列表頁麵,在該頁麵中單擊<增加>按鈕,進入增加設備管理用戶頁麵。
· 輸入用戶名“hello@bbb”和密碼。
· 選擇服務類型為“SSH”。
· 輸入用戶角色名“network-operator”
· 添加所管理設備的IP地址,IP地址範圍為“10.1.1.0~10.1.1.255”。
· 單擊<確定>按鈕完成操作。
添加的所管理設備的IP地址範圍要包含添加的接入設備的IP地址。
圖14 增加設備管理用戶
# 創建VLAN 2,並將Ten-GigabitEthernet1/0/2加入VLAN 2。
<Device> system-view
[Device] vlan 2
[Device-vlan2] port ten-gigabitethernet 1/0/2
[Device-vlan2] quit
# 配置VLAN接口2的IP地址。
[Device] interface vlan-interface 2
[Device-Vlan-interface2] ip address 192.168.1.70 255.255.255.0
[Device-Vlan-interface2] quit
# 創建VLAN 3,並將Ten-GigabitEthernet1/0/1加入VLAN 3。
[Device] vlan 3
[Device-vlan3] port ten-gigabitethernet 1/0/1
[Device-vlan3] quit
# 配置VLAN接口3的IP地址。
[Device] interface vlan-interface 3
[Device-Vlan-interface3] ip address 10.1.1.2 255.255.255.0
[Device-Vlan-interface3] quit
# 生成RSA密鑰對。
[Device] public-key local create rsa
The range of public key modulus is (512 ~ 4096).
If the key modulus is greater than 512, it will take a few minutes.
Press CTRL+C to abort.
Input the modulus length [default = 1024]:
Generating Keys...
...........
Create the key pair successfully.
# 生成DSA密鑰對。
[Device] public-key local create dsa
The range of public key modulus is (512 ~ 2048).
If the key modulus is greater than 512, it will take a few minutes.
Press CTRL+C to abort.
Input the modulus length [default = 1024]:
Generating Keys...
.......
Create the key pair successfully.
# 生成secp256r1類型的ECDSA密鑰對。
[Device] public-key local create ecdsa secp256r1
Generating Keys...
Create the key pair successfully.
# 生成secp384r1類型的ECDSA密鑰對。
[Device] public-key local create ecdsa secp384r1
Generating Keys...
.
Create the key pair successfully.
# 開啟SSH服務器功能。
[Device] ssh server enable
# 配置SSH用戶登錄采用AAA認證方式。
[Device] line vty 0 63
[Device-line-vty0-63] authentication-mode scheme
[Device-line-vty0-63] quit
# 創建RADIUS方案rad。
[Device] radius scheme rad
# 配置主認證服務器的IP地址為10.1.1.1,認證端口號為1812。
[Device-radius-rad] primary authentication 10.1.1.1 1812
# 配置從認證服務器的IP地址為10.1.1.11,認證端口號為1812。
[Device-radius-rad] secondary authentication 10.1.1.11 1812
# 配置主計費服務器的IP地址為10.1.1.1,計費端口號為1813。
[Device-radius-rad] primary accounting 10.1.1.1 1813
# 配置從計費服務器的IP地址為10.1.1.11,計費端口號為1813。
[Device-radius-rad] secondary accounting 10.1.1.11 1813
# 配置與認證和計費服務器交互報文時的共享密鑰為明文expert。
[Device-radius-rad] key authentication simple expert
[Device-radius-rad] key accounting simple expert
# 配置向RADIUS服務器發送的用戶名要攜帶域名。
[Device-radius-rad] user-name-format with-domain
[Device-radius-rad] quit
# 創建ISP域bbb,為login用戶配置AAA認證方法為RADIUS認證、授權和計費。
[Device] domain bbb
[Device-isp-bbb] authentication login radius-scheme rad
[Device-isp-bbb] authorization login radius-scheme rad
[Device-isp-bbb] accounting login radius-scheme rad
[Device-isp-bbb] quit
用戶向Device發起SSH連接,在SSH客戶端按照提示輸入用戶名hello@bbb和密碼aabbcc通過認證,並且獲得用戶角色network-operator(用戶通過認證後可執行係統所有功能和資源的相關display命令)。
主服務器可達時,設備與主RADIUS服務器進行交互。
# 顯示主服務器可達時的RADIUS方案的配置信息。
<Sysname> display radius scheme
Total 1 RADIUS schemes
------------------------------------------------------------------
RADIUS scheme name: rad
Index: 0
Primary authentication server:
Host name: Not Configured
IP : 10.1.1.1 Port: 1812
VPN : Not configured
State: Active
Test profile: Not configured
Weight: 0
Primary accounting server:
Host name: Not Configured
IP : 10.1.1.1 Port: 1813
VPN : Not configured
State: Active
Weight: 0
Second authentication server:
Host name: Not Configured
IP : 10.1.1.11 Port: 1812
VPN : Not configured
State: Active
Test profile: Not configured
Weight: 0
Second accounting server:
Host name: Not Configured
IP : 10.1.1.11 Port: 1813
VPN : Not configured
State: Active
Weight: 0
Accounting-On function : Disabled
extended function : Disabled
retransmission times : 50
retransmission interval(seconds) : 3
Timeout Interval(seconds) : 3
Retransmission Times : 3
Retransmission Times for Accounting Update : 5
Server Quiet Period(minutes) : 5
Realtime Accounting Interval(seconds) : 720
Stop-accounting packets buffering : Enabled
Retransmission times : 500
NAS IP Address : Not configured
VPN : Not configured
User Name Format : with-domain
Data flow unit : Byte
Packet unit : One
Attribute 15 check-mode : Strict
Attribute 25 : Standard
Attribute Remanent-Volume unit : Kilo
server-load-sharing : Disabled
Attribute 31 MAC format : HH-HH-HH-HH-HH-HH
Stop-accounting packets send-force : Disabled
Reauthentication server selection : Inherit
主服務器不可達時,再查看RADIUS方案的配置信息,會發現主服務器的狀態從Active變為Block。此時,設備變成與從RADIUS服務器進行交互。
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 192.168.1.70 255.255.255.0
#
interface Vlan-interface3
ip address 10.1.1.2 255.255.255.0
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 2
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 3
#
line vty 0 63
authentication-mode scheme
user-role network-operator
#
ssh server enable
#
radius scheme rad
primary authentication 10.1.1.1
primary accounting 10.1.1.1
secondary authentication 10.1.1.11
secondary accounting 10.1.1.11
key authentication cipher $c$3$GBZ1jhslcGwSOpSejsESMnOr8Gb8SIT5ew==
key accounting cipher $c$3$nGb/DWK8pxbHaLXQVc+xsmbUr1etIZVd7Q==
#
domain bbb
authentication login radius-scheme rad
authorization login radius-scheme rad
accounting login radius-scheme rad
#
· 產品配套“安全配置指導”中的“SSH”和“AAA”。
· 產品配套“安全命令參考”中的“SSH”和“AAA”。
本案例介紹SSH用戶的HWTACACS認證、授權、計費配置方法。
為了提高遠程訪問的安全性,需要在Device和管理員主機之間建立SSH連接,具體要求如下:
· Device使用Cisco ACS server作為HWTACACS服務器對Stelnet客戶端進行認證和授權;
· 管理員在主機上運行Stelnet客戶端,並采用用戶名manager@bbb和密碼1234ab##登錄Device,且登錄後享有最高配置權限。
圖15 SSH用戶的HWTACACS認證和授權配置舉例
· 為了保證Device可以使用ACS server認證用戶,需要在ACS server上完成添加AAA client以及用戶的相關配置。
· 為了要求用戶通過用戶線登錄Device時輸入用戶名和密碼,需要在Device上配置登錄用戶線的認證方式為scheme方式。
· 未了保證Device能夠對登錄用戶進行認證和授權,需要在Device上完成AAA配置,包括配置ISP域,以及與HWTACACS服務器交互的TACACS方案。
· 為了保證管理員可以運行采用了不同公鑰算法的Stelnet客戶端與Device建立SSH連接,需要在Device上生成RSA、DSA、ECDSA密鑰對。
· 為了使Stelnet用戶登錄設備後能享有最高配置權限,指定缺省用戶角色為network-admin。
· 本文以ACSv4.2為例,說明TACACS server的基本配置。
· 在進行下麵的配置之前,請保證設備管理員的主機與ACS服務器之間路由可達。
(1) 登錄ACS server
# 如圖16所示的Web登錄頁麵中,輸入Web登錄用戶名和密碼,單擊“Login”按鈕,即可登錄ACS server。
圖16 登錄ACS server
(2) 添加接入設備
# 在左側導航欄中選擇[Network Configuration],打開網絡配置界麵,單擊<Add Entry>,進入AAA Client的編輯頁麵。
圖17 添加接入設備
# 在AAA Client的編輯頁麵中進行如下配置:
· 輸入接入設備名稱、接入設備IP地址、交互TACACS報文的共享密鑰;
· 選擇認證協議類型為“TACACS+ (Cisco IOS)”;
· 單擊“Submit + Apply”按鈕完成操作。
圖18 配置接入設備
(3) 添加登錄用戶
# 在左側導航欄中選擇[User Setup],打開用戶配置界麵,在文本框中輸入用戶名“manager”,單擊“Add/Edit”後,進入該用戶的編輯頁麵。
圖19 添加登錄用戶
# 填寫用戶的相關信息,配置用戶登錄密碼,選擇用戶所屬組(本例中使用缺省組)。
圖20 配置登錄用戶信息
# 創建VLAN 2,並將Ten-GigabitEthernet1/0/2加入VLAN 2。
<Device> system-view
[Device] vlan 2
[Device-vlan2] port ten-gigabitethernet 1/0/2
[Device-vlan2] quit
# 配置VLAN接口2的IP地址。
[Device] interface vlan-interface 2
[Device-Vlan-interface2] ip address 192.168.1.65 255.255.255.0
[Device-Vlan-interface2] quit
# 創建VLAN 3,並將Ten-GigabitEthernet1/0/1加入VLAN 3。
[Device] vlan 3
[Device-vlan3] port ten-gigabitethernet 1/0/1
[Device-vlan3] quit
# 配置VLAN接口3的IP地址。
[Device] interface vlan-interface 3
[Device-Vlan-interface3] ip address 10.1.1.2 255.255.255.0
[Device-Vlan-interface3] quit
# 生成RSA密鑰對。
[Device] public-key local create rsa
The range of public key modulus is (512 ~ 4096).
If the key modulus is greater than 512, it will take a few minutes.
Press CTRL+C to abort.
Input the modulus length [default = 1024]:
Generating Keys...
...
Create the key pair successfully.
# 生成DSA密鑰對。
[Device] public-key local create dsa
The range of public key modulus is (512 ~ 2048).
If the key modulus is greater than 512, it will take a few minutes.
Press CTRL+C to abort.
Input the modulus length [default = 1024]:
Generating Keys...
........
Create the key pair successfully.
# 生成secp256r1類型的ECDSA密鑰對。
[Device] public-key local create ecdsa secp256r1
Generating Keys...
Create the key pair successfully.
# 生成secp384r1類型的ECDSA密鑰對。
[Device] public-key local create ecdsa secp384r1
Generating Keys...
.
Create the key pair successfully.
# 使能SSH服務器功能。
[Device] ssh server enable
# 設置Stelnet客戶端登錄用戶界麵的認證方式為scheme。
[Device] line vty 0 63
[Device-line-vty0-63] authentication-mode scheme
[Device-line-vty0-63] quit
# 使能缺省用戶角色授權功能,使得認證通過後的用戶具有缺省的用戶角色network-admin。
[Device] role default-role enable network-admin
# 創建TACACS方案rad。
[Device] hwtacacs scheme tac
# 配置主認證服務器的IP地址為10.1.1.1,認證端口號為49。
[Device-hwtacacs-tac] primary authentication 10.1.1.1 49
# 配置與認證服務器交互報文時的共享密鑰為明文expert。
[Device-hwtacacs-tac] key authentication simple expert
# 配置主授權服務器的IP地址為10.1.1.1,授權端口號為49。
[Device-hwtacacs-tac] primary authorization 10.1.1.1 49
# 配置與授權服務器交互報文時的共享密鑰為明文expert。
[Device-hwtacacs-tac] key authorization simple expert
# 配置向TACACS服務器發送的用戶名不攜帶域名。
[Device-hwtacacs-tac] user-name-format without-domain
[Device-hwtacacs-tac] quit
# 創建ISP域bbb,為login用戶配置AAA認證方法為TACACS認證/授權、不計費。
[Device] domain bbb
[Device-isp-bbb] authentication login hwtacacs-scheme tac
[Device-isp-bbb] authorization login hwtacacs-scheme tac
[Device-isp-bbb] accounting login none
[Device-isp-bbb] quit
Stelnet客戶端軟件有很多,例如PuTTY、OpenSSH等。本文中僅以客戶端軟件PuTTY0.60為例,說明Stelnet客戶端的配置方法。
# 安裝PuTTY 0.60軟件。
# 打開PuTTY.exe程序,點擊“Session”功能區,在圖21所示的配置界麵中進行如下配置:
· 在“Host Name(or IP address)”文本框中輸入Stelnet服務器的IP地址為192.168.1.65。
· 在“Port”文本框中輸入SSH協議端口號22。
· 在“Connection type”區域選擇SSH協議。
# 單擊<Open>按鈕。
圖21 Stelnet客戶端配置界麵
# 如果彈出圖22所示“PuTTY Security Alert”對話框,請根據實際情況做出選擇。本例中選擇信任該服務器,則單擊“Yes”按鈕。
圖22 Stelnet客戶端登錄界麵(一)
# 如果彈出圖23所示“PuTTY Security Alert”對話框,請根據實際情況做出選擇。本例中選擇信任該主機密鑰,則單擊“Yes”按鈕。
圖23 Stelnet客戶端登錄界麵(二)
# 在如下登錄界麵中輸入用戶名manager@bbb和密碼1234ab##,即可成功登錄設備使用所有命令。
login as: manager@bbb
manager@[email protected]'s password:
******************************************************************************
* 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. *
******************************************************************************
<Device>
#
vlan 2 to 3
#
interface Vlan-interface2
ip address 192.168.1.65 255.255.255.0
#
interface Vlan-interface3
ip address 10.1.1.2 255.255.255.0
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
port access vlan 2
#
interface Ten-GigabitEthernet1/0/1
port link-mode bridge
port access vlan 3
#
line vty 0 63
authentication-mode scheme
user-role network-operator
#
ssh server enable
#
hwtacacs scheme tac
primary authentication 10.1.1.1
primary authorization 10.1.1.1
key authentication cipher $c$3$/9bCuPjMxjOtUvBx8NjtN+AnAsuLT2SrNA==
key authorization cipher $c$3$QF/fFJNv9IyKyFlsNOpeBYnDXArNhOvOdQ==
user-name-format without-domain
#
domain bbb
authentication login hwtacacs-scheme tac
authorization login hwtacacs-scheme tac
accounting login none
#
role default-role enable network-admin
#
· 產品配套“安全配置指導”中的“SSH”。
· 產品配套“安全命令參考”中的“SSH”。
· 產品配套“安全配置指導”中的“AAA”。
· 產品配套“安全命令參考”中的“AAA”。
本案例介紹SSH用戶的AAA local認證配置方法。
通過配置Switch實現AAA local認證。SSH用戶的用戶名為client001,密碼為hello12345,登錄設備後可以使用所有命令。
圖24 SSH用戶local認證配置組網圖
# 創建VLAN 2,並將Ten-GigabitEthernet1/0/2加入VLAN 2。
[Switch] vlan 2
[Switch-vlan2] port ten-gigabitethernet 1/0/2
[Switch-vlan2] quit
# 配置VLAN接口2的IP地址,客戶端將通過該地址連接SSH服務器。
[Switch] interface vlan-interface 2
[Switch-Vlan-interface2] ip address 192.168.1.40 255.255.255.0
[Switch-Vlan-interface2] quit
# 創建本地RSA及DSA密鑰對。
<Switch> system-view
[Switch] public-key local create rsa
[Switch] public-key local create dsa
# 使能SSH服務器功能。
[Switch] ssh server enable
# 設置SSH用戶登錄用戶線的認證方式為AAA認證。
[Switch] line vty 0 63
[Switch-line-vty0-63] authentication-mode scheme
[Switch-line-vty0-63] quit
# 創建本地用戶client001,並設置用戶密碼為hello12345、服務類型為SSH、用戶角色為network-admin。
[Switch] local-user client001 class manage
New local user added.
[Switch-luser-manage-client001] password simple hello12345
[Switch-luser-manage-client001] service-type ssh
[Switch-luser-manage-client001] authorization-attribute user-role network-admin
[Switch-luser-manage-client001] quit
# 創建ISP域bbb,為login用戶配置AAA認證方法為本地認證。
[Switch] domain bbb
[Switch-isp-bbb] authentication login local
[Switch-isp-bbb] quit
SSH客戶端軟件很多,本文中以客戶端軟件PuTTY0.60為例說明SSH客戶端的配置方法。
# 安裝PuTTY0.60軟件。
# 打開PuTTY.exe程序,點擊“Session”功能區,出現如圖25所示的客戶端配置界麵。
· 在“Host Name(or IP address)”文本框中輸入SSH服務器的IP地址為192.168.1.40。
· 在“Port”文本框中輸入SSH協議端口號22。
· 在“Connection type”區域選擇SSH協議。
圖25 SSH客戶端配置界麵
# 在圖25界麵中,單擊<Open>按鈕。彈出“PuTTY Security Alert”對話框。
圖26 SSH客戶端登錄界麵(一)
# 單擊“Yes”按鈕,並輸入用戶名“client001”和密碼“hello12345”(輸入密碼的不會顯示),即可成功登錄設備並使用所有命令。
圖27 SSH客戶端登錄界麵(二)
#
vlan 2
#
interface Vlan-interface2
ip address 192.168.1.40 255.255.255.0
#
interface GigabitEthernet1/0/2
port link-mode bridge
port access vlan 2
#
line vty 0 63
authentication-mode scheme
user-role network-operator
#
ssh server enable
#
domain bbb
authentication login local
#
local-user client001 class manage
password hash $h$6$rLDGxBtUHlyovI15$k8yc//6l73h6CRK89jqTVf8Hu6VicbEl5EjUPqzykYj33YSQxPdHrSr+BIMeZUZDfsRAiy28ME9Vhb7VcVXpZw==
service-type ssh
authorization-attribute user-role network-admin
authorization-attribute user-role network-operator
#
· 產品配套“安全配置指導”中的“SSH”。
· 產品配套“安全命令參考”中的“SSH”。
· 產品配套“安全配置指導”中的“AAA”。
· 產品配套“安全命令參考”中的“AAA”。
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!