Skip to main content

Arista 스위치 파일 관리

· 9 min read

개인적으로 사용하는 방법 정리

  • 2022.07.15 : 1st

1. Switch role : SFTP Server​


  • 사전에 스위치에 ID 계정 및 aaa authorization exe 설정이 필요
configure terminal 
username admin privilege 15 secret admin
aaa authorization exec default local
  • 기본적으로 스위치 접속을 위해 ssh 를 이용하다 보니, sftp 를 주로 이용하게 됨
    • MobaXterm : 접속시 자동으로 SSH browser(SFTP) 연결
    • SecureCRT : ssh 접속 후, connected SFTP session 기능 사용
    • Xshell 7 : ssh 접속 후, 새 파일 전송 기능 (Ctrl+F) 사용
  • upload(put) : cd /mnt/flash/ 디렉토리로 이동 후, 화면에 Drag-and-drop
  • download(get): sftp 명령(get) 이용 - download 폴더 확인 필요
  • WinSCP 의 경우 드물게 사용, 대부분의 terminal 프로그램에서 되는데 굳이 사용을? putty 이용시?

2. Switch role : Client​


  • 두 개 mode로 사용 가능
    • Switch cli mode : ftp, http, https, scp, sftp, tftp
    • Linux bash mode : 여기서는 sftp 만 설명
  • VRF 사용 유무 확인
    • 스위치가 client 일 경우 VRF 를 사용한다면 해당 VRF 모드가 사용하기 편함
  • Server에 권한이 있는 계정 필요 (예제의 계정은 min)
note

EOS-4.20 train 이전 version 의 경우 routing-context vrf [VRF name] 명령 사용

cli vrf mgmt
  • VRF 모드에서 ssh server에 접속하여 Port 22 및 접속시 기본 디렉토리 확인
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
note
  • cli에서 ssh 접속시 -l 옵션을 사용하여 ID를 입력

3. Switch Cli mode​


  • Cli에서 client로서 사용할 수 있는 옵션은 ftp, http, https, scp, sftp, tftp
  • test01.txt test02.txt 파일은 touch로 만들어서 용량 0
copy option
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

3-1. 원격 시스템에서 파일을 복사 (from remote server to local flash)​

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.

3-2. 원격 시스템으로 파일을 복사 (from local flash to remote server)​

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.

3-3. TIP 원격 시스템으로 파일을 복사 (동시에 여러대 다른이름으로 파일 저장)​

tip
  • 원격 시스템으로 running-config 를 복사
  • 파일 저장이름으로 리눅스 환경변수를 사용하기 위해 Bash FastCli를 사용
  • 각각의 호스트네임으로 저장되기에 동일한 호스트네임이 없다면 동시에 여러스위치의 config 저장 가능
  • 주의 password 입력시 text가 보임
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
Copy 용
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@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

4. 리눅스 bash mode : sftp client​


  • bash mode 진입
  • bash mode에서 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]$ 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>
note
  • 아래 필수 sftp 명령를 포함하였습니다. Get 이나 put 이용시 파일 리스트의 확인이 필요할 경우 ls 와 lls를 - 이용하시면 편리합니다.
  • ls - 접속한 서버의 디렉토리에서 파일리스트 확인
  • lls - local ls, client의 디렉토리 파일 확인

4-1. 원격 시스템에서 파일을 복사 (from remote server to local flash)​

sftp> get test01.txt 
Fetching /home/min/test01.txt to test01.txt

4-2. 원격 시스템으로 파일을 복사 (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

4-3. 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

4-4. sftp 명령​

명령local 명령설명
lslls작업 디렉토리의 내용을 나열
cdlcd작업 디렉토리를 변경
pwdlpwd작업 디렉토리의 위치 확인
mkdir-원격 시스템에서 디렉토리를 생성
rmdir-원격 시스템에서 디렉토리를 삭제
get-원격 작업 디렉토리에서 로컬 작업 디렉토리로 파일을 복사
put-로컬 작업 디렉토리에서 원격 작업 디렉토리로 파일을 복사
delete-원격 작업 디렉토리에서 파일을 삭제
bye-sftp 세션을 종료
help-sftp 명령을 모두 나열

5. 스위치 OS download 및 boot-system 설정​


note
  • 여러대의 스위치에서 동시에 install 명령을 사용하여 boot 설정까지 마무리
  • 사전 flash 용량 확인은 필요 합니다.
  • boot-system 명령보다 install 명령 사용
    • Modular 스위치의 경우 Sup 이중화에 동시 적용
    • 습관적으로 boot-system 명령을 사용하다 Modular 스위치에서 실수 할 수 있음
      • boot-system 명령시 하나의 sup에만 boot 적용
HostSW1(vrf:mgmt)#install source scp:min@192.168.22.49/m-images/eos-scripts/EOS-4.27.4M.swi
Downloading image...min@192.168.22.49's password:
EOS-4.27.4M.swi 100% 1065MB 8.3MB/s 02:08
done.
Preparing new boot-config... done.
Committing changes... done.
Installation succeeded.
-
HostSW1(vrf:mgmt)#show boot
Software image: flash:/EOS-4.27.4M.swi
Console speed: (not set)
Aboot password (encrypted): (not set)
Memory test iterations: (not set)
HostSW1(vrf:mgmt)#