三、如何在路由器上配置sshCisco设备上使用ssh替代telnet实验
第一步:建立本地的身份验证数据库
R3(config)#aaa
new-model
R3(config)#aaa
authentication
login
ssh
local
选择身份验证由本地验证,起个名字叫ssh
R3(config)#username
aa
secret
aa1
建立本地用户名aa密码aa1的账户
第二步:设置telnet登陆验证采用aaa
的本地local验证
R3(config)#line
vty
0
4
R3(config-line)#login
authentication
ssh
R3(config-line)#transport
input
ssh
设置vty只接收ssh登陆。
第三步:配置ssh加密密钥
R3(config)#ip
domain-name
cisco.com
设置一个路由器的域名
R3(config)#crypto
key
generate
rsa(使用rsa散列算法)
The
name
for
the
keys
will
be:
R3.cisco.com
Choose
the
size
of
the
key
modulus
in
the
range
of
360
to
2048
for
your
General
Purpose
Keys.
Choosing
a
key
modulus
greater
than
512
may
take
a
few
minutes.
How
many
bits
in
the
modulus
[512]:(默认密钥长度为512位)
%
Generating
512
bit
RSA
keys,
keys
will
be
non-exportable...[OK]
R3(config)#
Mar
25
01:20:22.359:
%SSH-5-ENABLED:
SSH
1.99
has
been
enabled
生成一个ssh的密钥
测试,从R1登陆R3,使用用户名aa,密码aa1登陆
R1#ssh
-l
aa
20.0.0.2
Password:
R3>en
Password:
R3#
摘自
http://www.cuisir.org/ciscolab/05.html