天天看點

路由器本地權限劃分--程序賦權

      磨合了幾個小時,終于寫出來了,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#

6、再來看一下在enable 中設定級别。比如說我設定級别為6的enable 密碼為cisco6:

R1(config)#enable secret level 6 cisco6

7、我們現在再進去enable 看一下裡面的權限,發現config t 不讓敲了,再輸一次,就進去了,但是再輸一次的時候進去的是level 15,為最高的,這樣就能進入config 模式了:

R1>enable 6

R1#config t

      ^

% Invalid input detected at '^' marker.  (發現沒有這個權限,進不去了)

R1#enable    (再輸一次en,這樣預設以15級别進去了,也就就進去了)

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>?

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、那麼現在再退出來看一下:

  ping     Send echo messages

  telnet   Open a telnet connection (發現ping 和telnet 兩個都加進去了)

12、如果要讓level 0級别能夠執行配置DHCP,首先我要要給他config ter權限:

R1(config)# privilege exec level 0 config term  (首先要把這個config term 給他)

這樣退出之後再進來看到:

  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

  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 下面的權限都有了:

R1>config t

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 下面就沒參數了。

   以上講的都是本地權限劃分的程序模式。也就是說進一個程序給你一個權限。下篇文章将會再續使用者賦權。到時候請多關注!

本文轉自wxs-163 51CTO部落格,原文連結:http://blog.51cto.com/supercisco/270516

繼續閱讀