cisco 路由器如何配置SSH

2024-12-04 01:18:28
推荐回答(1个)
回答1:

配置SSH #hostname tang#ip domain-name cisco.com 在生成加密密码时需要用到用户名和域名(config)#crypto key generate rsa general-keys modulus 1024 为加密会话产生加密密钥#ip ssh time-out <1-120> 设置ssh最大空闲定时器#ip ssh authentication-retries <0-5> 为ssh连接设计最大失败尝试值#ip ssh version 2(config)#username cisco privilege 15 secret 0 cisco 设置用户名和密码 #Line vty 0 4#Login local#Exec-timeout 60 0#Logging synchronous#transport input ssh telnet 配置事例:Router>enRouter#conf tEnter configuration commands, one per line. End with CNTL/Z.Router(config)#line con 0Router(config-line)#exec-t 60 0Router(config-line)#password ciscoconRouter(config-line)#logg synchRouter(config-line)#exitRouter(config)#enable secret ciscoexecRouter(config)#no ip domain-lookupRouter(config)#hostname tangtang(config)#ip domain-name cisco.comtang(config)#username ciscossh privi 15 secret 0 ciscosshtang(config)#crypto key gen rsa gen modu 1024The name for the keys will be: tang.cisco.com % The key modulus size is 1024 bits% Generating 1024 bit RSA keys, keys will be non-exportable...[OK] tang(config)#*Jul 12 03:20:16.183: %SSH-5-ENABLED: SSH 1.99 has been enabledtang(config)#ip ssh time 60tang(config)#ip ssh auth 5tang(config)#ip ssh ver 2tang(config)#int gig 0/2tang(config-if)#ip add 192.168.110.1 255.255.255.0tang(config-if)#no shuttang(config-if)#*Jul 12 03:21:24.455: %LINK-3-UPDOWN: Interface GigabitEthernet0/2, changed state to downtang(config-if)#*Jul 12 03:21:24.455: %ENTITY_ALARM-6-INFO: CLEAR INFO Gi0/2 Physical Port Administrative State Down *Jul 12 03:21:24.455: %ENTITY_ALARM-6-INFO: ASSERT CRITICAL Gi0/2 Physical Port Link Down tang(config-if)#*Jul 12 03:21:30.683: %LINK-3-UPDOWN: Interface GigabitEthernet0/2, changed state to uptang(config-if)#*Jul 12 03:21:30.683: %ENTITY_ALARM-6-INFO: CLEAR CRITICAL Gi0/2 Physical Port Link Down *Jul 12 03:21:31.683: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/2, changed state to uptang(config-if)#tang(config-if)#exittang(config)#line vty 0 4tang(config-line)#login local% Login disabled on line 2, until 'password' is set% Login disabled on line 3, until 'password' is set% Login disabled on line 4, until 'password' is set% Login disabled on line 5, until 'password' is set% Login disabled on line 6, until 'password' is settang(config-line)#exec-t 60 0tang(config-line)#logg synchtang(config-line)#transport input ssh telnet SSH登录的用户名和密码为username命令所设置 注意路由器的IOS应该支持SSH才可以配置。一般k9的都支持