cisco ssh 配置 也解釋
阿新 • • 發佈:2019-01-06
cisco SSH配置
1. 配置hostname和ip domain-nameSW#configure terminal
SW(config)#hostname R2 //配置ssh的時候路由器的名字不能為router
SW(config)#ip domain-name cisco.com //配置SSH必需
SW(config)aaa new-model 這個預設是開啟的不用打也行,但要看是否有 no aaa new-model 如果no掉了ssh就無法認證了
SW(config)#username admin privilege 15 secret cisco 建議一個登陸使用者
SW(config)#line vty 0 15
SW(config-line)#transport input ssh //只允許用SSH登入(注意:禁止telnet和從交換引擎session!)
SW(config-line)#transport input ssh telnet //這樣就又允許ssh又允許telet 如果這樣是很危險的,可以用Access進行一下限制,某些IP段可以Telnet某具必須ssh
SW(config)#crypto key generate rsa general-keys modulus 1024 //選擇加密位數,cisco推薦使用1024
The name for the keys will be: R2.cisco.com
//注:SSH的關鍵字名就是hostname + . +ip domain-name
Choose the size of the key modulus in the range of 360 to 2048 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minuts
How many bits in the modulus [512]: 注:選擇加密位數,cisco推薦使用1024
Generating RSA keys ...
SW(config)# ip ssh time-out 60 //超時時間
SW(config)#ip ssh authentication-retries 2 //最大失敗次數 ,測試時沒感覺有效果
3.指定到某VTY的介面上
SW(config)# line vty 0 15
SW(config-line)#transport input ssh telnet
access-list 90 remark Hosts allowed to SSH in //低版本可能不支援remark關鍵字
access-list 90 permit 10.10.1.100
access-list 90 permit 10.10.1.101
line con 0
login local
line vty 0 4 login local //使用本地定義的使用者名稱和密碼登入
transport input SSH //只允許用SSH登入(注意:禁止telnet和從交換引擎session!)
access-class 90 in //只允許指定源主機登入