이 문서에서는 Cisco 라우터에서 SSH(Secure Shell)를 구성하고 디버그하는 방법에 대해 설명합니다.
Cisco 이미지 또는 소프트웨어 패키지에는 SSH에 대한 암호화 지원이 포함되어야 합니다. 요구 사항은 플랫폼, 소프트웨어 릴리스 및 라이센싱 모델에 따라 다릅니다.
이 문서의 정보는 Cisco IOS 및 Cisco IOS XE Software를 기반으로 합니다.
이 문서의 정보는 특정 랩 환경의 디바이스를 토대로 작성되었습니다. 이 문서에 사용된 모든 디바이스는 초기화된(기본) 컨피그레이션으로 시작되었습니다. 현재 네트워크가 작동 중인 경우 모든 명령의 잠재적인 영향을 미리 숙지하시기 바랍니다.
SSH 토폴로지
Cisco 라우터에서 SSH 기본 지원을 활성화하는 데 필요한 몇 가지 단계는 다음과 같습니다.
1. 라우터 호스트 이름을 구성합니다.
2. SSH 인증을 위한 로컬 사용자 계정을 생성합니다.
3. DNS 도메인 이름을 구성합니다.
4. 플랫폼에서 지원되는 가장 높은 SSH 버전을 활성화합니다. 지원되는 경우 SSH 버전 2를 사용합니다.
5. SSH를 위한 RSA 키 쌍을 생성합니다. 플랫폼에서 지원하고 보안 정책에 따라 조정된 가장 큰 RSA 모듈러스를 사용합니다.
6. VTY 라인 컨피그레이션 모드를 시작합니다.
7. 인증에 로컬 사용자 데이터베이스 또는 aaa를 사용하도록 VTY 라인을 구성합니다.
8. SSH 전송에만 VTY 액세스를 제한합니다.
SSH 서버 역할을 하는 Cisco 디바이스에는 호스트 이름, 도메인 이름, RSA 키, 인증 및 VTY 컨피그레이션이 필요합니다. SSH 세션만 시작하는 디바이스에는 SSH 클라이언트 지원 및 SSH 서버에 대한 유효한 경로가 필요합니다.
Routert#configure terminal
Router(config)#hostname R2
R2(config)#username cisco privilege 15 secret C1sc0
R2(config)#ip domain name rtp.cisco.com
R2(config)#ip ssh version 2
R2(config)#crypto key generate rsa general-keys modulus 4096
R2(config)#line vty 0 4
R2(config-line)#login local
R2(config-line)#transport input ssh
R2(config-line)#end
참고: login local이 사용되지 않을 경우 aaa new-model 명령은 다른 AAA 문이 없을 때 라우터의 로컬 사용자 이름 및 암호를 사용하게 합니다.
다른 라우터에서 테스트할 때 이 명령을 SSH 클라이언트 명령의 예로 사용합니다. 지원되는 암호 및 hmac 알고리즘은 소프트웨어 릴리스 및 SSH 정책에 따라 달라질 수 있습니다.
R3#ssh -v 2 -l cisco 10.20.20.20
Password:
R2>
RSA 공개 키 인증은 SSH 클라이언트가 비밀번호를 전송하거나 의존하지 않고 Cisco 라우터 또는 스위치에 대해 인증할 수 있게 합니다. SSH 서버는 공개 키를 저장합니다. SSH 클라이언트는 일치하는 개인 키를 유지합니다. 로그인 시 클라이언트는 인증 데이터에 디지털 서명을 하여 개인 키를 소유하고 있음을 증명합니다. 서버는 디바이스에 구성된 공개 키로 서명을 확인합니다. 개인 키는 클라이언트에 유지되며 네트워크를 통해 전송되지 않습니다.
혜택
RSA 공개 키 기반 인증을 수행하도록 SSH 서버를 구성하려면 다음 단계를 완료하십시오.
1. 라우터 호스트 이름을 구성합니다.
2. DNS 도메인 이름을 구성합니다.
3. AAA를 활성화하거나 라인 vty에서 로컬 로그인을 구성합니다.
4. SSH 서버에서 사용하는 RSA 키 쌍을 생성합니다.
5. 플랫폼에서 지원하는 가장 높은 SSH 버전을 사용합니다. 지원되는 경우 SSHv2를 사용합니다.
6. 플랫폼 및 보안 정책에서 지원하는 가장 강력한 RSA 모듈러스를 사용합니다. 4096비트 모듈러스는 지원되는 경우 및 성능 영향이 허용되는 경우 바람직하다.
7. SSH 공개 키 체인 컨피그레이션 모드를 입력합니다.
8. RSA 공개 키 인증으로 인증할 수 있는 SSH 사용자 이름을 구성합니다.
9. SSH 클라이언트에서 해당 사용자 이름에 대한 RSA 공개 키를 추가합니다.
참고: ssh-keygen 명령을 사용하여 Linux/macOS 디바이스에서 SSH 공개 키를 생성할 수 있습니다(예: ssh-keygen -m PEM -t rsa -b 1024 -f ~/.ssh/cisco1024). 그런 다음 cat ~/.ssh/cisco1024.pub 명령으로 키를 읽을 수 있습니다.
Router#configure terminal
Router(config)#hostname RSA-PublicKey
RSA-PublicKey(config)#ip domain name rtp.cisco.com
RSA-PublicKey(config)#aaa new-model
RSA-PublicKey(config)#crypto key generate rsa modulus 4096
The name for the keys will be: RSA-PublicKey.rtp.cisco.com
% The key modulus size is 4096 bits
% Generating 4096 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 4 seconds)
RSA-PublicKey(config)#ip ssh version 2
RSA-PublicKey(config)#ip ssh pubkey-chain
RSA-PublicKey(conf-ssh-pubkey)#username ciscoadmin
RSA-PublicKey(conf-ssh-pubkey-user)#key-string
RSA-PublicKey(conf-ssh-pubkey-data)#$QaVSyuVNw== user@MacBook-Pro
RSA-PublicKey(conf-ssh-pubkey-data)#end
RSA-PublicKey#
SSH를 구성할 때 SSHv2가 활성화되어 있는지 확인합니다. SSHv2는 SSHv1보다 강력한 암호화와 훨씬 뛰어난 보안을 제공합니다.
Router(config)#ip ssh version 2
비 SSH 연결을 방지하려면 라인 아래에 transport input ssh 명령을 추가하여 라우터를 SSH 연결 전용으로 제한합니다. 직접(비 SSH) Telnet은 거부됩니다.
Router(config)#line vty 0 15
Router(config-line)#transport input ssh
SSH 연결성을 특정 하위 네트워크로 제한해야 합니다. 이 경우, 해당 하위 네트워크를 벗어난 IP에서의 다른 모든 SSH 시도는 차단됩니다.
다음 단계를 수행하여 동일한 작업을 수행할 수 있습니다.
다음은 컨피그레이션을 보여주는 예입니다. 이 예에서는 10.10.10.0/24으로부터의 SSH 액세스만 허용됩니다. 다른 모든 소스 IP 주소는 ACL의 끝에 있는 암시적 거부에 의해 거부됩니다.
Router(config)#access-list 23 permit 10.10.10.0 0.0.0.255
Router(config)#line vty 0 15
Router(config-line)#transport input ssh
Router(config-line)#access-class 23 in
Router(config-line)#exit
banner 명령 출력은 Telnet과 여러 버전의 SSH 연결에 따라 달라집니다. 다음 표에서는 여러 banner 명령 옵션이 다양한 유형의 연결과 작동하는 방식을 보여줍니다.
| Banner 명령 옵션 |
Telnet |
SSH v2 |
| banner login |
디바이스에 로그인하기 전에 표시됩니다. |
디바이스에 로그인하기 전에 표시됩니다. |
| banner motd |
디바이스에 로그인하기 전에 표시됩니다. |
디바이스에 로그인한 후 표시됩니다. |
| banner exec |
디바이스에 로그인한 후 표시됩니다. |
디바이스에 로그인한 후 표시됩니다. |
여기서 설명하는 debug 명령을 실행하기 전에 Debug 명령에 대한 중요한 정보를 참조하십시오.
debug ip ssh - SSH에 대한 디버그 메시지를 활성화합니다.
show ssh - SSH 서버 연결의 상태를 표시합니다.
RSA-PublicKey#show ssh
Connection Version Mode Encryption Hmac State Username
0 2.0 IN aes128-gcm@ohmac-sha2-256-etm@openssh.com Session started ciscoadmin
0 2.0 OUT aes128-gcm@ohmac-sha2-256-etm@openssh.com Session started ciscoadmin
show ip ssh - SSH에 대한 버전 및 컨피그레이션 데이터를 표시합니다.
RSA-PublicKey#show ip ssh
SSH Enabled - version 2.0
Authentication methods:publickey,keyboard-interactive,password
Authentication Publickey Algorithms:ssh-rsa,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,x509v3-ecdsa-sha2-nistp256,x509v3-ecdsa-sha2-nistp384,x509v3-ecdsa-sha2-nistp521,rsa-sha2-256,rsa-sha2-512,x509v3-rsa2048-sha256
Hostkey Algorithms:rsa-sha2-512,rsa-sha2-256,ssh-rsa
Encryption Algorithms:chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-gcm,aes256-gcm,aes128-ctr,aes192-ctr,aes256-ctr
MAC Algorithms:hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com
KEX Algorithms:curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512
Authentication timeout: 120 secs; Authentication retries: 3
ciscouser@CISCOUSER-M-R Desktop % ssh -i ~/.ssh/cisco1024 -v ciscoadmin@10.82.139.71
debug1: OpenSSH_10.2p1, LibreSSL 3.3.6
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Reading configuration data /etc/ssh/ssh_config.d/100-macos.conf
debug1: /etc/ssh/ssh_config.d/100-macos.conf line 1: Applying options for *
debug1: Reading configuration data /etc/ssh/crypto.conf
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to 10.82.139.71 [10.82.139.71] port 22.
debug1: Connection established.
debug1: loaded pubkey from /Users/ciscouser/.ssh/cisco1024: RSA SHA256:w5wW3BqX15fO5Qm+BP75tJ1YzaXNsDNeHLLNZTW+Roo
debug1: identity file /Users/ciscouser/.ssh/cisco1024 type 0
debug1: no identity pubkey loaded from /Users/ciscouser/.ssh/cisco1024
debug1: Local version string SSH-2.0-OpenSSH_10.2
debug1: Remote protocol version 2.0, remote software version Cisco-1.25
debug1: compat_banner: match: Cisco-1.25 pat Cisco-1.* compat 0x60000000
debug1: Authenticating to 10.82.139.71:22 as 'ciscoadmin'
debug1: load_hostkeys: fopen /Users/ciscouser/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: ecdh-sha2-nistp256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: aes128-gcm@openssh.com MAC: compression: none
debug1: kex: client->server cipher: aes128-gcm@openssh.com MAC: compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-rsa SHA256:5wvYU0FIJQmz+eHACVJMvoaX3WSgXkyem/3tOgyOYuQ
debug1: load_hostkeys: fopen /Users/ciscouser/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '10.82.139.71' is known and matches the RSA host key.
debug1: Found key in /Users/ciscouser/.ssh/known_hosts:2
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_ext_info_client_parse: server-sig-algs=
debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,keyboard-interactive,password
debug1: Next authentication method: publickey
debug1: get_agent_identities: bound agent to hostkey
debug1: get_agent_identities: ssh_fetch_identitylist: agent contains no identities
debug1: Will attempt key: /Users/ciscouser/.ssh/cisco1024 RSA SHA256:w5wW3BqX15fO5Qm+BP75tJ1YzaXNsDNeHLLNZTW+Roo explicit debug1: Offering public key: /Users/ciscouser/.ssh/cisco1024 RSA SHA256:w5wW3BqX15fO5Qm+BP75tJ1YzaXNsDNeHLLNZTW+Roo explicit debug1: Server accepts key: /Users/ciscouser/.ssh/cisco1024 RSA SHA256:w5wW3BqX15fO5Qm+BP75tJ1YzaXNsDNeHLLNZTW+Roo explicit Enter passphrase for key '/Users/ciscouser/.ssh/cisco1024': Authenticated to 10.82.139.71 ([10.82.139.71]:22) using "publickey".
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: Sending environment.
debug1: channel 0: setting env LANG = "C.UTF-8"
debug1: channel 0: setting env LC_CTYPE = "UTF-8"
RSA-PublicKey>en Password:
RSA-PublicKey#show version
Cisco IOS XE Software, Version 17.12.04
Cisco IOS Software [Dublin], ASR1000 Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 17.12.4, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2024 by Cisco Systems, Inc.
Compiled Tue 23-Jul-24 09:43 by mcpre
Cisco IOS-XE software, Copyright (c) 2005-2024 by cisco Systems, Inc.
All rights reserved. Certain components of Cisco IOS-XE software are
licensed under the GNU General Public License ("GPL") Version 2.0. The
software code licensed under GPL Version 2.0 is free software that comes
with ABSOLUTELY NO WARRANTY. You can redistribute and/or modify such
GPL code under the terms of GPL Version 2.0. For more details, see the
documentation or "License Notice" file accompanying the IOS-XE software,
or the applicable URL provided on the flyer accompanying the IOS-XE
software.
ROM: 17.3(1r)
RSA-PublicKey uptime is 2 weeks, 2 days, 10 hours, 28 minutes
Uptime for this control processor is 2 weeks, 2 days, 10 hours, 30 minutes
System returned to ROM by Reload Command
System image file is "bootflash:asr1000-universalk9.17.12.04.SPA.bin"
Last reload reason: Reload Command
This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.
A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html
If you require further assistance please contact us by sending email to
export@cisco.com.
License Type: Smart License is permanent
License Suite: AdvUCSuiteK9
Next reload License Suite: AdvUCSuiteK9
The current crypto throughput level is 20000000 kbps
Smart Licensing Status: Smart Licensing Using Policy
cisco ASR1001-HX (1SR) processor (revision 1SR) with 3684784K/6147K bytes of memory.
Processor board ID TKM20160032
Router operating mode: Autonomous
Crypto Hardware Module present
8 Gigabit Ethernet interfaces
8 Ten Gigabit Ethernet interfaces
32768K bytes of non-volatile configuration memory.
8388608K bytes of physical memory.
29401087K bytes of eUSB flash at bootflash:.
Configuration register is 0x2102
RSA-PublicKey#exit debug1: client_input_channel_req: channel 0 rtype exit-status reply 0 debug1: channel 0: free: client-session, nchannels 1 Connection to 10.82.139.71 closed by remote host. Connection to 10.82.139.71 closed.
Transferred: sent 3640, received 6336 bytes, in 114.1 seconds
Bytes per second: sent 31.9, received 55.5
debug1: Exit status 0
RSA-PublicKey#show logging
Syslog logging: enabled (0 messages dropped, 3 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled)
No Active Message Discriminator.
No Inactive Message Discriminator.
Console logging: disabled
Monitor logging: level debugging, 0 messages logged, xml disabled,
filtering disabled
Buffer logging: level debugging, 617 messages logged, xml disabled,
filtering disabled
Exception Logging: size (4096 bytes)
Count and timestamp logging messages: disabled
Persistent logging: disabled
No active filter modules.
Trap logging: level informational, 161 message lines logged
Logging Source-Interface: VRF Name:
TLS Profiles:
Log Buffer (102400 bytes):
*Aug 22 06:05:51.736: SSH2 0: ssh_receive: 36 bytes received
*Aug 22 06:05:58.163: SSH0: starting SSH control process
*Aug 22 06:05:58.163: SSH0: sent protocol version id SSH-2.0-Cisco-1.25
*Aug 22 06:05:58.165: SSH0: protocol version id is - SSH-2.0-OpenSSH_10.2
*Aug 22 06:05:58.165: SSH2 0:
ssh2_server_key_exchange: kexinit sent: kex algo = curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512
*Aug 22 06:05:58.165: SSH2 0: kexinit sent: hostkey algo = rsa-sha2-512,rsa-sha2-256,ssh-rsa
*Aug 22 06:05:58.165: SSH2 0: kexinit sent: encryption algo = chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-gcm,aes256-gcm,aes128-ctr,aes192-ctr,aes256-ctr
*Aug 22 06:05:58.165: SSH2 0: kexinit sent: mac algo = hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com
*Aug 22 06:05:58.165: SSH2 0: send:packet of length 656 (length also includes padlen of 7)
*Aug 22 06:05:58.165: SSH2 0: SSH2_MSG_KEXINIT sent
*Aug 22 06:05:58.239: SSH2 0: ssh_receive: 1300 bytes received
*Aug 22 06:05:58.239: SSH2 0: input: total packet length of 1568 bytes
*Aug 22 06:05:58.239: SSH2 0: partial packet length(block_size)8 bytes,
needed 1560 bytes, maclen 0
*Aug 22 06:05:58.239: SSH2 0: input: padlength 4 bytes
*Aug 22 06:05:58.239: SSH2 0: SSH2_MSG_KEXINIT received
*Aug 22 06:05:58.239: SSH2 0: kex: client->server enc:aes128-gcm@openssh.com mac:hmac-sha2-256-etm@openssh.com
*Aug 22 06:05:58.239: SSH2 0: kex: server->client enc:aes128-gcm@openssh.com mac:hmac-sha2-256-etm@openssh.com
*Aug 22 06:05:58.239: SSH2 0: Using kex_algo = ecdh-sha2-nistp256
*Aug 22 06:05:58.242: SSH2 0: kexecdh_server: expecting SSH2_MSG_KEX_ECDH_INIT
*Aug 22 06:05:58.312: SSH2 0: ssh_receive: 80 bytes received
*Aug 22 06:05:58.312: SSH2 0: input: total packet length of 80 bytes
*Aug 22 06:05:58.312: SSH2 0: partial packet length(block_size)8 bytes,
needed 72 bytes, maclen 0
*Aug 22 06:05:58.312: SSH2 0: input: padlength 5 bytes
*Aug 22 06:05:58.312: ssh2_calculate_modulus_length: modulus len 32
*Aug 22 06:05:58.312: SSH2 0: kexecdh_server: Calculated shared secret len 32
*Aug 22 06:05:58.333: SSH2 0: send:packet of length 1160 (length also includes padlen of 10)
*Aug 22 06:05:58.333: SSH2: kex_derive_keys complete
*Aug 22 06:05:58.333: SSH2 0: send:packet of length 16 (length also includes padlen of 10)
*Aug 22 06:05:58.333: SSH2 0: newkeys: mode 1
*Aug 22 06:05:58.333: SSH2: AES-GCM key initialized
*Aug 22 06:05:58.333: SSH2 0: SSH2_MSG_NEWKEYS sent
*Aug 22 06:05:58.333: SSH2 0: Preparing SSH2_MSG_EXT_INFO server-sig-algs
*Aug 22 06:05:58.333: SSH2 0: send:packet of length 260 (length also includes padlen of 19)
*Aug 22 06:05:58.333: SSH2 0: SSH2_MSG_EXT_INFO sent
*Aug 22 06:05:58.333: SSH2 0: waiting for SSH2_MSG_NEWKEYS
*Aug 22 06:05:58.411: SSH2 0: ssh_receive: 16 bytes received
*Aug 22 06:05:58.411: SSH2 0: input: total packet length of 16 bytes
*Aug 22 06:05:58.411: SSH2 0: partial packet length(block_size)8 bytes,
needed 8 bytes, maclen 0
*Aug 22 06:05:58.411: SSH2 0: input: padlength 10 bytes
*Aug 22 06:05:58.411: SSH2 0: newkeys: mode 0
*Aug 22 06:05:58.411: SSH2: AES-GCM key initialized
*Aug 22 06:05:58.411: SSH2 0: SSH2_MSG_NEWKEYS received
*Aug 22 06:05:58.411: %SSH-5-SSH2_SESSION: SSH2 Session request from 10.189.3.9 (tty = 0) using crypto cipher 'aes128-gcm@openssh.com', hmac 'hmac-sha2-256-etm@openssh.com' Succeeded
*Aug 22 06:05:58.604: SSH2 0: ssh_receive: 52 bytes received
*Aug 22 06:05:58.604: SSH2 0: input: total packet length of 36 bytes
*Aug 22 06:05:58.604: SSH2 0: partial packet length(block_size)16 bytes,
needed 32 bytes, maclen 0
*Aug 22 06:05:58.604: SSH2 0: input: padlength 14 bytes
*Aug 22 06:05:58.604: SSH2 0: send:packet of length 36 (length also includes padlen of 14)
*Aug 22 06:05:58.604: SSH2 0: Authentications that can continue = publickey,keyboard-interactive,password
*Aug 22 06:05:58.677: SSH2 0: ssh_receive: 68 bytes received
*Aug 22 06:05:58.677: SSH2 0: input: total packet length of 52 bytes
*Aug 22 06:05:58.677: SSH2 0: partial packet length(block_size)16 bytes,
needed 48 bytes, maclen 0
*Aug 22 06:05:58.677: SSH2 0: input: padlength 6 bytes
*Aug 22 06:05:58.677: SSH2 0: Using method = none
*Aug 22 06:05:58.677: SSH2 0: Authentications that can continue = publickey,keyboard-interactive,password
*Aug 22 06:05:58.677: SSH2 0: send:packet of length 68 (length also includes padlen of 18)
*Aug 22 06:05:58.755: SSH2 0: ssh_receive: 244 bytes received
*Aug 22 06:05:58.755: SSH2 0: input: total packet length of 228 bytes
*Aug 22 06:05:58.755: SSH2 0: partial packet length(block_size)16 bytes,
needed 224 bytes, maclen 0
*Aug 22 06:05:58.755: SSH2 0: input: padlength 5 bytes
*Aug 22 06:05:58.755: SSH2 0: Using method = publickey *Aug 22 06:05:58.755: SSH2 0: Received publickey algo = rsa-sha2-512 *Aug 22 06:05:58.755: SSH2 0: Got Publickey algo = 9 *Aug 22 06:05:58.755: SSH2 0: ssh2_validate_pubkey: Verifying pubkey blob is acceptable for 'ciscoadmin' in SSH2_MSG_USERAUTH_REQUEST
*Aug 22 06:05:58.755: SSH2 0: send:packet of length 196 (length also includes padlen of 19)
*Aug 22 06:05:58.755: SSH2 0: ssh2_validate_pubkey: Authenticating 'ciscoadmin' with method: publickey
*Aug 22 06:06:02.615: SSH2 0: ssh_receive: 404 bytes received
*Aug 22 06:06:02.615: SSH2 0: input: total packet length of 388 bytes
*Aug 22 06:06:02.615: SSH2 0: partial packet length(block_size)16 bytes,
needed 384 bytes, maclen 0
*Aug 22 06:06:02.615: SSH2 0: input: padlength 13 bytes
*Aug 22 06:06:02.615: SSH2 0: ssh2_verify_pubkey_sign: Verifying signature for user 'ciscoadmin' in SSH2_MSG_USERAUTH_REQUEST *Aug 22 06:06:02.615: SSH2 0: ssh2_blob_to_key: Got blob_public key ssh-rsa, blob_key_type 1, publickey_algo_type 9 *Aug 22 06:06:02.616: SSH2 0: ssh2_verify_pubkey_sign: Client Signature Verification PASSED
*Aug 22 06:06:02.616: SSH2 0: passed: Pubkey Authentication ssh2_authenticate_pubkey for user 'ciscoadmin'
*Aug 22 06:06:02.616: SSH2 0: send:packet of length 20 (length also includes padlen of 14)
*Aug 22 06:06:02.617: SSH2 0: authentication successful for ciscoadmin
*Aug 22 06:06:02.617: %SEC_LOGIN-5-LOGIN_SUCCESS: Login Success [user: ciscoadmin] [Source: 10.189.3.9] [localport: 22] at 06:06:02 UTC Fri Aug 22 2014 *Aug 22 06:06:02.617: %SSH-5-SSH2_USERAUTH: User 'ciscoadmin' authentication for SSH2 Session from 10.189.3.9 (tty = 0) using crypto cipher 'aes128-gcm@openssh.com', hmac 'hmac-sha2-256-etm@openssh.com' Succeeded
*Aug 22 06:06:02.617: SSH: bulk-mode applying server configs
*Aug 22 06:06:02.617: SSH: bulk_mode applied server configs
다음 섹션에는 여러 가지 잘못된 컨피그레이션의 디버그 출력 샘플이 나와 있습니다.
라우터 디버그
*Jul 29 23:45:34.428: SSH2 0: input: padlength 9 bytes
*Jul 29 23:45:34.465: SSH0: password authentication failed for cisco
*Jul 29 23:45:36.465: SSH2 0: Authentications that can continue = publickey,keyboard-interactive,password
*Jul 29 23:45:36.465: SSH2 0: send:packet of length 60 (length also includes padlen of 10)
*Jul 29 23:45:39.444: SSH2 0: ssh_receive: 64 bytes received
*Jul 29 23:45:39.444: SSH2 0: input: total packet length of 60 bytes
*Jul 29 23:45:39.444: SSH2 0: partial packet length(block_size)8 bytes,
needed 56 bytes, maclen 0
*Jul 29 23:45:39.444: SSH2 0: input: padlength 5 bytes
*Jul 29 23:45:39.444: SSH2 0: Using method = password
*Jul 29 23:45:39.482: SSH0: password authentication failed for cisco *Jul 29 23:45:39.483: SSH0: AAA authentication fail reason: Password: *Jul 29 23:45:41.483: SSH2 0: authentication failed for userid (code=1) *Jul 29 23:45:41.484: %SSH-5-SSH2_USERAUTH: User '' authentication for SSH2 Session from 192.168.1.2 (tty = 0) using crypto cipher 'chacha20-poly1305@openssh.com', hmac 'hmac-sha2-512' Failed *Jul 29 23:45:41.484: %SSH-5-SSH2_CLOSE: SSH2 Session from 192.168.1.2 (tty = 0) for user '' using crypto cipher 'chacha20-poly1305@openssh.com', hmac 'hmac-sha2-512' closed *Jul 29 23:45:41.584: SSH0: Session disconnected - error 0x09
라우터 디버그
R2#
*Jul 29 23:43:00.126: SSH0: starting SSH control process
*Jul 29 23:43:00.126: SSH0: sent protocol version id SSH-2.0-Cisco-1.25
*Jul 29 23:43:00.129: SSH0: protocol version id is - SSH-2.0-Cisco-1.25
*Jul 29 23:43:00.129: SSH2 0:
ssh2_server_key_exchange: kexinit sent: kex algo = curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,kex-strict-s-v00@openssh.com
*Jul 29 23:43:00.129: SSH2 0: Host-Key not configured. Skipping algo = ecdsa-sha2-nistp256
*Jul 29 23:43:00.129: SSH2 0: Host-Key not configured. Skipping algo = ecdsa-sha2-nistp384
*Jul 29 23:43:00.129: SSH2 0: Host-Key not configured. Skipping algo = ecdsa-sha2-nistp521
*Jul 29 23:43:00.129: SSH2 0: kexinit sent: hostkey algo = rsa-sha2-512,rsa-sha2-256
*Jul 29 23:43:00.129: SSH2 0: kexinit sent: encryption algo = chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-gcm,aes256-gcm,aes128-ctr,aes192-ctr,aes256-ctr
*Jul 29 23:43:00.130: SSH2 0: kexinit sent: mac algo = hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-512
*Jul 29 23:43:00.130: SSH2 0: send:packet of length 736 (length also includes padlen of 10)
*Jul 29 23:43:00.130: SSH2 0: SSH2_MSG_KEXINIT sent
*Jul 29 23:43:00.131: SSH2 0: ssh_receive: 64 bytes received
*Jul 29 23:43:00.131: SSH2 0: input: total packet length of 424 bytes
*Jul 29 23:43:00.131: SSH2 0: partial packet length(block_size)8 bytes,
needed 416 bytes, maclen 0
*Jul 29 23:43:00.131: SSH2 0: input: padlength 10 bytes
*Jul 29 23:43:00.131: SSH2 0: SSH2_MSG_KEXINIT received
*Jul 29 23:43:00.131: SSH2 0: strict kex is enabled
*Jul 29 23:43:00.131: %SSH-3-NO_MATCH: No matching cipher found: client 3des-cbc server chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-gcm,aes256-gcm,aes128-ctr,aes192-ctr,aes256-ctr *Jul 29 23:43:00.131: %SSH-5-SSH2_SESSION: SSH2 Session request from 192.168.1.2 (tty = 0) using crypto cipher '', hmac '' Failed *Jul 29 23:43:00.131: %SSH-5-SSH2_CLOSE: SSH2 Session from 192.168.1.2 (tty = 0) for user '' using crypto cipher '', hmac '' closed *Jul 29 23:43:00.232: SSH0: Session disconnected - error 0x07
라우터 디버그
R2#
*Jul 29 23:36:06.824: %SYS-4-LOG_CLEARED: Logging buffer was cleared by user Unknown
*Jul 29 23:36:11.418: SSH0: starting SSH control process
*Jul 29 23:36:11.418: SSH0: sent protocol version id SSH-2.0-Cisco-1.25
*Jul 29 23:36:11.421: SSH0: protocol version id is - SSH-2.0-Cisco-1.25
*Jul 29 23:36:11.421: SSH2 0:
ssh2_server_key_exchange: kexinit sent: kex algo = curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,kex-strict-s-v00@openssh.com
*Jul 29 23:36:11.421: SSH2 0: Host-Key not configured. Skipping algo = ecdsa-sha2-nistp256
*Jul 29 23:36:11.421: SSH2 0: Host-Key not configured. Skipping algo = ecdsa-sha2-nistp384
*Jul 29 23:36:11.421: SSH2 0: Host-Key not configured. Skipping algo = ecdsa-sha2-nistp521
*Jul 29 23:36:11.421: SSH2 0: kexinit sent: hostkey algo = rsa-sha2-512,rsa-sha2-256
*Jul 29 23:36:11.421: SSH2 0: kexinit sent: encryption algo = chacha20-poly1305@openssh.com,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-gcm,aes256-gcm,aes128-ctr,aes192-ctr,aes256-ctr
*Jul 29 23:36:11.421: SSH2 0: kexinit sent: mac algo = hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-512
*Jul 29 23:36:11.421: SSH2 0: send:packet of length 736 (length also includes padlen of 10)
*Jul 29 23:36:11.421: SSH2 0: SSH2_MSG_KEXINIT sent
*Jul 29 23:36:11.421: SSH2 0: ssh_receive: 64 bytes received
*Jul 29 23:36:11.421: SSH2 0: input: total packet length of 416 bytes
*Jul 29 23:36:11.421: SSH2 0: partial packet length(block_size)8 bytes,
needed 408 bytes, maclen 0
*Jul 29 23:36:11.422: SSH2 0: ssh_receive: 64 bytes received
*Jul 29 23:36:11.422: SSH2 0: partial packet length(block_size)8 bytes,
needed 408 bytes, maclen 0
*Jul 29 23:36:11.422: SSH2 0: input: padlength 6 bytes
*Jul 29 23:36:11.422: SSH2 0: SSH2_MSG_KEXINIT received
*Jul 29 23:36:11.423: SSH2 0: strict kex is enabled
*Jul 29 23:36:11.423: %SSH-3-NO_MATCH: No matching mac found: client hmac-sha1 server hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-512 *Jul 29 23:36:11.423: %SSH-5-SSH2_SESSION: SSH2 Session request from 192.168.1.2 (tty = 0) using crypto cipher '', hmac '' Failed *Jul 29 23:36:11.423: %SSH-5-SSH2_CLOSE: SSH2 Session from 192.168.1.2 (tty = 0) for user '' using crypto cipher '', hmac '' closed *Jul 29 23:36:11.523: SSH0: Session disconnected - error 0x07
도메인 이름 또는 호스트 이름이 변경되면 이 오류 메시지가 트리거될 수 있습니다. 다음 해결 방법을 시도해 보십시오.
RSA 키를 0으로 만들고 다시 생성합니다.
crypto key zeroize rsa label crypto key generate rsa label modulus
이전 해결 방법으로 문제가 해결되지 않으면 다음 단계를 시도해 보십시오.
모든 RSA 키를 0으로 만듭니다.
디바이스를 다시 로드합니다.
SSH용으로 레이블이 지정된 새 키를 생성합니다.
SSH 컨피그레이션 명령이 잘못된 명령으로 거부된 경우 라우터에 대한 RSA 키 쌍을 생성하지 못합니다. 호스트 이름과 도메인을 지정했는지 확인합니다. 그런 다음 crypto key generate rsa 명령을 사용하여 RSA 키 쌍을 생성하고 SSH 서버를 활성화합니다.
RSA 키 쌍을 설정할 때 이러한 오류 메시지가 표시될 수 있습니다.
"호스트 이름이 지정되지 않았습니다."
hostname 전역 설정 명령을 사용하여 라우터의 호스트 이름을 설정해야 합니다.
"지정된 도메인이 없습니다."
라우터의 호스트 도메인을 구성하려면 ip domain name global configuration 명령을 사용해야 합니다.
허용 가능한 SSH 연결 수는 라우터에 대해 구성된 최대 vty 수로 제한됩니다. 각 SSH 연결에서는 리소스를 vty 사용합니다.
SSH는 사용자 인증을 위해 라우터에서 AAA를 통해 설정된 보안 프로토콜 또는 로컬 보안을 사용합니다. AAA를 설정할 때는 콘솔이 AAA에서 실행되지 않아야 합니다. 전역 설정 모드에서 키워드를 적용하여 콘솔에서 AAA를 비활성화합니다.
명령 show ssh는 활성 SSH 세션을 표시합니다. %No SSHv2 server connections running(실행 중인 SSHv2 서버 연결 없음) 메시지는 현재 활성 상태인 SSHv2 세션이 없음을 의미합니다. show ip ssh를 사용하여 SSH 서버 상태 및 구성을 확인합니다. SSH를 이미 구성한 경우 디바이스에서 SSH 서버를 재구성하는 것이 좋습니다. 디바이스에서 SSH 서버를 재설정하려면 다음 단계를 수행하십시오.
2. 디바이스의 호스트 이름과 도메인 이름을 hostname <name> 및 ip domain name <domain> 명령을 각각 재구성합니다.
3. crypto key generate rsa 명령을 사용하여 라우터에 대한 RSA 키 쌍을 생성합니다. 이렇게 하면 SSH가 자동으로 활성화됩니다.
4. ip ssh version 2 명령을 사용하여 SSH version 2를 활성화합니다. 다른 SSH 매개변수를 지정하지 않으면 기본값이 사용됩니다.
| 개정 | 게시 날짜 | 의견 |
|---|---|---|
6.0 |
30-Jul-2026
|
재인증 |
4.0 |
06-Dec-2024
|
업데이트된 브랜딩 요구 사항 및 서식. |
3.0 |
09-Aug-2023
|
법적 고지 사항 업데이트, 대체 텍스트 및 서식 |
1.0 |
10-Sep-2001
|
최초 릴리스 |