VXLAN Arista 스위치 파일 관리
개인적으로 사용하는 방법을 정리 (스위치 Client 기준)
파일 전송 방법은 switch cli 모드 와 리눅스 bash 모드 두 개로 구분
Hello world
1. switch cli mode [ copy command ]
- 서버와의 통신 VRF 유무 체크
- VRF 를 사용한다면 해당 VRF 모드로 진입하는것이 사용하기 편함
HostSW1#cli vrf mgmt HostSW1(vrf:mgmt)#
cli vrf mgmt- Apple
- Orange
- Banana
2. 기본적으로 22번 포트와 연결을 사전에 확인 및 접속시 기본 디렉토리 확인
주의 : cli에서 ssh 접속시 Bash 처럼 ssh min@192.168.22.251 명령이 아닌 “-l” 옵션을 사용하여 별도로 ID를 주고 IP를 입력하게 되어있습니다.
HostSW1(vrf:mgmt)#ssh -l min 192.168.22.251 Warning: Permanently added '192.168.22.251' (ECDSA) to the list of known hosts. min@192.168.22.251's password: min@ubuntu2004:~$ pwd /home/min
- copy 명령 : client로서 remote 시스템과 파일전송을 위해 사용할 수 있는 명령은 ftp, http, https, scp, sftp, tftp 가 있습니다. 아리스타 스위치가 ssh 가 기본이다 보니, 스위치를 server mode로 이용하는 경우도 있기에, 대부분 scp 나 sftp 를 이용하게 되지만 각각의 서버가 구성되어 있으시다면 Client 로는 어느 서비스를 사용하셔도 상관은 없을 듯 합니다. (테스트로 사용된 test01.txt test02.txt 파일은 touch로 만들어서 용량이 없습니다.)
HostSW1(vrf:mgmt)#copy ? alert-base: Source file path boot-extensions Copy boot extensions configuration certificate: Source file path checkpoint: Source file path clean-config Copy from clean, default, configuration extension: Source file path file: Source file path flash: Source file path ftp: Source file path http: Source file path https: Source file path installed-extensions Copy installed extensions status running-config Copy from current system configuration scp: Source file path sftp: Source file path startup-config Copy from startup configuration system: Source file path terminal: Source file path tftp: Source file path
- 원격 시스템에서 파일을 복사 (from remote server to local flash)
scp
HostSW1(vrf:mgmt)#copy scp:min@192.168.22.251/home/min/test01.txt flash:
min@192.168.22.251's password:
test01.txt 100% 0 0.0KB/s 00:00
Copy completed successfully.
sftp
HostSW1(vrf:mgmt)#copy sftp:min@192.168.22.251/home/min/test01.txt flash: min@192.168.22.251's password: sftp> progress Progress meter enabled sftp> get '/home/min/test01.txt' '/mnt/flash/test01.txt.t1xvTQ' Fetching /home/min/test01.txt to /mnt/flash/test01.txt.t1xvTQ Copy completed successfully.
- 원격 시스템으로 파일을 복사 (from local flash to remote server)
scp
HostSW1(vrf:mgmt)#copy flash:test02.txt scp:min@192.168.22.251/home/min/
min@192.168.22.251's password:
test02.txt 100% 0 0.0KB/s 00:00
Copy completed successfully.
sftp
HostSW1(vrf:mgmt)#copy flash:test02.txt sftp:min@192.168.22.251/home/min/
min@192.168.22.251's password:
sftp> progress
Progress meter enabled
sftp> put '/mnt/flash/test02.txt' '/home/min/'
Uploading /mnt/flash/test02.txt to /home/min/test02.txt
/mnt/flash/test02.txt 100% 0 0.0KB/s 00:00
Copy completed successfully.
- TIP : 원격 시스템으로 running-config 를 복사 (주의 password 입력 text가 보임) 저 같은 경우는 여러대의 스위치에서 동시에 running-config 나 startup-config 를 서버에 복사하기 위해 아래와 같은 명령을 사용합니다. (파일 저장이름으로 호스트명과 date 를 사용하기 위해 default vrf 에서 bash FastCli를 사용합니다.) 각각의 호스트 네임으로 저장되기에 호스트네임만 동일한 것이 없다면 동시에 여러스위치에서 저장이 가능 합니다. 그러나 패스워드 입력시 히든처리가 안되고 보임으로 주의해야 합니다.
HostSW1(vrf:mgmt)#cli vrf default HostSW1# HostSW1#bash FastCli -p 15 -c $'cli vrf mgmt\n copy running-config scp:min@192.168.22.251/home/min/'${HOSTNAME}-$(date +%m_%d)-run min@192.168.22.251's password: 12341234
서버에서 확인시 파일명
min@ubuntu2004:~$ ls -l | grep run -rw-rw-r-- 1 min min 2266 Jul 11 15:51 HostSW1-07_11-run
- 아마도 패스워드 입력이 없는 tftp를 사용한다면 아래와 같이사용 가능 할 것 같습니다.(미확인) bash FastCli -p 15 -c 'copy running-config tftp://192.168.22.151/'$HOSTNAME-$(date +%m_%d)-run
2. 리눅스 bash mode : sftp
switch cli mode 와 1-2 는 동일 합니다.
- 리눅스 bash 모드에서 flash 디렉토리로 이동후 sftp 서버 접속 (로컬의 기본 디렉토리를 flash로 하기 위해, 혹은 lcd를 통해 변경)
HostSW1(vrf:mgmt)#bash
Arista Networks EOS shell
[admin@HostSW1 ~]$ pwd /home/admin [admin@HostSW1 ~]$ cd /mnt/flash [admin@HostSW1 flash]$ pwd /mnt/flash [admin@HostSW1 flash]$ [admin@HostSW1 flash]$ sftp min@192.168.22.251 Warning: Permanently added '192.168.22.251' (ECDSA) to the list of known hosts. min@192.168.22.251's password: Connected to 192.168.22.251. sftp>
아래 필수 sftp 명령를 포함하였습니다. Get 이나 put 이용시 파일 리스트의 확인이 필요할 경우 ls 와 lls를 이용하시면 편리합니다. ls - 접속한 서버의 디렉토리에서 파일리스트 확인 lls - local ls, client의 디렉토리 파일 확인
- 원격 시스템에서 파일을 복사 (from remote server to local flash)
sftp> get test01.txt Fetching /home/min/test01.txt to test01.txt
- 원격 시스템으로 파일을 복사 (from local flash to remote server)
sftp> put test02.txt Uploading gt to /home/min/test02.txt test02.txt 100% 0 0.0KB/s 00:00
- TIP : sftp 이용시 디렉토리 복사가 가능합니다 간혹 case 시에 TAC에서 tech-support 디렉토리의 100개 파일 전체를 요청할 경우가 있습니다. 물론 tar를 진행해서 파일하나로 하는 경우가 대부분이지만 Sftp를 이용할 경우 디렉토리 전체 전송이 가능 합니다.
sftp> put -r schedule/tech-support/
Uploading schedule/tech-support/ to /home/min/tech-support
Entering schedule/tech-support/
schedule/tech-support/HostSW1_tech-support_2022-07-08.2242 100% 84KB 83.8KB/s 00:00
schedule/tech-support/HostSW1_tech-support_2022-07-08.2342 100% 84KB 83.8KB/s 00:00
… 중략
schedule/tech-support/HostSW1_tech-support_2022-07-10.1742 100% 84KB 83.8KB/s 00:00
schedule/tech-support/HostSW1_tech-support_2022-07-11.1442 100% 84KB 83.8KB/s 00:00