雏鹰部落

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1146|回复: 1

[讨论/求助] 通过CLI管理网络设备并设定访问权限(二)

[复制链接]
发表于 2014-11-18 14:56:57 | 显示全部楼层 |阅读模式
本帖最后由 victor_huang 于 2014-11-18 14:58 编辑

管理网络设备时,基于特权模式的权限分配具有以下弊端:
高等级用户总是能够执行低级别的命令.
高等级命令低等级用户无法使用.
多关键词命令分配给特定用户,会将第一个关键词相关的命令都分配给相同级别
管理员可能要书写大量的privilege exec条目来对某个用户赋权.
Cisco在Cisco IOS 12.3(11)T版本中引入了基于角色的CLI访问
为不同的用户建立不同的路由器配置视图。

根视图
管理员必须在根视图中配置系统的各种视图。根视图具有与15级别相同的访问权限,只有在根视图下才能重新配置新视图和调整原有视图.  
CLI视图
CLI视图绑定特定的命令集,没有命令层次结构,没有高级别视图和低级别视图之分,相同的命令可以在不同视图中使用。
超级视图
超级视图包含一个或多个CLI视图,允许管理员为用户和用户组一次分配多个CLI视图,而不用每个用户分配一个CLI视图及和此视图相关的命令。



步骤1:

使用aaa new-model 命令启用AAA。
配置和修改视图,管理员必须使用enable view 特权执行命令进入根视图。

R1(config)#aaa new-model  //开启AAA
R1(config)#enable secret enablepassword   //配置enable密码,进入view模式需要密码
R1(config)#username user1 password user1password
R1(config)#line vty 0 4
R1(config-line)#login local
进入View配置模式
R1#enable view
Password: enablepassword
*Mar  1 00:44:57.999: %PARSER-6-VIEW_SWITCH: successfully set to view 'root'.
R1#show privilege
Currently in View Context with view 'root'

步骤2:

使用parser view view-name 命令建立视图,最多15个视图.

R1(config)#parser view A
R1(config-view)#
*Mar  1 00:46:59.747: %PARSER-6-VIEW_CREATED: view 'A' successfully created.

步骤3:

使用secret encrypted-password 命令创建密码,用来保护刚创建的视图.

R1(config-view)#secret user1password

步骤4:

使用 command parser-mode {include | include-exclusive | exclude} [all] [interface interface-name | command]为视图分配命令.

R1(config-view)#commands exec include configure terminal
R1(config-view)#commands configure include all interface
R1(config-view)#commands configure include all router

步骤5:

exit退出视图模式.

R1#show privilege
Currently in View Context with view 'root'
R1#exit

从R2登陆到R1上,使用View模式进行配置
R2#telnet 12.1.1.1
Trying 12.1.1.1 ... Open


User Access Verification

Username: user1
Password: user1password   //本地数据库里的用户密码

R1>enable view A
Password: user1password    //输入配置view A的时候配置的密码

R1#?    //查看可用命令
Exec commands:
  <1-99>      Session number to resume
  configure   Enter configuration mode
  credential  load the credential info from file system
  enable      Turn on privileged commands
  exit        Exit from the EXEC
  show        Show running system information

R1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#?
Configure commands:
  do         To run exec commands in config mode
  exit       Exit from configure mode
  interface  ** an interface to configure
  router     Enable a routing process
R1(config)#

类似以上配置,可以创建多个view,每个view的命令可以重复。

除以上配置。还可以创建超级视图,可以将一个或多个普通视图关联到超级视图,超级视图可以使用普通视图包含的命令。
创建和管理超级视图
1.使用命令parser view view-name superview.
2.使用命令secret encrypted-password.
3.使用view view-name 命令分配一个已经存在的视图
4.exit退出


===========强大的分割线==================
天之道,利而不害;圣人之道,为而不争。


http://weibo.com/u/2466447230
http://blog.sina.com.cn/routerospf1

===========强大的分割线==================




本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
发表于 2014-11-20 15:26:10 | 显示全部楼层
顶顶顶~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|熊猫同学技术论坛|小黑屋| 网络工程师论坛 ( 沪ICP备09076391 )

GMT+8, 2024-4-26 09:27 , Processed in 0.082489 second(s), 20 queries , Gzip On.

快速回复 返回顶部 返回列表