002-H3C無線控製器SSH典型配置舉例
本章節下載: 002-H3C無線控製器SSH典型配置舉例 (660.40 KB)
H3C無線控製器SSH典型配置舉例
Copyright © 2023 bobty下载软件 版權所有,保留一切權利。
非經本公司書麵許可,任何單位和個人不得擅自摘抄、複製本文檔內容的部分或全部,並不得以任何形式傳播。
除bobty下载软件 的商標外,本手冊中出現的其它公司的商標、產品標識及商品名稱,由各自權利人擁有。
本文檔中的信息可能變動,恕不另行通知。
目 錄
3 設備作為Stelnet服務器配置舉例(password認證)
4 設備作為Stelnet服務器配置舉例(publickey認證)
5 設備作為Stelnet客戶端配置舉例(password認證)
6 設備作為Stelnet客戶端配置舉例(publickey認證)
8 設備作為SFTP客戶端配置舉例(publickey認證)
10 NETCONF over SSH配置舉例(password認證)
本文檔介紹SSH典型配置舉例。
本文檔適用於使用Comware軟件版本的無線控製器和接入點產品,不嚴格與具體軟、硬件版本對應,如果使用過程中與產品實際情況有差異,請參考相關產品手冊,或以設備實際情況為準。
本文檔中的配置均是在實驗室環境下進行的配置和驗證,配置前設備的所有參數均采用出廠時的缺省配置。如果您已經對設備進行了配置,為了保證配置效果,請確認現有配置和以下舉例中的配置不衝突。
本文檔假設您已了解WLAN接入和SSH的特性。
無線控製器和客戶端路由可達。
· 用戶可以通過Client上運行的Stelnet客戶端軟件(SSH2版本)安全地登錄到AC上,並被授予用戶角色network-admin進行配置管理;
· AC采用password認證方式對Stelnet客戶端進行認證,客戶端的用戶名和密碼保存在本地。
圖1 設備作為Stelnet服務器配置組網圖
(1) 配置Stelnet服務器
# 生成RSA密鑰對。
<AC> system-view
[AC] 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密鑰對。
[AC] 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密鑰對。
[AC] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.
# 使能Stelnet服務器功能。
[AC] ssh server enable
# 配置VLAN接口2的IP地址,客戶端將通過該地址連接Stelnet服務器。
[AC] interface vlan-interface 2
[AC-Vlan-interface2] ip address 192.168.1.40 255.255.255.0
[AC-Vlan-interface2] quit
# 設置Stelnet客戶端登錄用戶線的認證方式為AAA認證。
[AC] line vty 0 15
[AC-line-vty0-15] authentication-mode scheme
[AC-line-vty0-15] quit
# 創建設備管理類本地用戶client001,並設置密碼為明文aabbcc,服務類型為SSH,用戶角色為network-admin。
[AC] local-user client001 class manage
[AC-luser-manage-client001] password simple aabbcc
[AC-luser-manage-client001] service-type ssh
[AC-luser-manage-client001] authorization-attribute user-role network-admin
[AC-luser-manage-client001] quit
# 配置SSH用戶client001的服務類型為Stelnet,認證方式為password認證。(此步驟可以不配置)
[AC] ssh user client001 service-type stelnet authentication-type password
Stelnet客戶端軟件有很多,例如PuTTY、OpenSSH等。本文中僅以客戶端軟件PuTTY0.58為例,說明Stelnet客戶端的配置方法。
# 建立與Stelnet服務器端的連接。
打開PuTTY.exe程序,出現如圖2所示的客戶端配置界麵。在“Host Name(or IP address)”文本框中輸入Stelnet服務器的IP地址為192.168.1.40。
圖2 Stelnet客戶端配置界麵
在圖2中,單擊<Open>按鈕。按提示輸入用戶名client001及密碼aabbcc,即可進入AC的配置界麵。
· 用戶可以通過Client上運行的Stelnet客戶端軟件(SSH2版本)安全地登錄到AC上,並被授予用戶角色network-admin進行配置管理;
· AC采用publickey認證方式對Stelnet客戶端進行認證,使用的公鑰算法為RSA。
圖3 設備作為Stelnet服務器配置組網圖
· 在服務器的配置過程中需要指定客戶端的公鑰信息,因此建議首先完成客戶端密鑰對的配置,再進行服務器的配置。
· 客戶端軟件有很多,例如PuTTY、OpenSSH等。本文中僅以客戶端軟件PuTTY0.58為例,說明Stelnet客戶端的配置方法。
(1) 配置Stelnet客戶端
# 生成RSA密鑰對。
在客戶端運行PuTTYGen.exe,在參數欄中選擇“SSH-2 RSA”,點擊<Generate>,產生客戶端密鑰對。
圖4 生成客戶端密鑰(步驟1)
在產生密鑰對的過程中需不停地移動鼠標,鼠標移動僅限於下圖藍色框中除綠色標記進程條外的地方,否則進程條的顯示會不動,密鑰對將停止產生,見圖5。
密鑰對產生後,點擊<Save public key>,輸入存儲公鑰的文件名key.pub,點擊<保存>按鈕。
圖6 生成客戶端密鑰(步驟3)
點擊<Save private key>存儲私鑰,彈出警告框,提醒是否保存沒做任何保護措施的私鑰,點擊<Yes>,輸入私鑰文件名為private.ppk,點擊保存。
圖7 生成客戶端密鑰(步驟4)
客戶端生成密鑰對後,需要將保存的公鑰文件key.pub通過FTP/TFTP方式上傳到服務器,具體過程略。
(2) 配置Stelnet服務器
# 生成RSA密鑰對。
<AC> system-view
[AC] 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密鑰對。
[AC] 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密鑰對。
[AC] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.
# 使能Stelnet服務器功能。
[AC] ssh server enable
# 配置VLAN接口2的IP地址,客戶端將通過該地址連接Stelnet服務器。
[AC] interface vlan-interface 2
[AC-Vlan-interface2] ip address 192.168.1.40 255.255.255.0
[AC-Vlan-interface2] quit
# 設置Stelnet客戶端登錄用戶線的認證方式為AAA認證。
[AC] line vty 0 15
[AC-line-vty0-15] authentication-mode scheme
[AC-line-vty0-15] quit
# 從文件key.pub中導入遠端的公鑰,並命名為ackey。
[AC] public-key peer ackey import sshkey key.pub
# 設置SSH用戶client002的認證方式為publickey,並指定公鑰為ackey。
[AC] ssh user client002 service-type stelnet authentication-type publickey assign publickey ackey
# 創建設備管理類本地用戶client002,並設置服務類型為SSH,用戶角色為network-admin。
[AC] local-user client002 class manage
[AC-luser-manage-client002] service-type ssh
[AC-luser-manage-client002] authorization-attribute user-role network-admin
[AC-luser-manage-client002] quit
# 指定私鑰文件,並建立與Stelnet服務器的連接。
打開PuTTY.exe程序,出現如圖8所示的客戶端配置界麵。在“Host Name(or IP address)”文本框中輸入Stelnet服務器的IP地址為192.168.1.40。
圖8 Stelnet客戶端配置界麵
# 單擊左側導航欄“Connection->SSH”,出現如圖9的界麵。選擇“Preferred SSH protocol version”為“2”。
圖9 Stelnet客戶端配置界麵
單擊左側導航欄“Connection->SSH”下麵的“Auth”(認證),出現如圖10的界麵。單擊<Browse…>按鈕,彈出文件選擇窗口。選擇與配置到服務器端的公鑰對應的私鑰文件private.ppk。
圖10 Stelnet客戶端配置界麵
如圖10,單擊<Open>按鈕。按提示輸入用戶名client002,即可進入Switch的配置界麵。
· 配置AC作為Stelnet客戶端,用戶能夠通過AC安全地登錄到Switch上,並被授予用戶角色network-admin進行配置管理。
· Switch作為Stelnet服務器采用password認證方式對Stelnet客戶端進行認證,客戶端的用戶名和密碼保存在Switch上。
圖11 設備作為Stelnet客戶端配置組網圖
(1) 配置Stelnet服務器
# 生成RSA密鑰對。
<Switch> system-view
[Switch] 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密鑰對。
[Switch] 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密鑰對。
[Switch] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.
# 使能Stelnet服務器功能。
[Switch] ssh server enable
# 配置VLAN接口2的IP地址,客戶端將通過該地址連接Stelnet服務器。
[Switch] interface vlan-interface 2
[Switch-Vlan-interface2] ip address 192.168.1.40 255.255.255.0
[Switch-Vlan-interface2] quit
# 設置Stelnet客戶端登錄用戶線的認證方式為AAA認證。
[Switch] line vty 0 15
[Switch-line-vty0-15] authentication-mode scheme
[Switch-line-vty0-15] quit
# 創建設備管理類本地用戶client001,並設置密碼為明文aabbcc,服務類型為SSH,用戶角色為network-admin。
[Switch] local-user client001 class manage
[Switch-luser-manage-client001] password simple aabbcc
[Switch-luser-manage-client001] service-type ssh
[Switch-luser-manage-client001] authorization-attribute user-role network-admin
[Switch-luser-manage-client001] quit
# 配置SSH用戶client001的服務類型為Stelnet,認證方式為password認證。(此步驟可以不配置)
[Switch] ssh user client001 service-type stelnet authentication-type password
(2) Stelnet客戶端建立與Stelnet服務器的連接
# 配置VLAN接口2的IP地址。
<AC> system-view
[AC] interface vlan-interface 2
[AC-Vlan-interface2] ip address 192.168.1.56 255.255.255.0
[AC-Vlan-interface2] quit
[AC] quit
· 客戶端本地沒有服務器端的主機公鑰,首次與服務器建立連接
# 建立到服務器192.168.1.40的SSH連接,選擇在不認證服務器的情況下繼續訪問服務網,並在客戶端保存服務器端的本地公鑰。
<AC> 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]:y
[email protected]'s password:
Enter a character ~ and a dot to abort.
******************************************************************************
* Copyright (c) 2004-2019 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
<Switch>
輸入正確的用戶名和密碼之後,即可成功登錄到Switch上。由於選擇在本地保存服務器端的主機公鑰,下次用戶登錄Switch時直接輸入正確密碼即可成功登錄。
· 客戶端配置服務器端的主機公鑰後,與服務器建立連接
# 在客戶端配置SSH服務器端的主機公鑰。在公鑰視圖輸入服務器端的主機公鑰,即在服務器端通過display public-key local dsa public命令顯示的公鑰內容。
[AC] public-key peer key1
Enter public key view. Return to system view with "peer-public-key end" command.
[AC-pkey-public-key-key1]308201B73082012C06072A8648CE3804013082011F0281810
0D757262C4584C44C211F18BD96E5F0
[AC-pkey-public-key-key1]61C4F0A423F7FE6B6B85B34CEF72CE14A0D3A5222FE08CECE
65BE6C265854889DC1EDBD13EC8B274
[AC-pkey-public-key-key1]DA9F75BA26CCB987723602787E922BA84421F22C3C89CB9B0
6FD60FE01941DDD77FE6B12893DA76E
[AC-pkey-public-key-key1]EBC1D128D97F0678D7722B5341C8506F358214B16A2FAC4B3
68950387811C7DA33021500C773218C
[AC-pkey-public-key-key1]737EC8EE993B4F2DED30F48EDACE915F0281810082269009E
14EC474BAF2932E69D3B1F18517AD95
[AC-pkey-public-key-key1]94184CCDFCEAE96EC4D5EF93133E84B47093C52B20CD35D02
492B3959EC6499625BC4FA5082E22C5
[AC-pkey-public-key-key1]B374E16DD00132CE71B020217091AC717B612391C76C1FB2E
88317C1BD8171D41ECB83E210C03CC9
[AC-pkey-public-key-key1]B32E810561C21621C73D6DAAC028F4B1585DA7F42519718CC
9B09EEF0381840002818000AF995917
[AC-pkey-public-key-key1]E1E570A3F6B1C2411948B3B4FFA256699B3BF871221CC9C5D
F257523777D033BEE77FC378145F2AD
[AC-pkey-public-key-key1]D716D7DB9FCABB4ADBF6FB4FDB0CA25C761B308EF53009F71
01F7C62621216D5A572C379A32AC290
[AC-pkey-public-key-key1]E55B394A217DA38B65B77F0185C8DB8095522D1EF044B465E
8716261214A5A3B493E866991113B2D
[AC-pkey-public-key-key1]485348
[AC-pkey-public-key-key1] peer-public-key end
[AC] quit
# 建立到服務器192.168.1.40的SSH連接,並指定服務器端的主機公鑰。
<AC> ssh2 192.168.1.40 public-key key1
Username: client001
Press CTRL+C to abort.
Connecting to 192.168.1.40 port 22.
[email protected]'s password:
Enter a character ~ and a dot to abort.
******************************************************************************
* Copyright (c) 2004-2019 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
<Switch>
輸入正確的用戶名和密碼之後,即可成功登錄到Switch B上。
· 客戶端本地已有服務器端的主機公鑰,直接與服務器建立連接
<AC> ssh2 192.168.1.40
Username: client001
Press CTRL+C to abort.
Connecting to 192.168.1.40 port 22.
[email protected]'s password:
Enter a character ~ and a dot to abort.
******************************************************************************
* Copyright (c) 2004-2019 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
<Switch>
輸入正確的密碼之後,即可成功登錄到Switch B上。
· 配置AC作為Stelnet客戶端,用戶能夠通過AC安全地登錄到Switch上,並被授予用戶角色network-admin進行配置管理。
· Switch作為Stelnet服務器采用publickey認證方式對Stelnet客戶端進行認證,使用的公鑰算法為DSA。
圖12 設備作為Stelnet客戶端配置組網圖
在服務器的配置過程中需要指定客戶端的公鑰信息,因此需要首先完成客戶端密鑰對的配置,再進行服務器的配置。
(1) 配置Stelnet客戶端
# 配置VLAN接口2的IP地址。
<AC> system-view
[AC] interface vlan-interface 2
[AC-Vlan-interface2] ip address 192.168.1.56 255.255.255.0
[AC-Vlan-interface2] quit
# 生成DSA密鑰對。
[AC] 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.
# 將生成的DSA主機公鑰導出到指定文件key.pub中。
[AC] public-key local export dsa ssh2 key.pub
[AC] quit
客戶端生成密鑰對後,需要將保存的公鑰文件key.pub通過FTP/TFTP方式上傳到服務器,具體過程略。
(2) 配置Stelnet服務器
# 生成RSA密鑰對。
<Switch> system-view
[Switch] 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密鑰對。
[Switch] 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密鑰對。
[Switch] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.
# 使能Stelnet服務器功能。
[Switch] ssh server enable
# 配置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
# 設置Stelnet客戶端登錄用戶線的認證方式為AAA認證。
[Switch] line vty 0 15
[Switch-line-vty0-15] authentication-mode scheme
[Switch-line-vty0-15] quit
# 從文件key.pub中導入遠端的公鑰,並命名為ackey。
[Switch] public-key peer ackey import sshkey key.pub
# 設置SSH用戶client002的認證方式為publickey,並指定公鑰為ackey。
[Switch] ssh user client002 service-type stelnet authentication-type publickey assign publickey ackey
# 創建設備管理類本地用戶client002,並設置服務類型為SSH,用戶角色為network-admin。
[Switch] local-user client002 class manage
[Switch-luser-manage-client002] service-type ssh
[Switch-luser-manage-client002] authorization-attribute user-role network-admin
[Switch-luser-manage-client002] quit
# 建立到服務器192.168.1.40的SSH連接。
<AC> ssh2 192.168.1.40
Username: client002
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 a character ~ and a dot to abort.
******************************************************************************
* Copyright (c) 2004-2019 New H3C Technologies Co., Ltd. All rights reserved.*
* Without the owner's prior written consent, *
* no decompiling or reverse-engineering shall be allowed. *
******************************************************************************
<Switch>
由於本地未保存服務器端的主機公鑰,因此在選擇繼續訪問服務器之後,即可成功登錄到Switch B上。
· Client和AC 之間建立SSH連接,Client作為SFTP客戶端登錄到AC,,並被授予用戶角色network-admin進行文件管理和文件傳送等操作;
· AC采用password認證方式對SFTP客戶端進行認證,客戶端的用戶名和密碼保存在本地。
· AC和Client之間路由可達。
圖13 設備作為SFTP服務器配置組網圖
(1) 配置SFTP服務器
# 生成RSA密鑰對。
<AC> system-view
[AC] 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密鑰對。
[AC] 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密鑰對。
[AC] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.
# 啟動SFTP服務器。
[AC] sftp server enable
# 配置VLAN接口2的IP地址,客戶端將通過該地址連接SSH服務器。
[AC] interface vlan-interface 2
[AC-Vlan-interface2] ip address 192.168.1.45 255.255.255.0
[AC-Vlan-interface2] quit
# 創建設備管理類本地用戶client002,並設置密碼為明文aabbcc,服務類型為SSH,用戶角色為network-admin,工作目錄為cfa0:/。
[AC] local-user client002 class manage
[AC-luser-manage-client002] password simple aabbcc
[AC-luser-manage-client002] service-type ssh
[AC-luser-manage-client002] authorization-attribute user-role network-admin work-directory cfa0:/
[AC-luser-manage-client002] quit
# 配置SSH用戶認證方式為password,服務類型為SFTP。(此步驟可以不配置)
[AC] ssh user client002 service-type sftp authentication-type password
· SFTP客戶端軟件有很多,本文中僅以客戶端軟件PuTTY0.58中的PSFTP為例,說明SFTP客戶端的配置方法。
· PSFTP隻支持password認證,不支持publickey認證。
# 建立與SFTP服務器的連接。
打開psftp.exe程序,出現如圖14所示的客戶端配置界麵。輸入如下命令:
open 192.168.1.45
根據提示輸入用戶名client002,密碼aabbcc,即可登錄SFTP服務器。
圖14 SFTP客戶端登錄界麵
· 配置AC 1作為SFTP客戶端,用戶能夠通過AC 1安全地登錄到AC 2上,並被授予用戶角色network-admin進行文件管理和文件傳送等操作。
· AC 2作為SFTP服務器采用publickey認證方式對SFTP客戶端進行認證,使用的公鑰算法為RSA。
圖15 設備作為SFTP客戶端配置組網圖
在服務器的配置過程中需要指定客戶端的公鑰信息,因此建議首先完成客戶端密鑰對的配置,再進行服務器的配置。
(1) 配置SFTP客戶端
# 配置VLAN接口2的IP地址。
<AC1> system-view
[AC1] interface vlan-interface 2
[AC1-Vlan-interface2] ip address 192.168.0.2 255.255.255.0
[AC1-Vlan-interface2] quit
# 生成RSA密鑰對。
[AC1] 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.
# 將生成的RSA主機公鑰導出到指定文件pubkey中。
[AC1] public-key local export rsa ssh2 pubkey
[AC1] quit
客戶端生成密鑰對後,需要將保存的公鑰文件pubkey通過FTP/TFTP方式上傳到服務器,具體過程略。
(2) 配置SFTP服務器
# 生成RSA密鑰對。
<AC2> system-view
[AC2] 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密鑰對。
[AC2] 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密鑰對。
[AC2] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.
# 啟動SFTP服務器。
[AC2] sftp server enable
# 配置VLAN接口2的IP地址,客戶端將通過該地址連接SSH服務器。
[AC2] interface vlan-interface 2
[AC2-Vlan-interface2] ip address 192.168.0.1 255.255.255.0
[AC2-Vlan-interface2] quit
# 從文件pubkey中導入遠端的公鑰,並命名為ackey。
[AC2] public-key peer ackey import sshkey pubkey
# 設置SSH用戶client001的服務類型為SFTP,認證方式為publickey,並指定公鑰為ackey。
[AC2] ssh user client001 service-type sftp authentication-type publickey assign publickey ackey
# 創建設備管理類本地用戶client001,並設置服務類型為SSH,用戶角色為network-admin,工作目錄為cfa0:/。
[AC2] local-user client001 class manage
[AC2-luser-manage-client001] service-type ssh
[AC2-luser-manage-client001] authorization-attribute user-role network-admin work-directory cfa0:/
[AC2-luser-manage-client001] quit
# 與遠程SFTP服務器建立連接,進入SFTP客戶端視圖。
<AC1> sftp 192.168.0.1 identity-key rsa
Username: client001
Press CTRL+C to abort.
Connecting to 192.168.0.1 port 22.
The server is not authenticated. Continue? [Y/N]:y
Do you want to save the server public key? [Y/N]:n
sftp>
# 顯示服務器的當前目錄,刪除文件z,並檢查此文件是否刪除成功。
sftp> dir -l
-rwxrwxrwx 1 noone nogroup 1759 Aug 23 06:52 config.cfg
-rwxrwxrwx 1 noone nogroup 225 Aug 24 08:01 pubkey2
-rwxrwxrwx 1 noone nogroup 283 Aug 24 07:39 pubkey
drwxrwxrwx 1 noone nogroup 0 Sep 01 06:22 new
-rwxrwxrwx 1 noone nogroup 225 Sep 01 06:55 pub
-rwxrwxrwx 1 noone nogroup 0 Sep 01 08:00 z
sftp> delete z
Removing /z
sftp> dir -l
-rwxrwxrwx 1 noone nogroup 1759 Aug 23 06:52 config.cfg
-rwxrwxrwx 1 noone nogroup 225 Aug 24 08:01 pubkey2
-rwxrwxrwx 1 noone nogroup 283 Aug 24 07:39 pubkey
drwxrwxrwx 1 noone nogroup 0 Sep 01 06:22 new
-rwxrwxrwx 1 noone nogroup 225 Sep 01 06:55 pub
# 新增目錄new1,並檢查新目錄是否創建成功。
sftp> mkdir new1
sftp> dir -l
-rwxrwxrwx 1 noone nogroup 1759 Aug 23 06:52 config.cfg
-rwxrwxrwx 1 noone nogroup 225 Aug 24 08:01 pubkey2
-rwxrwxrwx 1 noone nogroup 283 Aug 24 07:39 pubkey
drwxrwxrwx 1 noone nogroup 0 Sep 01 06:22 new
-rwxrwxrwx 1 noone nogroup 225 Sep 01 06:55 pub
drwxrwxrwx 1 noone nogroup 0 Sep 02 06:30 new1
# 將目錄名new1更名為new2,並查看是否更名成功。
sftp> rename new1 new2
sftp> dir -l
-rwxrwxrwx 1 noone nogroup 1759 Aug 23 06:52 config.cfg
-rwxrwxrwx 1 noone nogroup 225 Aug 24 08:01 pubkey2
-rwxrwxrwx 1 noone nogroup 283 Aug 24 07:39 pubkey
drwxrwxrwx 1 noone nogroup 0 Sep 01 06:22 new
-rwxrwxrwx 1 noone nogroup 225 Sep 01 06:55 pub
drwxrwxrwx 1 noone nogroup 0 Sep 02 06:33 new2
# 從服務器上下載文件pubkey2到本地,並更名為public。
sftp> get pubkey2 public
Fetching / pubkey2 to public
/pubkey2 100% 225 1.4KB/s 00:00
# 將本地文件pu上傳到服務器上,更名為puk,並查看上傳是否成功。
sftp> put pu puk
Uploading pu to / puk
sftp> dir -l
-rwxrwxrwx 1 noone nogroup 1759 Aug 23 06:52 config.cfg
-rwxrwxrwx 1 noone nogroup 225 Aug 24 08:01 pubkey2
-rwxrwxrwx 1 noone nogroup 283 Aug 24 07:39 pubkey
drwxrwxrwx 1 noone nogroup 0 Sep 01 06:22 new
drwxrwxrwx 1 noone nogroup 0 Sep 02 06:33 new2
-rwxrwxrwx 1 noone nogroup 283 Sep 02 06:35 pub
-rwxrwxrwx 1 noone nogroup 283 Sep 02 06:36 puk
sftp>
# 退出SFTP客戶端視圖。
sftp> quit
<AC1>
如下圖所示,AC 1作為SCP客戶端,AC 2作為SCP服務器。現有如下具體需求:
· 用戶能夠通過AC 1安全地安全地登錄到AC 2上,並被授予用戶角色network-admin與AC 2進行文件傳輸。
· AC 2采用password認證對SCP客戶端進行認證,客戶端的用戶名和密碼保存在AC 2上。
圖16 SCP文件傳輸配置組網圖
(1) 配置SCP服務器
# 生成RSA密鑰對。
<AC2> system-view
[AC2] 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密鑰對。
[AC2] 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密鑰對。
[AC2] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.
# 使能SCP服務器功能。
[AC2] scp server enable
# 配置接口VLAN接口2的IP地址,客戶端將通過該地址連接SCP服務器。
[AC2] interface vlan-interface 2
[AC2-Vlan-interface2] ip address 192.168.0.1 255.255.255.0
[AC2-Vlan-interface2] quit
# 創建設備管理類本地用戶client001,並設置密碼為明文aabbcc,服務類型為SSH。
[AC2] local-user client001 class manage
[AC2-luser-manage-client001] password simple aabbcc
[AC2-luser-manage-client001] service-type ssh
[AC2-luser-manage-client001] authorization-attribute user-role network-admin
[AC2-luser-manage-client001] quit
# 配置SSH用戶client001的服務類型為scp,認證方式為password認證。(此步驟可以不配置)
[AC2] ssh user client001 service-type scp authentication-type password
(2) 配置SCP客戶端
# 配置接口VLAN 2的IP地址。
<AC1> system-view
[AC1] interface vlan-interface 2
[AC1-Vlan-interface2] ip address 192.168.0.2 255.255.255.0
[AC1-Vlan-interface2] quit
[AC1] quit
# 與遠程SCP服務器建立連接,並下載遠端的remote.bin文件,下載到本地後更名為local.bin。
<AC1> scp 192.168.0.1 get remote.bin local.bin
Username: client001
Press CTRL+C to abort.
Connecting to 192.168.0.1 port 22.
The server is not authenticated. Continue? [Y/N]:y
Do you want to save the server public key? [Y/N]:n
[email protected]’s password:
remote.bin 100% 2875 2.8KB/s 00:00
· 用戶可以通過Client上運行的支持NETCONF over SSH連接的SSH客戶端軟件(SSH2版本)安全地登錄到AC上,並被授予用戶角色network-admin進行配置管理;
· AC采用password認證方式對Stelnet客戶端進行認證,客戶端的用戶名和密碼保存在本地。
· AC和Client之間路由可達。
圖17 設備作為NETCONF over SSH服務器配置組網圖
# 生成RSA密鑰對。
<AC> system-view
[AC] 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密鑰對。
[AC] 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密鑰對。
[AC] public-key local create ecdsa secp256r1
Generating Keys...
.
Create the key pair successfully.
# 使能NETCONF over SSH服務器功能。
[AC] netconf ssh server enable
# 配置VLAN接口2的IP地址,客戶端將通過該地址連接NETCONF over SSH服務器。
[AC] interface vlan-interface 2
[AC-Vlan-interface2] ip address 192.168.100.49 255.255.255.0
[AC-Vlan-interface2] quit
# 設置NETCONF over SSH客戶端登錄用戶線的認證方式為AAA認證。
[AC] line vty 0 63
[AC-line-vty0-63] authentication-mode scheme
[AC-line-vty0-63] quit
# 創建設備管理類本地用戶client001,並設置密碼為明文aabbcc,服務類型為SSH,用戶角色為network-admin。
[AC] local-user client001 class manage
[AC-luser-manage-client001] password simple aabbcc
[AC-luser-manage-client001] service-type ssh
[AC-luser-manage-client001] authorization-attribute user-role network-admin
[AC-luser-manage-client001] quit
# 配置SSH用戶client001的服務類型為NETCONF,認證方式為password認證。(此步驟可以不配置)
[AC] ssh user client001 service-type netconf authentication-type password
用戶通過支持NETCONF over SSH連接的客戶端軟件與AC建立NETCONF over SSH連接之後,可直接進入AC的NETCONF配置模式。
# 打開支持NETCONF over SSH登錄方式的客戶端軟件,本文以NetConf Browser 2015(Version3.1)工具為例。
# 在菜單欄中選擇“File> Connect…”。
· “NETCONF version”選擇“Auto select”。
· “Host”文本框處輸入設備IP“192.168.100.49”。
· “Port”文本框處輸入“830”。
· “Username”文本框處輸入“client001”。
· 單擊“Connect”按鈕完成設置。
圖18 通過NetConf Browser連接設備
圖19 輸入密碼:aabbcc。
圖20 登錄成功
與AC建立NETCONF over SSH連接之後,直接進入AC的NETCONF配置模式。用戶登錄時獲得network-admin權限,例如:
# 在NetConf Browser的“Command XML”區域輸入以下信息,並點擊Send:
<get-sessions/>
# 在“Output XML”區域顯示NETCONF用戶的會話信息。
<?xml version="1.0" encoding="utf-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
<get-sessions>
<Session>
<SessionID>1</SessionID>
<Line>vty1</Line>
<UserName>client001</UserName>
<Since>2011-01-01T08:36:27</Since>
<LockHeld>false</LockHeld>
</Session>
</get-sessions>
</rpc-reply>
· 《H3C 無線控製器產品 配置指導》中的“安全配置指導”。
· 《H3C 無線控製器產品 命令參考》中的“安全命令參考。
· 《H3C 無線控製器產品 配置指導》中的“WLAN接入配置指導”。
· 《H3C 無線控製器產品 命令參考》中的“WLAN接入命令參考”。
不同款型規格的資料略有差異, 詳細信息請向具體銷售和400谘詢。H3C保留在沒有任何通知或提示的情況下對資料內容進行修改的權利!