A-A+

路由器的进程赋权、用户赋权和本地权限划分的方法

2015年11月18日 站长资讯 暂无评论

目前网上关于如何给路由器进行本地赋权、用户赋权和本地权限划分的技术文章很少,本文作者整理了能够搜索到的相关文档,特意对这个重要功能的实现方法进行说明,希望能够对广大网管有帮助。

磨合了几个小时,终于写出来了,google了一下,发现关于本地赋权的文章一篇都没,所以今晚通宵达旦也要把它赶出来。有点晚了,完成了。下面给大家分享一下:

大家都知道本地权限划分为进程赋权和用户赋权。下面来看一下进程赋权:

一、进程赋权

1、进程赋权: 做的是进程认证。比如说通常我们通过console 、telnet 进去。直接通过 password进去的。而不是通过username和password 进去的。这样就是通过进程赋权。缺省情况下cisco 划分了0-15个级别的权限。0是最低15是最高。比如说我们现在给R1设置0级别:

  1. R1(config-line)#password cisco0  
  2.   
  3. R1(config-line)#privilege level 0    
  4.   
  5. R1(config-line)#login  

2、退出来之后发现要密码,输入密码后就进去了。0和1级别进来都为>。如果我们设置2-15级别的话,进去后将为#,也就直接进入特权模式:

  1. User Access Verification  
  2.    
  3. Password:  
  4.   
  5. R1>  

3、看一下对于 line 的配置:

  1. R1#sh run | b line  
  2. line con 0  
  3.  exec-timeout 0 0  
  4.  privilege level 0  
  5.  password cisco0  
  6.  logging synchronous  
  7.  login  
  8. line aux 0  
  9. line vty 0 4  
  10. !  
  11. !  
  12. end  

4、把级别改成level 1

R1(config-line)#privilege level 1

5、再来查看一下line 的配置,发现privilege没有显示了。说明这本身默认就是level 1:

  1. R1#sh run | b line  
  2. line con 0  
  3.  exec-timeout 0 0  
  4.  password cisco0  
  5.  logging synchronous  
  6.  login  
  7. line aux 0  
  8. line vty 0 4  
  9. !  
  10. !  
  11. end  
  12.    
  13. R1#  

6、再来看一下在enable 中设置级别。比如说我设置级别为6的enable 密码为cisco6:

R1(config)#enable secret level 6 cisco6

7、我们现在再进去enable 看一下里面的权限,发现config t 不让敲了,再输一次,就进去了,但是再输一次的时候进去的是level 15,为最高的,这样就能进入config 模式了:

  1. R1>enable 6  
  2. Password:  
  3. R1#  
  4. R1#config t  
  5.       ^  
  6. % Invalid input detected at '^' marker.  (发现没有这个权限,进不去了)  
  7. R1#enable    (再输一次en,这样默认以15级别进去了,也就就进去了)  
  8. R1#config t  
  9. Enter configuration commands, one per line.  End with CNTL/Z  
  10. 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、将单条命令赋权给某个级别:

  1. R1(config)#line con 0  
  2. R1(config-line)#privilege level 0  (建立0级别)  
  3. R1(config-line)#login  
  4.    
  5. User Access Verification  
  6.    
  7. Password:  
  8. R1>?  
  9. Exec commands:  
  10.   call     Voice call  
  11.   disable  Turn off privileged commands  
  12.   enable   Turn on privileged commands  
  13.   exit     Exit from the EXEC  
  14.   help     Description of the interactive help system  
  15.   logout   Exit from the EXEC  
  16.    
  17. R1>                (发现只有这些命令了)  

11、但如果说我现在把ping 和telnet 命令赋权给level 0,那怎么去做呢?

  1. R1(config)#privilege exec level 0 ping  
  2. R1(config)#privilege exec level 0 telnet (给0级别赋予ping 和telnet 两个命令)  

12、那么现在再退出来看一下:

  1. R1>?  
  2. Exec commands:  
  3.   call     Voice call  
  4.   disable  Turn off privileged commands  
  5.   enable   Turn on privileged commands  
  6.   exit     Exit from the EXEC  
  7.   help     Description of the interactive help system  
  8.   logout   Exit from the EXEC  
  9.   ping     Send echo messages  
  10.   telnet   Open a telnet connection (发现ping 和telnet 两个都加进去了)  
  11.    
  12. R1>  

13、如果要让level 0级别能够执行配置DHCP,首先我要要给他config ter权限:

R1(config)# privilege exec level 0 config term (首先要把这个config term 给他)

这样退出之后再进来看到:

  1. User Access Verification  
  2.    
  3. Password:  
  4. R1>?  
  5. Exec commands:  
  6.   call       Voice call  
  7.   configure  Enter configuration mode  (现在有了config 配置模式)  
  8.   disable    Turn off privileged commands  
  9.   enable     Turn on privileged commands  
  10.   exit       Exit from the EXEC  
  11.   help       Description of the interactive  
  12.   logout     Exit from the EXEC  
  13.   ping       Send echo messages  
  14.   telnet     Open a telnet connection  
  15.    
  16. R1>config t  (进入之后发现只有这几条命令)  
  17. Enter configuration commands, one per line.  End with CNTL/Z.  
  18. R1(config)>?  
  19. Configure commands:  
  20.   call     Configure Call parameters   
  21.   default  Set a command to its defaults  
  22.   end      Exit from configure mode  
  23.   exit     Exit from configure mode  
  24.   help     Description of the interactive help system  
  25.   no       Negate a command or set its defaults  
  26. R1(config)>  

14、再进入15级别权限的config模式继续 把dhcp的所有权限都赋予给level 0级别:

R1(config)#privilege configure all level 0 ip dhcp (这样就把ip dhcp 下面的所有参数都给他了)

15、再进去看一下0级别的权限,ip dhcp 下面的权限都有了:

  1. User Access Verification  
  2. Password:  
  3. R1>config t  
  4. Enter configuration commands, one per line.  End with CNTL/Z.  
  5. R1(config)>ip dhcp ?  
  6.   aaa                        Configure aaa attributes  
  7.   binding                    DHCP address bindings  
  8.   bootp                      BOOTP specific configuration  
  9.   class                      Configure DHCP classes  
  10.   conflict                   DHCP address conflict parameters   
  11.   database                   Configure DHCP database agents  
  12.   excluded-address           Prevent DHCP from assigning certain addresses  
  13.   limit                      Limit DHCP Lease  
  14.   limited-broadcast-address  Use all 1's broadcast address  
  15.   ping                       Specify ping parameters used by DHCP  
  16.   pool                       Configure DHCP address pools  
  17.   relay                      DHCP relay agent parameters   
  18.   smart-relay                Enable Smart Relay feature  
  19.   update                     Configure dynamic updates  
  20.   use                        Configure use of certain parameters during  
  21.                              allocation  

注:如果用R1(config)#privilege config leve 0 ip dchp 那么只能敲到ip dhcp 下面就没参数了。

以上讲的都是本地权限划分的进程模式。也就是说进一个进程给你一个权限。下篇文章将会再续用户赋权。到时候请多关注!

标签:

给我留言