什麼型號設備
Host(SSH客戶端)與Router建立本地連接。Host采用SSH協議登錄到Router上,以保證數據信息交換的安全。此處采用的認證方式為password認證,用戶名和密碼保存在Router上。
# 生成RSA密鑰對。
<H3C>system-view
System View: return to User View with Ctrl+Z.
[H3C]public-key local create rsa
The range of public key size is (512 ~ 2048).
NOTES: If the key modulus is greater than 512,
It will take a few minutes.
Press CTRL+C to abort.
Input the bits of the modulus[default = 1024]:
Generating Keys...
++++++++++++++++++++++++++++++++++++++
+++++++++++
+++++++++++++
+++
# 生成DSA密鑰對。
[H3C]public-key local create dsa
The range of public key size is (512 ~ 2048).
NOTES: If the key modulus is greater than 512,
It will take a few minutes.
Press CTRL+C to abort.
Input the bits of the modulus[default = 1024]:
Generating Keys...
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*+++++++++++++
# 啟動SSH服務器。
[H3C]ssh server enable
# 配置VLAN虛接口Vlan-interface 1的IP地址為192.168.1.1,此地址作為SSH服務器的登錄地址。
[H3C]interface Vlan-interface 1
[H3C-Vlan-interface1] ip address 192.168.1.1 255.255.255.0
[H3C-Vlan-interface1]quit
# 設置SSH客戶端登錄用戶界麵的認證方式為password認證。
[H3C] line vty 0 4
[H3C-line-vty0-4]authentication-mode scheme
# 設置Router上遠程用戶登錄協議為SSH。
[H3C-line-vty0-4]protocol inbound ssh
[H3C-line-vty0-4]quit
# 創建本地用戶client001,密碼為aabbcc,並設置用戶訪問的命令級別為最高級別3。
[H3C] local-user client001 class manage
[H3C-luser-manage-client001]password simple aabbcc
[H3C-luser-manage-client001]service-type ssh
[H3C-luser-manage-client001] authorization-attribute user-role network-admin
[H3C-luser-manage-client001]quit
# 配置SSH用戶client001的服務類型為Stelnet,認證方式為password認證(此步驟非必配)。
[H3C]ssh user client001 service-type stelnet authentication-type password
#保存配置
[H3C]save force
(0)
如圖1所示,網絡管理員需要通過Internet遠程登錄到校園網的網關設備(Device)上對其進行相關配置。為了提高對Device進行管理的安全性,可將Device配置為Stelnet服務器,並在Host上運行Stelnet客戶端軟件,在二者之間建立SSH連接。要求:
· Device通過SSH的password認證方式對客戶端進行認證,認證過程在Device本地完成;
· 網絡管理員Host的登錄用戶名為client001,密碼為aabbcc,登錄設備後可以正常使用所有命令。
圖1 設備作為Stelnet服務器配置組網圖
· 為了使SSH的版本協商和算法協商過程正常運行,且為了保證客戶端對連接的服務器的認證正常進行,請在服務器端生成RSA、DSA、ECDSA密鑰對。
· 為了采用本地認證的方式認證用戶,需要在本地服務器Device上創建相應的本地用戶,並在本地用戶視圖下配置密碼。
· Stelnet客戶端通過VTY用戶線訪問設備。因此,需要配置登錄用戶線的認證方式為scheme方式。
· 為了使Stelnet用戶登錄設備後能正常使用所有命令,將用戶角色設置為network-admin,缺省情況下本地用戶的用戶角色為network-operator。
# 生成RSA密鑰對。
<Device> system-view
[Device] public-key local create rsa
The range of public key size 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.
# 生成DSA密鑰對。
[Device] public-key local create dsa
The range of public key size 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密鑰對。
[Device] public-key local create ecdsa
Generating Keys...
.
Create the key pair successfully.
# 使能SSH服務器功能。
[Device] ssh server enable
# 創建VLAN 2,並將Ten-GigabitEthernet1/0/2加入VLAN 2。
[Device] vlan 2
[Device-vlan2] port ten-gigabitethernet 1/0/2
[Device-vlan2] quit
# 配置VLAN接口2的IP地址,客戶端將通過該地址連接Stelnet服務器。
[Device] interface vlan-interface 2
[Device-Vlan-interface2] ip address 192.168.1.40 255.255.255.0
[Device-Vlan-interface2] quit
# 設置Stelnet客戶端登錄用戶界麵的認證方式為scheme。
[Device] line vty 0 63
[Device-line-vty0-63] authentication-mode scheme
[Device-line-vty0-63] quit
# 創建本地用戶client001,並設置用戶密碼、服務類型和用戶角色。
[Device] local-user client001 class manage
New local user added.
[Device-luser-manage-client001] password simple aabbcc
[Device-luser-manage-client001] service-type ssh
[Device-luser-manage-client001] authorization-attribute user-role network-admin
[Device-luser-manage-client001] quit
Stelnet客戶端軟件有很多,例如PuTTY、OpenSSH等。本文中僅以客戶端軟件PuTTY0.60為例,說明Stelnet客戶端的配置方法。
# 安裝PuTTY0.60軟件。
# 打開PuTTY.exe程序,點擊“Session”功能區,出現如圖2所示的客戶端配置界麵。
· 在“Host Name(or IP address)”文本框中輸入Stelnet服務器的IP地址為192.168.1.40。
· 在“Port”文本框中輸入SSH協議端口號22。
· 在“Connection type”區域選擇SSH協議。
圖2 Stelnet客戶端配置界麵
# 在圖2界麵中,單擊<Open>按鈕。彈出“PuTTY Security Alert”對話框。
圖3 Stelnet客戶端登錄界麵(一)
# 單擊“是(Y)”按鈕,並輸入用戶名“client001”和密碼“aabbcc”,即可成功登錄設備使用所有命令。
login as: client001
client001@192.168.1.40's password:
******************************************************************************
* Copyright (c) 2004-2020 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
#
interface Vlan-interface2
ip address 192.168.1.40 255.255.255.0
#
interface Ten-GigabitEthernet1/0/2
port link-mode bridge
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
#
(0)
暫無評論
親~登錄後才可以操作哦!
確定你的郵箱還未認證,請認證郵箱或綁定手機後進行當前操作
舉報
×
侵犯我的權益
×
侵犯了我企業的權益
×
抄襲了我的內容
×
原文鏈接或出處
誹謗我
×
對根叔社區有害的內容
×
不規範轉載
×
舉報說明
暫無評論