返回顶部

思科CNNA中文教程 - 第三章用户访问和权限管理(上)

  3.1 设置用户和密码

  提问 为每个单独的人员设置不同的用户名和密码

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#username neoshi password ioscookbook (username weak nopassword)

  Router1(config)#aaa new-model

  Router1(config)#aaa authentication login local_auth cocal

  Router1(config)#line vty 0 4

  Router1(config-line)#login authentication local_auth

  Router1(config-line)#exit

  Router1#

  注释 设置单独的用户名和密码的好处就不用多说了,这里只是提一个就是在日志中会显示谁做了修改,比如%SYS-5-RELOAD:Reload requested by kdooley on vty0 (172.25.1.1).另外在username这个命令里面还有一个autocommand的选项,实现登录以后自动执行某个特定的命令的作用,下面的例子就是一个用户名为run无密码,登陆以后显示完端口状态就自动退出的例子,很好用吧

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#aaa new-model

  Router1(config)#aaa authentication login default local

  Router1(config)#aaa authorization exec default local

  Router1(config)#username run nopassword noescape

  Router1(config)#username run autocommand show ip interface brief

  Router1(config)#end

  Router1#

  3.2 加密密码

  提问 加密密码从而在配置文件中不明文显示

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#enable password oreilly

  Router1(config)#line vty 0 4

  Router1(config-line)#password cookbook

  Router1(config-line)#line con 0

  Router1(config-line)#password cookbook

  Router1(config-line)#line aux 0

  Router1(config-line)#password cookbook

  Router1(config-line)#exit

  Router1(config)#service password-encryption

  Router1(config)#end

  Router1#

  注释 这种加密方式很弱,很容易被破解

  3.3 Using Better Password-Encryption Techniques

  提问 使用强度高的加密方式而不是思科缺省的加密技术

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#enable secret ORAbooks

  Router1(config)#end

  Router1#

  在IOS 12.2(8)T后也可以对username的密码做高强度的加密

  Router#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router(config)#username ijbrown secret oreilly

  Router(config)#end

  Router#

  注释 由于这种加密方式使用的是MD5所以破解难度相对增大了。对于enable secret的密码有个小技巧就是密码设定正常没有?不过可以通过^V+?的方式来输入。

  3.4 移去配置文件中的密码信息

  提问 不想在配置文件中显示密码

  回答 使用脚本略去

  注释 简单的用show tech命令也可以

  3.5 解密思科的弱密码

  提问 破解思科缺省的密码算法

  回答 使用脚本略去

  注释 可以使用BOSON网站上的免费工具

  3.6 显示当前登录用户

  提问 显示当前登录设备的用户

  回答

  Router1#show users (who)

  注释 无

  3.7 发信息给其它用户

  提问 试图发送信息给登录在同一设备的其他用户

  回答

  Router1#send *

  Router1#send console 0

  Router1#send vty 2

  Router1#send 66

  注释 很好用的特性,比如当你重启的时候需要告诉别人,文本信息^+Z结束

思科CNNA中文教程 - 第三章用户访问和权限管理(上)

  3.8 修改可用VTY数目

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#line vty 0 9

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  注释 缺省可登录vty数目为5,不能删除,对于增加的可以使用no line vty x删除,不能删除单独的vty,是删除所有大于x的vty

  3.9 修改VTY的超时时长

  提问 修改超时避免用户登录超时被系统断开

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#line vty 0 4

  Router1(config-line)#exec-timeout 0 0 (exec-timeout 240 0)

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  注释 缺省用户10分钟空闲就会被踢掉系统,0 0 可以用不超时,第一个0 是分钟,第二个0 是秒。同时为了防止有些用户掉死但是还占用vty端口的情况,建议使用下面命令来防止:

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#service tcp-keepalives-in

  Router1(config)#end

  Router1#

  3.10 限制用户登录可以使用的协议

  提问 只允许用户用特定的协议来进行系统登录

  回答

  Router1#configure terminal

  Enter configuration commands,one per line.End with CNTL/Z.

  Router1(config)#line vty 0 4

  Router1(config-line)#transport input telnet

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  注释 缺省情况下除了可以telnet登录,还支持以下协议登录lat pad v120 lapb-ta rlogin ssh

  3.11 配置用户登录可用总时长Enabling Absolute Timeouts on VTY Lines

  提问 对用户登录总时长进行限制,不论是否在空闲还是活动

  回答 Router1#configure terminal

  Enter configuration commands,one per line.end with CNTL/Z.

  Router1(config)#line vty 0 4

  Router1(config-line)#absolute-timeout 5

  Router1(config-line)#logout-warning 30

  Router1(config-line)#exit

  Router1(config)#end

  Router1#

  注释 无

 



400-0806-056