A-A+

H3C路由器telnet、console和SSH方式登录管理

2015年11月23日 站长资讯 暂无评论

一、本地用户Telnet登录管理(模拟器实验)

1、在配置之前要添加一个以太网接口,默认是桥接到本地的网卡上(建议添加一个微软的逻辑口,并禁用本地物理网卡,让它桥接到逻辑接口上) 也可以编辑路由器的配置文件“hardcfg.tcl”添加代码“AddEthernet -index 1”,在启动路由器即可!!

  1. <H3C>format flash:    //要想保存数据 ,必须格式化  
  2. All data on flash: will be lost , proceed with format ? [Y/N]:y  
  3. ./  
  4. %Format flash: completed.  
  5. <H3C>system-view   
  6. [H3C]telnet server enable    //启动telnet服务  
  7. [H3C]password-control length 4   //默认密码长度为10,这里设为4  
  8. [H3C]local-user zzx     //添加一个用户  
  9. New local user added.  
  10. [H3C-luser-zzx]password simple admin   //密码  
  11. Updating user(s) information, please wait....  
  12. [H3C-luser-zzx]service-type telnet level 3   //服务类型 ,权限为3 即管理级别(有的是命令authorization-attribute level 3)  
  13. [H3C-luser-zzx]quit  
  14. [H3C]user-interface vty 0 4   //设置同时登录的用户为5个  
  15. [H3C-ui-vty0-4]authentication-mode scheme   //验证用户名和密码  
  16. [H3C-ui-vty0-4]quit  
  17. [H3C]inter Ethernet 0/1/0       //配置接口地址  
  18. [H3C-Ethernet0/1/0]ip add 192.168.10.10 255.255.255.0  

缺省情况下,用户使用Telnet方式登录设备,通过口令验证后,只能使用级别为0的命令。 如果想使用1,2,3级别的命令可以配置super password xxxx 来实现或者通过验证密码

[H3C] user-interface vty 0 4

[H3C-ui-vty0-4] authentication-mode password

[H3C-ui-vty0-4] set authentication password cipher 123

[H3C-ui-vty0-4] user privilege level 2 //在这里指明级别

二、本地用户console登录管理

(不同之处)

[H3C-luser-zzx]service-type terminal //设置服务类型为terminal

[H3C]user-interface con 0

[H3C-ui-vty0-4]authentication-mode scheme //设置scheme认证

三、SSH方式登录管理

1、验证方式为pasword认证

  1. [H3C]local-user zzx     //创建本地账号  
  2. [H3C-luser-zzx]password simple zzx123     
  3. [H3C-luser-zzx]service-type ssh   //服务类型为ssh  
  4. [H3C-luser-zzx]level 3     //级别为3  
  5. [H3C]inter Ethernet 0/1/0       //配置接口地址  
  6. [H3C-Ethernet0/1/0]ip add 192.168.10.10 255.255.255.0  
  7. [H3C]ssh server enable   //开启ssh服务    
  8. [H3C]ssh user zzx service-type stelnet  authentication-type password  //SSH用户client1的服务类型为stelnet,即安全Telnet,使用密码认证方式  
  9. [H3C]public-key  local create rsa   //生成本地密钥对并指定密钥长度  
  10. The range of public key size is (512 ~ 2048).        
  11. NOTES: If the key modulus is greater than 512,        
  12. It will take a few minutes.       
  13. Press CTRL+C to abort.  
  14. Input the bits of the modulus[default = 1024]:  
  15. Generating Keys...  
  16. ...++..++...++..++...++...++...++..++.+++++++++.+++++++  

连接一下看看如下;

2、验证方式为公钥认证

  1. [H3C]public-key  local create rsa   //生成1024位的rsa本地密钥对  
  2. The range of public key size is (512 ~ 2048).        
  3. NOTES: If the key modulus is greater than 512,        
  4. It will take a few minutes.       
  5. Press CTRL+C to abort.  
  6. Input the bits of the modulus[default = 1024]:  
  7. Generating Keys...  
  8. ...++..++...++..++...++...++...++..++.+++++++++.+++++++  
  9. <H3C>tftp 192.168.10.1 get Identity.pub   //导入公钥.(公钥是用Secure CRT软件创建的)  
  10.   File will be transferred in binary mode   
  11.   Downloading file from remote TFTP server, please wait...\  
  12.   TFTP:      360 bytes received in 0 second(s)   
  13.   File downloaded successfully.   
  14.  <H3C>dir  
  15. Directory of flash:/  
  16.  0     drw-         -  Mar 12 2013 13:11:12   logfile  
  17.  1     -rw-       360  Mar 12 2013 15:17:09   identity.pub  
  18. 2540 KB total (2507 KB free)  
  19. [H3C]public-key peer sshpub import sshkey Identity.pub  //将导入的公钥转换为RSA格式sshpub  
  20. [H3C]ssh server enable    
  21. [H3C]ssh user zzx service-type stelnet authentication-type publickey assign publickey sshpub  
  22. //SSH用户zzx的服务类型为stelnet、使用公钥认证,并且为该用户名分配生成的公钥sshpub  

登录时 勾掉”密码”这一项

四、radius进行telnet验证

  1. [H3C]telnet server enable   //打开Telnet服务器,缺省关闭,必须打开  
  2. [H3C]radius scheme telnetlogin  //创建RADIUS方案  
  3. [H3C-radius-telnetlogin]primary authentication 192.168.10.1   //配置验证的服务器地址与共享密钥  
  4. [H3C-radius-telnetlogin]key authentication test  
  5. [H3C-radius-telnetlogin]user-name-format without-domain   
  6. [H3C-radius-telnetlogin]server-type standard   
  7. //Telnet用户属于Login类型,引用RADIUS方案test,不进行计费  
  8. [H3C]domain system  
  9. [H3C-isp-system]authentication login radius-scheme telnetlogin  
  10. [H3C-isp-system]authorization login radius-scheme  telnetlogin  
  11. [H3C-isp-system]accounting optional  
  12. //设置scheme认证  
  13. [H3C]user-interface vty 0 4  
  14. [H3C-ui-vty0-4]authentication-mode sch  
  15. [H3C-ui-vty0-4]authentication-mode scheme  

在配置相应的接口

标签:

给我留言