325
# Specify the service type for user
client001
as
Stelnet
and the authentication method as
password
. This
step is optional.
[RouterB] ssh user client001 service-type stelnet authentication-type password
2.
Establish a connection between the SSH client and the SSH server.
# Configure an IP address for interface GigabitEthernet 1/0/1.
<RouterA> system-view
[RouterA] interface GigabitEthernet 1/0/1
[RouterA-GigabitEthernet1/0/1] ip address 10.165.87.137 255.255.255.0
[RouterA-GigabitEthernet1/0/1] quit
[RouterA] quit
•
If the client supports first-time authentication, directly establish a connection from the client to the
server.
# Establish an SSH connection to server 10.165.87.136.
<RouterA> ssh2 10.165.87.136
Username: client001
Trying 10.165.87.136 ...
Press CTRL+K to abort
Connected to 10.165.87.136 ...
The Server is not authenticated. Continue? [Y/N]:y
Do you want to save the server public key? [Y/N]:n
Enter password:
After you enter the correct password, log in to Router B successfully.
•
If the client does not support first-time authentication, you must perform the following configurations.
# Disable first-time authentication.
[RouterA] undo ssh client first-time
# Configure the host public key of the SSH server. get the server host public key by using
display public-
key local dsa public
on the server.
[RouterA] public-key peer key1
[RouterA-pkey-public-key] public-key-code begin
[RouterA-pkey-key-code]308201B73082012C06072A8648CE3804013082011F0281810
0D757262C4584C44C211F18BD96E5F0
[RouterA-pkey-key-code]61C4F0A423F7FE6B6B85B34CEF72CE14A0D3A5222FE08CECE
65BE6C265854889DC1EDBD13EC8B274
[RouterA-pkey-key-code]DA9F75BA26CCB987723602787E922BA84421F22C3C89CB9B0
6FD60FE01941DDD77FE6B12893DA76E
[RouterA-pkey-key-code]EBC1D128D97F0678D7722B5341C8506F358214B16A2FAC4B3
68950387811C7DA33021500C773218C
[RouterA-pkey-key-code]737EC8EE993B4F2DED30F48EDACE915F0281810082269009E
14EC474BAF2932E69D3B1F18517AD95
[RouterA-pkey-key-code]94184CCDFCEAE96EC4D5EF93133E84B47093C52B20CD35D02
492B3959EC6499625BC4FA5082E22C5
[RouterA-pkey-key-code]B374E16DD00132CE71B020217091AC717B612391C76C1FB2E
88317C1BD8171D41ECB83E210C03CC9
[RouterA-pkey-key-code]B32E810561C21621C73D6DAAC028F4B1585DA7F42519718CC
9B09EEF0381840002818000AF995917