很多時候我們都是通過遠端登入的方式來管理裝置,是以我們必須要知道登入的方法,并且當無法登入時知道從哪幾個方面來排查問題,本篇文章從華為華三和思科三種裝置來闡述登入方法。
華為裝置配置指令:
拓撲圖:
方法1. 無密碼登入:
user-interface vty 0 4
authentication-mode none
user privilege level 15 (也可以隻給使用者一個最低權限,然後在裝置上面通過super指令來配置特權模式指令,友善使用者操作)
方法2. telnet密碼登入:
user-interface vty 0 4
authentication-mode password
set authentication password cipher k4}WW;{A6uqcXT}k'OI~o3#
(密碼認證模式有simple和cipher兩種模式。simple在配置檔案裡為明文顯示,cipher為密文顯示)
方法3.telnet賬号密碼登入:
user-interface vty 0 4
authentication-mode aaa
aaa
local-user admin password cipher XJUN8<9N-:5NZPO3JBXBHA!!
local-user admin privilege level 15
local-user admin service-type telnet
方法4.ssh登入:
user-interface vty 0 4
authentication-mode aaa
protocol inbound ssh (華為預設綁定telnet登入)
aaa
local-user admin password cipher "=LP!6$^-IYNZPO3JBXBHA!!
local-user admin privilege level 15
local-user admin service-type ssh
stelnet server enable (記得開啟服務)
ssh user admin
ssh user admin authentication-type password
ssh user admin service-type stelnet (設定服務類型)
華三裝置配置指令:
拓撲圖:
方法1.無密碼登入:
line vty 0 4
authentication-mode none
user-role level-15
user-role network-operator
telnet server enable (記得開啟服務)
方法2. telnet密碼登入:
user-interface vty 0 4
authentication-mode password
user-role level-15
user-role network-operator
set authentication password simple admin123
telnet server enable
方法3.telnet賬号密碼登入:
local-user admin class manage
password simple admin123
service-type telnet
authorization-attribute user-role level-15
authorization-attribute user-role network-operator
user-interface vty 0 4
authentication-mode scheme
user-role network-operator
protocol inbound telnet
telnet server enable
方法4.ssh登入:
local-user admin class manage
password simple admin123
service-type ssh
authorization-attribute user-role level-15
authorization-attribute user-role network-operator
user-interface vty 0 4
authentication-mode scheme
user-role network-operator
protocol inbound ssh
ssh server enable
思科裝置配置指令:
拓撲圖:
方法1.無密碼登入:
line vty 0 4
no login
方法2. telnet密碼登入:
line vty 0 4
password admin123
login
privilege level 15
方法3.telnet賬号密碼登入:
username admin privilege 15 password 0 admin123
line vty 0 4
login local
方法4.ssh登入:
hostname r0 (不改名字無法和其它裝置差別,否則不能生成密鑰)
username admin privilege 15 secret 5 admin123
ip domain-name abc (配置域名)
crypto key generate rsa (生成密鑰)
line vty 0 4
login local
transport input ssh (綁定ssh登入)
登入方式為ssh -l + 使用者名 + 位址
總結
在配置遠端登入管理裝置時,經常忘記的就是開啟服務,對于不同廠商裝置,預設開啟的服務不相同,是以在設定完成後無論哪種廠商裝置都先開啟下服務;對于ssh登入來說,需要一個綁定協定的過程,比telnet配置稍微複雜一些。