路由器远程登陆的方式

路由器远程登陆常用的是telnet和ssh

这两种模式登陆都需要在被登陆机上设置特权密码,不然无法进入特权模式

(如果没有enable密码,控制台密码可以代替,但是如果有enable密码,必须用enable密码登陆)

区别在于telnet使用的是udp协议通过23号端口传输,有更快的速度,但是数据明文传输有安全隐患,我们可以通过抓包软件截取信息;

而ssh使用的是TCP协议通过22号端口传输,网络代价更大,但数据通过RSA非对称加密算法加密,更加安全;

Telnet:

路由器默认开启(特权模式下直接输入IP或域名默认执行telnet)

被登陆机可以有三种设置:

1.

--------------------------------

Router<config>#line vty 0 4

Router<config-line>#no login

--------------------------------

即telnet登陆时不用密码验证直接登陆

2.

--------------------------------

Router<config>#line vty 0 4

Router<config-line>#password 1234

Router<config-line>#login

——————————————-

即登录时密码验证,注意不设密码login报错

3.

--------------------------------

Router<config>#username xiaoming password 1234

Router<config>#line vty  0 4

Router<config-line>#login local(用户密码形式登陆)

--------------------------------

即本地用户登陆

ssh设置:

-----------------------------------------------------------------------------------

Router<config>#username xiaoming password 1234(ssh只允许用户名密码方式登陆)

Router<config>#ip domain-name ssh.com(域名随便起)

Router(config)#crypto key generate rsa(设置加密方式)
The name for the keys will be: Router.ssh.com
Choose the size of the key modulus in the range of 360 to 4096 for your

General Purpose Keys. Choosing a key modulus greater than 512 may take

a few minutes.

How many bits in the modulus [512]: 1024(最好选1024)
% Generating 1024 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 1 seconds)

Router<config>#line vty 0 4

Router<config-line>#transport input ssh(只允许ssh方式登陆)

-----------------------------------------------------------------------------------

R1登录R2(1.1.1.2)时操作:

---------------------------------------------

R1#ssh -l xiaoming 1.1.1.2

---------------------------------------------

原文地址:https://www.cnblogs.com/wuguan/p/6939791.html