交換機telnet、Stelnet的配置過程


拓撲圖

 
image

交換機telnet的配置過程


配置VTY用戶界面的最大個數(同時可以登錄的最大數)


[s1]user-interface vty 0 4 //進入VTY 用戶界面視圖。0 5表示5個用戶,如果只輸入4表示只進入4這個VTY [s1-ui-vty0-4]authentication-mode aaa //設置用戶驗證方式為AAA驗證。 

配置AAA認證方案,指定驗證方式為賬號密碼,並設置登陸權限為3級

[s1]aaa //進入AAA視圖 [s1-aaa]local-user 用戶名 password cipher 密碼 privilege level 3 Info: Add a new user. [ss1-aaa]local-user 用戶名 service-type telnet //配置用戶名為xxx的服務類型為telnet 

驗證配置,用交換機s2telnet登錄交換機s1

<s2>telnet 10.0.1.1 //登錄telnet的時候需要在用戶模式下,格式: telnet ip地址 Press CTRL_] to quit telnet mode Trying 10.0.1.1 ... Connected to 10.0.1.1 ... Login authentication Username:用戶名 //輸入上面建立的用名 Password: //輸入密碼,密碼是不會顯示的 <s1> // 成功進入s1 

交換機stelnet配置過程

1.在交換機交換機開啟stelnet服務功能
2.在交換機生成本地密鑰對,以保證在服務器端和客戶端進行安全地數據交互。
3.置VTY用戶界面的最大個數(同時可以登錄的最大數)
4.建立SSH用戶
5.配置SSH用戶admin的認證方式為Password認證、服務方式為STelnet
6.驗證配置

在服務器端開啟stelnet服務功能

[ss1]stelnet server enable

在服務器端生成本地密鑰對rsa(或dsa) local-key-pair create

[ss1]rsa local-key-pair create The key name will be: ss1_Host The range of public key size is (512 ~ 2048). NOTES: If the key modulus is greater than 512, it will take a few minutes. Input the bits in the modulus[default = 512]: // 密鑰對長度越大,密鑰對安全性就越好,建議使用最大的密鑰對長度 Generating keys... ...........++++++++++++ .....++++++++++++ ...............++++++++ ...............++++++++ 

配置VTY用戶界面的最大個數(同時可以登錄的最大數)

[ss1]user-interface vty 0 4 //進入VTY 用戶界面視圖。0 5表示5個用戶,如果只輸入4表示只進入4這個VTY [ss1-ui-vty0-4]authentication-mode aaa //設置用戶驗證方式為AAA驗證。 [ss1-ui-vty0-4]protocol inbound ssh // 配置VTY用戶界面支持SSH協議 [ss1-ui-vty0-4]user privilege level 3 //設置用戶級別。3為管理級. [ss1-ui-vty0-4]quit 

配置aaa認證方案,指定認證方式為賬號密碼,並設置登錄權限為3級

[ss1]aaa [ss1-aaa]local-user 用戶名 password cipher 密碼 privilege level 3 //建立用戶xxx,指定認證方式為賬號密碼,並設置登錄權限為3級 [ss1-aaa]local-user 用戶名 service-type ssh //配置用戶名為xxx的服務類型為ssh 

配置SSH用戶xxx的認證方式為Password認證、服務方式為STelnet

[ss1]ssh user 用戶名 authentication-type password //配置用戶名為xxx的用戶認證方式為Password。 [ss1]ssh user 用戶名 service-type stelnet //配置SSH用戶xxx的服務方式為STelnet 

驗證配置,s2通過stelnet登錄s1
第一次登錄的時候他會提示你輸入ssh client first-time enable,你需要在客戶端交換機啟用ssh

[s2]stelnet 10.0.0.1 Please input the username:用戶名 //在這里輸入用戶名:xxx Trying 10.0.0.1... Press CTRL+K to abort Connected to 10.0.0.1 ... Error: Failed to verify the server's public key. Please run the command "ssh client first-time enable"to enable the first-time ac cess function and try again. //首次登錄ssh的時候他會提示你:請運行命令“ ssh客戶端首次啟用”以啟用首次交流 成功功能,然后重試。 [s2]ssh client first-time enable //然后在這里輸入ssh client first-time enable [s2]stelnet 10.0.1.1 //通過stelnet登錄 Please input the username:用戶名 // 輸入用戶名:xxx Trying 10.0.1.1 ... Press CTRL+K to abort Connected to 10.0.1.1 ... The server is not authenticated. Continue to access it? (y/n)[n]:y //已連接至10.0.1.1 ... 服務器未通過身份驗證。 繼續訪問嗎? (y / n)[n]:y (輸入y) Oct 14 2019 11:08:57-08:00 s2 %%01SSH/4/CONTINUE_KEYEXCHANGE(l)[1]:The server had not been authenticated in the process of exchanging keys.When deciding whether to continue, the user chose Y. //服務器在交換密鑰的過程中未通過身份驗證。 在決定是否繼續時,用戶選擇Y。 [s2] Save the server's public key? (y/n)[n]:y //保存服務器的公鑰? (y / n)[n]:y (輸入y) The server's public key will be saved with the name 10.0.0.1. Please wait... Oct 14 2019 11:08:59-08:00 s2 %%01SSH/4/SAVE_PUBLICKEY(l)[2]:When deciding w hether to save the server's public key 10.0.1.1, the user chose Y. [s2] Enter password: ///輸入密碼: (密碼不會顯示) <ss1> //成功進入ss1交換機 

可以通過display rsa (dsa)local-key-pair public查看通過dsa local-key-pair create或rsa local-key-pair create生成的密鑰



作者:稀泡泡
鏈接:https://www.jianshu.com/p/6e907c1163de
來源:簡書
著作權歸作者所有。商業轉載請聯系作者獲得授權,非商業轉載請注明出處。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM