侧边栏壁纸
博主头像
勤奋的冬枣博主等级

只有把抱怨环境的情绪,化为上进的力量,才是成功的保证!

  • 累计撰写 273 篇文章
  • 累计创建 448 个标签
  • 累计收到 116 条评论
标签搜索

目 录CONTENT

文章目录

思科路由器Console、Telnet和ssh登录方式配置

勤奋的冬枣
2019-12-11 / 0 评论 / 1 点赞 / 1,157 阅读 / 0 字

本次注意讲解主要以cisco 2800路由器为主,登录方式中的web登录将不会讲解。

1.jpg

console口登录

console口登陆需要准备Console线、USB to RS232接头和终端登陆软件SecureCRT。

2.jpg

CONSCOL线

3.jpg

USB to RS232接头

4.jpg

seccureCRT

在这里要注意的是USB to RS232接头插上电脑安装驱动后会显示自己的编号:比如上面我的电脑里面就是com4、波特率选择9600、数据位8、奇偶校验none、停止位1。

在使用console登录是需要设置控制台登录密码和特权密码

1.控制台密码的配置方法

Router>enable //进入特权模式

Router#configure terminal //进入全局模式

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#line console 0 进入console口

Router(config-line)#password zhang //设置密码为zhang

Router(config-line)#login //启用本地认证

2.特权密码的配置方法

Router>en

Router#configure terminal

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#enable password zhang //设置密码为zhang

Router(config)#enable secret zhang //加密密码

telnet登录

路由器的配置

Router>enable //进行特权模式

Router#conf t // 进入全局配置模式

Router(config)#enable secret zhang //配置特权加密口令

Router(config)#line vty 0 15 //进入虚拟线路模式

Router(config-line)#pass zhang //配置虚拟线路口令(telnet 登录密码)

Router(config-line)#login //强制登录

Router(config-line)#exit //退出虚拟线路模式

Router(config)#int f0/1 //进入接口配置模式(路由器必须有IP地址,telnet才能登录)

Router(config-if)#ip add 192.168.0.1 255.255.255.0 //配置IP地址

Router(config-if)#no shut //激活端口

Router(config-if)#exit //退出接口模式

Router(config)#exit //退出全局配置模式

Router#copy run start //保存配置

Destination filename [startup-config]?

Building configuration...

[OK]

SSH登录

telnet 传输采用的是明文传输,登录密码可能会泄露,为了安全传输可以采用SSH登录方式。

Router#conf t

Router(config)#hostname dongzao //配置主机名

dongzao(config)ip domain-name dongzao.cn

dongzao(config)#crypto key generate rsa //生成RSA密钥对

The name for the keys will be: dongzao.cn

Choose the size of the key modulus in the range of 360 to 2048 for your

How many bits in the modulus [512]: 1024 //建议模数长度1024

% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

dongzao(config)#ip ssh time 120//设置ssh时间为120秒

dongzao(config)#ip ssh authentication 4//设置ssh认证重复次数为4,可以在0-5之间选择

dongzao(config)#username admin pass zhang //创建用户名和密码

dongzao(config)#line vty 0 15 //进入虚拟线路模式

dongzao(config-line)#transport input ssh //启用SSH,阻止其它连接

dongzao(config-line)#login local //启用本地身份认证

注意:

为什么SSH配置需要一个域名呢,在配置SSH登录时,要生成一1024位RSA key,那么key的名字是以路由器的名字与DNS域名相接合为名字。 如果输入错误老是出现域名解析可以试用 no ip domin-lookup 禁掉! 不让日志消息打扰你的配置过程 Cisco IOS中另一个我认为的小毛病就是在我配置路由器时,控制台界面就不断弹出日志消息(可能是控制台端口,AUX端口或VTY端口)。要预 防这一点,你可以这样做。 所以在每一条端口线路上,我使用日志同步命令。举例如下:

dongzao(config)# line con 0

dongzao(config-line)# logging synchronous

dongzao(config)# line aux 0

dongzao(config-line)# logging synchronous

dongzao(config)# line vty 0 4

dongzao(config-line)# logging synchronous
1

评论区