路由器的进程赋权、用户赋权和本地权限划分的方法
目前网上关于如何给路由器进行本地赋权、用户赋权和本地权限划分的技术文章很少,本文作者整理了能够搜索到的相关文档,特意对这个重要功能的实现方法进行说明,希望能够对广大网管有帮助。
磨合了几个小时,终于写出来了,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认证。http://www.xiaoxiongboke.com 但没设置本地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>
13、如果要让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 下面就没参数了。
以上讲的都是本地权限划分的进程模式。也就是说进一个进程给你一个权限。下篇文章将会再续用户赋权。到时候请多关注!