Cisco网络设备对于访问用户的不同,可以像windows系统里的账户设置一样,为了系统或设备的安全区别创建用户。通过权限的分配以实施安全的设备管理,怎样在Cisco路由设备里面控制相应用户的访问?那么我们就需要知道privilege&privilege view 如何配置了。

             privilege这东西很简单也很好玩的,接下来就来做个小实验吧。

 

              r1与r2之间网段设置为192.168.1.0/24,左边为:192。168。1。1 ,右边为192。168。1。2。

              咱先看下privilege的配置吧,需求:需要给chengxi用户一个四级的密码ccnp,只能使用configure terminal 其它命令不执行。

             命令:

                       username  chengxi privilege 4 password ccnp

                        line vty 0 4

                        login local   

                         exit

                         enable secret level 4  ccnp

                         privilege  exec level 4 configure terminal

测试(r2------>r1):

 

  只能进入全局模式但不能执行任何动作:

 

那么privilege  的测试成功了,属于level 4的用户只能使用configure terminal命令。

如果我们在本地转换用户级别的话如:enable password level 4 ccie

 

那就登录进去就要先需要输入使能密码了,上面开始进入level 4的用户直接enable 4 回车就进入特权模式了,因为他是从r2 telnet r1的,直接认证进入特权模式了。

如果我们要对用户行为定位更精确的话,可以使用privilege view 来进行角色创建,多个privilege view 可以形成一个superview。。

          下面我们就来创建一个privilege view 为A ,用户名与密码依旧是chengxi与ccnp。vty 认证也一样是本地数据库认证。但是我们要创建privilege view A就先要开启aaa new-model ,然后再回到EXEC模式下输入:enable view

提示password: xxxx,输入level 15级的密码即可。

如:

 再进入全局模式里输入parser view A.就进入了parser view A配置了,你可以设置登录密码,允许使用的命令或执行的动作。

        那么我们现在要创建特权视图A,允许在EXEC模式下执行configure terminal ,在接口模式下只能配置fa0/1。其它配置一律否定。

parser view A
 secret  rhce

commands interface include shutdown
 commands interface include ip address
 commands interface include ip
 commands interface include no shutdown
 commands interface include no ip address
 commands interface include no ip
 commands interface include no
 commands configure include interface
 commands exec include configure terminal
 commands exec include configure
 commands exec include show
 commands configure include interface FastEthernet0/1

配置好后我们现在就可以去测试了。

r2---->r1:

 

现在我们已经进入了view A里面了,密码可不是level 15的密码了啊,是view A里定义的那个rhce啊。进去了之后哦,

 

看到了吧,其它命令都不可检测。呵呵。这就是我们“受制于人”的效果啊。另外我还在上一张图里面给大家展示了一个小 case。就是alias别名的作用。看到了吧。我把telnet 192.168.1.1也就是r2 telnet r1的命令用一个r2tor1来代替了。。所以在exec里面只要输入r2tor1就可以telnet上r1了。呵呵。这个好玩吧。