cisco TELNET、SSH 、AAA 设置

                                            cisco  TELNETSSH AAA 设置

 

1.    telnet       基于TCP协议  23端口

 A 方法一:只使用密码即可登入:

Switch(config)#enable password 123456                              设置特权密码

Switch(config)#line vty 0 4

Switch(config-line)#password 123456           设置登入密码

Switch(config-line)#login                    允许登入

image.png

                                             

Switch(config-line)#exit

 B 方法二:只允许使用用户名和密码登入:

Switch(config)#username admin privilege 5 password 123456     添加用户名密码

Switch(config)#enable password 123456                                       设置特权密码

Switch(config)#line vty 0 4                使用0至4的虚拟远程

Switch(config-line)#login local            允许本地用户登入

Switch(config-line)#transport input  telnet      允许接入telnet连接

Switch(config-line)#exit

 

image.png

 

 

 C  ACL限制:

 

image.png

上图没限制前所有客户端都可以访问

 

Switch(config)#line vty 0 4

Switch(config-line)#login local

Switch(config-line)#access-class 100 in                                                  在入方向调用ACL

Switch(config)#access-list 100 permit ip host 192.168.20.254 any         表示只允许20.254访问

限制后验证:

image.png

允许192.168.20.254 telnet验证:

image.png


2.    SSH  基于tcp 协议  22端口

 

例如:

Switch(config)#hostname sw1                    设置设备名称

sw1(config)#ip domain-name test.com                添加域名名称

sw1(config)#ip ssh time-out 30                        超时时间为30秒

sw1(config)#ip ssh version 2                       启用SSH版本2

sw1(config)#ip ssh authentication-retries 2               允许连接尝试次数

sw1(config)#crypto key generate rsa                    生成密钥

The name for the keys will be: sw1.test.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]: 1024             设置密钥长度

% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

 

sw1(config)#user

*?? 4 23:57:37.321: %SSH-5-ENABLED: SSH 1.99 has been enabled

sw1(config)#username admin password 123456     添加用户和密码

sw1(config)#line vty 0 4             开启vty远程

sw1(config-line)#login local              设置只允许本地用户访问

sw1(config-line)#transport input ssh         设置允许SSH访问

sw1(config-line)#transport output telnet      设置允许telnet其他设备

sw1(config-line)#exit

 

 

验证:

image.png

 

ps:

Router(config)#security passwords min-length  8

     # 设置登入enable、用户密码的最短长度为8位,范围(0- -16)

<0-16> Minimum length of all user/enable passwords

Router(config)#login block-for 60 attempts 3 within 30 

            # 30秒内输错3次密码将等待60秒后才能再次登入

 

Router(config)#login on-failure log     # 将登入失败的信息记录在log中

Router(config)#login on-success log     # 将登入成功的信息记录在log中

 

 

 3.   使用AAA方式认证登入

 

R1(config)#aaa new-model  # 启用AAA认证

 

R2(config)#aaa authentication ?                

enable    Set authentication lists for enable

               #对使用enable命令进入特权模式时进行认证

login     Set authentication lists for logins.  

              #当有登入连接时进行认证

ppp       Set authentication lists for ppp.

                 #对基于PPP协议的一些网络应用进行认证

 

格式: aaa authentication  动作 列表名 认证类型

 

R2(config)#aaa authentication login test  local  # 使用本地数据库认证

R2(config)#enable secret 12345           # 特权密码

R2(config)#username qq privilege 15 secret 5 1234 # 创建本地用户

R2(config)#line vty 0 1                  # 使用0 1虚拟远程

R2(config-line)#login authentication test      # 启用test 认证

 

R2#show aaa local user lockout           #查看被锁定用户命令

Local-user Lock time

admin 00:14:40 UTC ?? ?? 01 1993

admin 00:14:40 UTC ?? ?? 01

 

R2#clear aaa local user lockout username admin   #清除锁定用户命令

 

 



猜你喜欢

转载自blog.51cto.com/wangkj/2322752
aaa