8/07/2013

CISCO 指令:設定登入密碼

Cisco 針對設備的登入採用三種不同的登入密碼管理,系統的預設狀況,登入密碼功能皆是關閉狀態。

  • Global
  • 設定密碼後,進入Privileged EXEC Mode狀態時需要輸入登入密碼。 
  • Console
  • 設定密碼後,由Console 進入系統時需要輸入登入密碼。 
  • VTY ( Telnet 或 SSH )
  • 設定密碼後,由Telnet 或 SSH進入系統時需要輸入登入密碼。  


在系統預設狀況下,Console 不用登入密碼是可以直接進入系統操作。但是,VTY連線方式若是沒有設定密碼是不能由遠端登入系統。

  • 設定Console 的登入密碼


  • Switch>enable
    Switch#configure terminal
    Enter configuration commands, one per line.  End with CNTL/Z.
    Switch(config)#line console 0
    Switch(config-line)#login
    Switch(config-line)#password pwconsole
    Switch(config-line)#exit
    Switch(config)#exit
    Switch#
    %SYS-5-CONFIG_I: Configured from console by console

    Switch#exit
     Press RETURN to get started!

    User Access Verification  

    Password:  
     


    藍色文字為啟用密碼的指令,pwconsole為登入密碼。
    此時紅色Password提示需要輸入密碼,證明Console的登入密碼功能已經開啟。


  • 設定VTY 
  • 假設Switch的IP為192.168.1.200。如圖示範,這時若嘗試利用telnet 和SSH 的client 程式是無法登入。

    因此需在系統端設定密碼。  
    Switch>enable
    Switch#configure terminal
    Enter configuration commands, one per line.  End with CNTL/Z.
    Switch(config)#line vty 0 15
    Switch(config-line)#login
    Switch(config-line)#password pwvty
    Switch(config-line)#exit
    Switch(config)#exit
    Switch#
    %SYS-5-CONFIG_I: Configured from console by console

    Switch#exit
      
    藍色文字為啟用密碼的指令,pwvty為登入密碼。這時再次登入就可以成功進入系統。 


    不過卻也發生無法登入Privileged EXEC Model新問題。原因是因為Cisco設計若是沒有設置Global的密碼,就無法讓VTY進入Privileged EXEC Model。  
    設定指令如下
    Switch>enable
    Switch#configure terminal
    Enter configuration commands, one per line.  End with CNTL/Z.
    Switch(config)#enable secret first
    Switch(config)#exit
    Switch#
    %SYS-5-CONFIG_I: Configured from console by console

    Switch#exit

    Switch con0 is now available

    Press RETURN to get started.

    User Access Verification

    Password:

    Switch>enable
    Password: 
     
     

    因此請先設定Privileged EXEC Mode使用的密碼,然後再設定VTY階段的密碼。