磨合了几个小时,终于写出来了,google了一下,发现关于本地赋权的文章一篇都没,所以今晚通宵达旦也要把它赶出来。有点晚了,完成了。下面给大家分享一下:
大家都知道本地权限划分为 进程赋权和用户赋权。下面来看一下进程赋权:
一、进程赋权
1 、进程赋权: 做的是进程认证。比如说通常我们通过 console 、 telnet 进去。直接通过 password 进去的。而不是通过 username 和 password 进去的。这样就是通过进程赋权。缺省情况下 cisco 划分了 0-15 个级别的权限。 0 是最低 15 是最高。比如说我们现在给 R1 设置 0 级别:
R1(config-line)#password cisco0 R1(config-line)#privilege level 0 R1(config-line)#login |
2 、退出来之后发现要密码,输入密码后就进去了。 0 和 1 级别进来都为 > 。如果我们设置 2-15 级别的话,进去后将为 # , 也就直接进入特权模式:
User Access Verification Password: R1 > |
3 、看一下对于 line 的配置:
R1#sh run | b line line con 0 exec-timeout 0 0 privilege level 0 password cisco0 logging synchronous login line aux 0 line vty 0 4 ! ! end |
4 、把级别改成 level 1
R1(config-line)#privilege level 1 |
5 、再来查看一下 line 的配置,发现 privilege 没有显示了。说明这本身默认就是 level 1 :
R1#sh run | b line line con 0 exec-timeout 0 0 password cisco0 logging synchronous login line aux 0 line vty 0 4 ! ! end R1# |
6 、再来看一下在 enable 中设置级别。比如说我设置级别为 6 的 enable 密码为 cisco6 :
R1(config)#enable secret level 6 cisco6 |
7 、我们现在再进去enable 看一下里面的权限,发现config t 不让敲了,再输一次,就进去了,但是再输一次的时候进去的是 level 15 , 为最高的,这样就能进入config 模式了:
R1> enable 6 Password: R1# R1#config t ^ % Invalid input detected at '^' marker. (发现没有这个权限,进不去了) R1#enable (再输一次en, 这样默认以 15 级别进去了,也就就进去了 ) R1#config t Enter configuration commands, one per line. End with CNTL/Z R1(config)# |
8 、Cisco 路由器缺省情况下配置中不加密口令。可以使用R1(config)# service password-encryption 这样密码就被加密了。并且如果no service password-encryption 的话。密码还是以加密存在。Cisco 路由器还在缺省情况下启用了Web 服务,它是一个安全风险。如果你不打算使用它,最好将它关闭。如用命令:R1(config)# no ip http server 去关闭。
9 、关于本地用户认证的设置:
创建用户名:R1(config)#username wxs password cisco ( 设置一个用户名和密码)
R1(config)#username wxs privilege 15 (给这个用户15 的权限)
其中要注意的是开启了login local 认证。但没设置本地username 的时候。却退出来了,那么这样就会进不去了。其中在 AAA 中也一样:比如说输入 AAA new-mode 然后退出了。退出之后却要用户名。这样就登陆不进去了。因为敲了 aaa new-mode 之后缺省都采用了 default 认证。 Default 认证缺省也就是本地认证。这时候本地一旦没有创建用户名和密码。这样就会被关在外面。不管输什么用户名密码都不对。怎么办?只有重启。如果保存的话。重启按 ctrl+break 跳过去。
10、将单条命令赋权给某个级别:
R1(config)#line con 0 R1(config-line)#privilege level 0 ( 建立 0 级别 ) R1(config-line)#login User Access Verification Password: R1>? Exec commands: call Voice call disable Turn off privileged commands enable Turn on privileged commands exit Exit from the EXEC help Description of the interactive help system logout Exit from the EXEC R1> (发现只有这些命令了) |
11 、但如果说我现在把ping 和telnet 命令赋权给level 0 ,那怎么去做呢?
R1(config)#privilege exec level 0 ping R1(config)#privilege exec level 0 telnet (给 0 级别赋予 ping 和 telnet 两个命令) |
12、那么现在再退出来看一下:
R1>? Exec commands: call Voice call disable Turn off privileged commands enable Turn on privileged commands exit Exit from the EXEC help Description of the interactive help system logout Exit from the EXEC ping Send echo messages telnet Open a telnet connection (发现 ping 和 telnet 两个都加进去了) R1> |
12 、如果要让level 0 级别能够执行配置DHCP ,首先我要要给他config ter 权限:
R1(config)# privilege exec level 0 config term ( 首先要把这个 config term 给他 ) |
这样退出之后再进来看到:
User Access Verification Password: R1>? Exec commands: call Voice call configure Enter configuration mode (现在有了 config 配置模式) disable Turn off privileged commands enable Turn on privileged commands exit Exit from the EXEC help Description of the interactive logout Exit from the EXEC ping Send echo messages telnet Open a telnet connection R1>config t ( 进入之后发现只有这几条命令 ) Enter configuration commands, one per line. End with CNTL/Z. R1(config)>? Configure commands: call Configure Call parameters default Set a command to its defaults end Exit from configure mode exit Exit from configure mode help Description of the interactive help system no Negate a command or set its defaults R1(config)> |
14 、再进入15 级别权限的config 模式继续 把dhcp 的所有权限都赋予给level 0 级别:
R1(config)#privilege configure all level 0 ip dhcp ( 这样就把 ip dhcp 下面的所有参数都给他了 ) |
15 、再进去看一下0 级别的权限,ip dhcp 下面的权限都有了:
User Access Verification Password: R1>config t Enter configuration commands, one per line. End with CNTL/Z. R1(config)> ip dhcp ? aaa Configure aaa attributes binding DHCP address bindings bootp BOOTP specific configuration class Configure DHCP classes conflict DHCP address conflict parameters database Configure DHCP database agents excluded-address Prevent DHCP from assigning certain addresses limit Limit DHCP Lease limited-broadcast-address Use all 1's broadcast address ping Specify ping parameters used by DHCP pool Configure DHCP address pools relay DHCP relay agent parameters smart-relay Enable Smart Relay feature update Configure dynamic updates use Configure use of certain parameters during allocation |
注:如果用R1(config )#privilege config leve 0 ip dchp 那么只能敲到ip dhcp 下面就没参数了。
以上讲的都是本地权限划分的进程模式。也就是说进一个进程给你一个权限。下篇文章将会再续用户赋权。到时候请多关注!