拓扑图

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
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。