![0347d09704e363025e03e87a8097175d.png](https://i-blog.csdnimg.cn/blog_migrate/51dbafd7e0abcb9e054532607c310b70.jpeg)
![aa45bf740959b047ae445846dceccba0.png](https://i-blog.csdnimg.cn/blog_migrate/60b942fe61d28e5d225cdda3ac1a49ba.jpeg)
思科远程登录:
- 配置Telnet
R1(config)#line vty 0 4
R1(config-line)#
R1(config-line)#
R1(config-line)#pass
R1(config-line)#password cisco
R1(config-line)#login
R1(config-line)#login
R1(config-line)#
R1(config-line)#tra
R1(config-line)#transport in
R1(config-line)#transport input te
R1(config-line)#transport input telnet
R1(config-line)#transport input no
R1(config-line)#exit
R1(config)#
R1(config)#
R1(config)#
R1(config)#ena
R1(config)#enable se
R1(config)#enable pass
R1(config)#enable password glab
- 配置SSH
配置步骤:
1. 配置hostname
2. 配置domain name
3. 配置RSA密钥对
4. 配置本地验证的账户
5. 在VTY下面配置SSH
R2(config)#host
R2(config)#hostname R2
R2(config)#
R2(config)#
R2(config)#ip doa
R2(config)#ip do
R2(config)#ip domain-n
R2(config)#ip domain-name 51glab.com
R2(config)#
R2(config)#cry
R2(config)#crypto key gen
R2(config)#crypto key generate rs
R2(config)#crypto key generate rsa mo
R2(config)#crypto key generate rsa modulus 1024
The name for the keys will be: R2.51glab.com
% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 0 seconds)
R2(config)#
*Dec 22 11:47:03.973: %SSH-5-ENABLED: SSH 1.99 has been enabled
R2(config)#
R2(config)#username
R2(config)#username glab1 pas
R2(config)#username glab1 password glab1
R2(config)#
R2(config)#line vty 0 4
R2(config-line)#login
R2(config-line)#login lo
R2(config-line)#login local
R2(config-line)#tra
R2(config-line)#transport in
R2(config-line)#transport input ssh
R2(config-line)#transport input ssh
R2(config-line)#
R2(config-line)#exit
R2(config)#ena
R2(config)#enable pa
R2(config)#enable password glab
华为远程登录:
- Telnet password认证方式
user-interface vty 0 4
authentication-mode password
user privilege level 3
set authentication password cipher %$%$%ua]*lIf_IMtgKJI1K9,.d&)dj)x'>%:|QJ$4,
8J:B.d_,%$%$
- Telnet AAA认证的方式
R1]aaa
[R1-aaa]loc
[R1-aaa]local-user glab1 pa
[R1-aaa]local-user glab1 password ci
[R1-aaa]local-user glab1 password cipher glab1
Info: Add a new user.
[R1-aaa]local-user glab1 ser
[R1-aaa]local-user glab1 service-type te
[R1-aaa]local-user glab1 service-type telnet
[R1-aaa]local-user glab1 pri
[R1-aaa]local-user glab1 privilege 3
^
Error: Unrecognized command found at '^' position.
[R1-aaa]local-user glab1 privilege le
[R1-aaa]local-user glab1 privilege level 3
[R1-aaa]
[R1-aaa]
[R1-aaa]q
[R1]user
[R1]user-group
[R1]user-interface vty 0 4
[R1-ui-vty0-4]au
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]authentication-mode aaa
[R1-ui-vty0-4]pro
[R1-ui-vty0-4]protocol in
[R1-ui-vty0-4]protocol inbound te
[R1-ui-vty0-4]protocol inbound telnet
[R1-ui-vty0-4]
[R1-ui-vty0-4]
[R1-ui-vty0-4]q
- SSH password认证
[R2]user-interface vty 0 4
[R2-ui-vty0-4]au
[R2-ui-vty0-4]authentication-mode aaa
[R2-ui-vty0-4]pro
[R2-ui-vty0-4]protocol in
[R2-ui-vty0-4]protocol inbound ssh
[R2-ui-vty0-4]protocol inbound ssh
[R2-ui-vty0-4]user
[R2-ui-vty0-4]user pri
[R2-ui-vty0-4]user privilege le
[R2-ui-vty0-4]user privilege level 7
[R2-ui-vty0-4]
[R2-ui-vty0-4]
[R2-ui-vty0-4]
[R2-ui-vty0-4]
[R2-ui-vty0-4]q
[R2]
[R2]
[R2]aaa
[R2-aaa]lo
[R2-aaa]local-user client001 ser
[R2-aaa]local-user client001 service-type ssh
Info: Add a new user.
[R2-aaa]local-user client001 pas
[R2-aaa]local-user client001 password ci
[R2-aaa]local-user client001 password cipher client001
[R2-aaa]local-user client001 pri
[R2-aaa]local-user client001 privilege le
[R2-aaa]local-user client001 privilege level 1
[R2-aaa]
[R2-aaa]
[R2-aaa]
[R2-aaa]q
[R2]ssh user
[R2]ssh user client001 au
[R2]ssh user client001 authentication-type pas
[R2]ssh user client001 authentication-type password
Authentication type setted, and will be in effect next time
[R2]
- SSH 证书认证
[R3]rsa local-key-pair cre
[R3]rsa local-key-pair create
The key name will be: Host
% RSA keys defined for Host already exist.
Confirm to replace them? (y/n)[n]:y
The range of public key size is (512 ~ 2048).
NOTES: If the key modulus is greater than 512,
It will take a few minutes.
Input the bits in the modulus[default = 512]:
Generating keys...
...........++++++++++++
..........++++++++++++
..........................++++++++
...........++++++++
[R3]
[R3]
[R3]
[R3]
[R3]dis
[R3]display rsa
[R3]display rsa lo
[R3]display rsa local-key-pair pu
[R3]display rsa local-key-pair public
=====================================================
Time of Key pair created: 2020-12-22 20:11:00-08:00
Key name: Host
Key type: RSA encryption Key
=====================================================
Key code:
3047
0240
E91A1F07 470877A7 E229E95E 6DBF5D54 312A9640
50262856 19DF0FF0 E3863D3B 55ECE8C7 5E885F9B
39A37980 3B0B01CA 574F7280 D34FCA5C 2F7BE07C
039ACCAB
0203
010001
=====================================================
[R2]aaa
[R2-aaa]loc
[R2-aaa]local-user client002 ser
[R2-aaa]local-user client002 service-type ssh
Info: Add a new user.
[R2-aaa]q
[R2]
[R2]ssh user
[R2]ssh user client002 au
[R2]ssh user client002 authentication-type ?
all All authentication, password or RSA
password Password authentication
password-rsa Both password and RSA
rsa RSA authentication
[R2]ssh user client002 authentication-type rsa
Authentication type setted, and will be in effect next time
[R2]
[R2]
[R2]
[R2]
[R2]rsa
[R2]rsa pee
[R2]rsa peer-public-key rsakey001 en
[R2]rsa peer-public-key rsakey001 ?
<cr> Please press ENTER to execute command
[R2]rsa peer-public-key rsakey001
Enter "RSA public key" view, return system view with "peer-public-key end".
NOTE: The number of the bits of public key must be between 769 and 2048.
[R2-rsa-public-key]pu
[R2-rsa-public-key]public-key-code be
[R2-rsa-public-key]public-key-code begin
Enter "RSA key code" view, return last view with "public-key-code end".
[R2-rsa-key-code]3047
[R2-rsa-key-code]
[R2-rsa-key-code] 0240
[R2-rsa-key-code]
[R2-rsa-key-code] E91A1F07 470877A7 E229E95E 6DBF5D54 312A9640
[R2-rsa-key-code]
[R2-rsa-key-code] 50262856 19DF0FF0 E3863D3B 55ECE8C7 5E885F9B
[R2-rsa-key-code]
[R2-rsa-key-code] 39A37980 3B0B01CA 574F7280 D34FCA5C 2F7BE07C
[R2-rsa-key-code]
[R2-rsa-key-code] 039ACCAB
[R2-rsa-key-code]
[R2-rsa-key-code] 0203
[R2-rsa-key-code]
[R2-rsa-key-code] 010001
[R2-rsa-key-code]pu
[R2-rsa-key-code]public-key-code end
[R2-rsa-public-key]pee
[R2-rsa-public-key]peer-public-key end
[R2]
[R2]ssh user client002 assign rsa-key rsakey001
[R2]
[R2]stelnet server enable
Info: Succeeded in starting the STELNET server.
[R2
测试
[R3]ssh client first-time enable
[R3]
[R3]ste
[R3]stelnet 192.168.23.2
Please input the username:client001
Trying 192.168.23.2 ...
Press CTRL+K to abort
Connected to 192.168.23.2 ...
The server is not authenticated. Continue to access it? (y/n)[n]:y
Dec 22 2020 20:17:26-08:00 R3 %%01SSH/4/CONTINUE_KEYEXCHANGE(l)[0]:The server ha
d not been authenticated in the process of exchanging keys. When deciding whethe
r to continue, the user chose Y.
[R3]
Save the server's public key? (y/n)[n]:y
The server's public key will be saved with the name 192.168.23.2. Please wait...
Dec 22 2020 20:17:29-08:00 R3 %%01SSH/4/SAVE_PUBLICKEY(l)[1]:When deciding wheth
er to save the server's public key 192.168.23.2, the user chose Y.
[R3]
Enter password:
<R2>
<R2>
<R2>
<R2>
<R2>sys
<R2>sys
^
Error: Unrecognized command found at '^' position.
[R3]stelnet 192.168.23.2
Please input the username:client002
Trying 192.168.23.2 ...
Press CTRL+K to abort
Connected to 192.168.23.2 ...
<R2>
<R2>
<R2>sys
<R2>system-view
Enter system view, return user view with Ctrl+Z.
[R2]
[R2]