IOS-XE copy scp, copy sftp로 파일 복사 , 전송 하기.

IOS-XE scp, sftp로 파일 복사, 전송 하기.

1. ssh로 다른 장비 또는 서버 접속 가능한지 확인.

시스코 IOS-XE 에서 ssh 로 다른 장비나 서버에 접속하려면 아래와 같이 -l 옵션 뒤에 id, -p 옵션뒤에 포트번호를 입력하고 접속할 대상의 ip 주소를 입력하면 된다. 기본 포트번호 22는 생략 가능하다.

C9404R#ssh -l snowfox -p 22 192.168.0.20
[Connection to 192.168.0.20 aborted: error status 0]
C9404R#

위와 같은 오류가 발생할때, 아래와 같은 오류메시지를 볼 수 있다.

C9404R#sh log

Jan 28 13:25:25: %SSH-3-BAD_PACK_LEN: Bad packet length 1349676916

이 경우, ssh를 확인해 보면 사용 버전이 1.99인 것을 볼 수 있는데, ssh2를 사용하면 위의 오류가 발생하지 않는다.

C9404R#show ip ssh
SSH Enabled - version 1.99
Authentication methods:publickey,keyboard-interactive,password
Authentication Publickey Algorithms:x509v3-ssh-rsa,ssh-rsa,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,x509v3-ecdsa-sha2-nistp256,x509v3-ecdsa-sha2-nistp384,x509v3-ecdsa-sha2-nistp521,rsa-sha2-256,rsa-sha2-512
Hostkey Algorithms:x509v3-ssh-rsa,rsa-sha2-512,rsa-sha2-256,ssh-rsa
Encryption Algorithms:aes128-gcm,aes256-gcm,aes128-ctr,aes192-ctr,aes256-ctr
MAC Algorithms:hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha2-512
KEX Algorithms:ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1
Authentication timeout: 120 secs; Authentication retries: 3
Minimum expected Diffie Hellman key size : 2048 bits
IOS Keys in SECSH format(ssh-rsa, base64 encoded): TP-self-signed-2210571484
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHUHQ7EBLEH+gqGXvVmVRY/sgw0AYFoA+OzXXxTGSl
ieLB9IPPkh0KZRiNNIj7V9KboiTkOkbW5+C53SfBxZBqZkT3rnoXg0LLY0FTHzRRe/xrbsOCSzQztZuJ
vdc1LT3+64HgOOkANJgnKu9JFV9IYVGlrZFMrhNE3eMcVtKliKEDxxHrD6ArwZR0qZzELFwRaGPO/v+B
MB/wtHOD+gCtIuEuUe+kNAiYWGi10ByKnULjEECzMvrcESYj7oIb7rfj9ECkaFwyGr4500Sb4HPtQivO
mzM+HdBUyTw23uESNDsBwcC8InGJ7Ds9MpGWFLjM0zYOl8RF1JyDjLpGJlRP                    

ssh 버전2를 사용하도록 설정한다.

C9404R#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
C9404R(config)#ip ssh version ?
  2  Protocol Version to be supported

C9404R(config)#ip ssh version 2
C9404R(config)#end

이제, 다시 ssh 접속을 해 보면 접속이 잘 된다.

C9404R#ssh -l snowfox -p 22 192.168.0.20
Password: 

2. sftp로 스위치의 파일을 리눅스 서버에 전송하기.

아래는 c9404 장비의 license.txt파일을 리눅스 서버의 /home/snowfox 디렉토리에 복사하는 예이다. 아래에서 포트번호22번 뒤에 //를 사용해야한다. 그렇지 않으면 오류가 발생한다.
기본 포트번호 22를 사용한다면, :22는 생략가능하다.

C9404R#copy bootflash:license.txt sftp://snowfox@192.168.0.20:22//home/snowfox/license.txt
Address or name of remote host [192.168.0.20]? 
Destination username [snowfox]? 
Destination filename [/home/snowfox/license.txt]? 
Password: 

SFTP send: Writing to /home/snofox/license.txt size 55402
!
55402 bytes copied in 6.463 secs (8572 bytes/sec)

3. scp로 파일을 스위치로 복사하기.

다음은 리눅스 서버의 license.txt 파일을 scp 명령으로 스위치에 복사하는 예이다. 물론, scp대신 sftp를 사용해도 된다. 파일은 리눅스 서버의 /home/snowfox/license.txt 이다.

C9404R#copy scp://snowfox@192.168.0.20:22//home/snowfox/license.txt bootflash:license.txt
Destination filename [license.txt]? 
Password: 
 Sending file modes: C0664 16441 license.txt
!!
16441 bytes copied in 5.466 secs (3008 bytes/sec)

답글 남기기

Your email address will not be published.