Cisco IOS 的登录密码以及权限分配以及log时间设置

enable password xxxx     初级密码,用于验证从用户模式到特权模式的验证
enable secret xxxxx       MD5加密密码 用法同上
enabl password level xx   指定密码作用于哪个级别
enable secret level xx    作用同上


R2(config)#enable password ?
0      Specifies an UNENCRYPTED password will follow
7      Specifies a HIDDEN password will follow
LINE   The UNENCRYPTED (cleartext) 'enable' password
level Set exec level password



R2(config)#enable secret ?
0      Specifies an UNENCRYPTED password will follow
5      Specifies an ENCRYPTED secret will follow
LINE   The UNENCRYPTED (cleartext) 'enable' secret
level Set exec level password


注意这里:0 5 7 的 含义不同。0 为不加密,5 为MD5 。7 为Cisco自有加密算法(不牢靠,容易被破解)


service password-encryption 是使用7的加密方法加密存储在本地的所有密码。Cisco官方不推荐使用这个方法。


简单密码验证:


console 验证配置:


line console 0
password xxxx
end


Vty 验证:
line vty 0 4
password xxxx
end


带用户名的密码验证:
username xxxx secret xxx
line console 0
login local
end


line vty 0 4
login local
end


分级的权限验证:
我只想让Level 7 的用户在特权模式下:clear counters 和reload
配置如下:
privilege exec level 7 clear counters
privilege exec level 7 reload
enable secret level 7 xxxx
或者
privilege exec level 7 clear counters
privilege exec level 7 reload
username xxx privilege 7 secret xxxx
这种模式下:要登录必须这样:
R1>login
username:xxx
password:xxx


个人比较喜欢的一套分级权限的完整配置:
privilege exec level 7 clear counters
privilege exec level 7 reload
username xxx privilege 7 secret xxxx
username xxx privilege 15 secret xxx (管理员登录)
line console 0
login local
line vty 0 4
login local


对于,show run 来说,
如果Level 7 的用户被授权能够show run
但是其他的仍未被授权的话,查看的show run 将是如下样子:
R1#show run
Building configuration...


Current configuration : 53 bytes
!
boot-start-marker
boot-end-marker
!
!
!
!
!
!
end


其原因是因为未给Level 7 的用户授权 Global Configuration 权利
现在我授权如下:
privilege Configure leve 7 interface


然后再Level 7 下,show run 可以看见如下:
R1#show run
Building configuration...


Current configuration : 237 bytes
!
boot-start-marker
boot-end-marker
!
!
!
!
!
interface Ethernet0/0
!
interface Ethernet0/1
!
interface Ethernet0/2
!
interface Ethernet0/3
!
interface Serial1/0
!
interface Serial1/1
!
interface Serial1/2
!        
interface Serial1/3
!
!
end


注意这里,这里可以看见接口了。所以说对于show run 来说,必须先授权才能查看相应内容~


顺便解释下 关于enable secret password的问题:
R1(config)#enable secret ?
0      Specifies an UNENCRYPTED password will follow
5      Specifies an ENCRYPTED secret will follow
LINE   The UNENCRYPTED (cleartext) 'enable' secret
level Set exec level password
这里,很多人都不知道 0 5 的区别。
或者误认为0 是不加密密码,5 则是加密密码。
其实对于Secret 选项来说,密码肯定是会被加密的。
假设我要设置的密码为cisco
而这里的0 是指:我现在即将输入的密码是原始密码,是:cisco
而如果是5 的话:就是输入cisco 的MD5值:$1$XNRo$8FSa/XSF9DbmF6VbK6L6K.


0-15级别

0级默认只能执行5条命令;
1级默认能够执行40余条命令;
2-14级默认没有任何配置;
15级默认全命令。

设置LOG和DEBUG的时间标记

Router(config)#service timestamps debug datetime msec localtime

Router(config)#service timestamps log datetime msec localtime