IOS Upgrade & TFTP Download

ITSY MAN ㅣ 2016. 7. 19. 12:50

반응형

실 업무에서 가장 많이 쓰이는 것은 바로 TFTP 를 이용해서 IOS를 스위치 또는 라우터 내의 Flash Memory에 저장해서 Booting하는 작업을 많이 하곤 합니다. 이 부분을 패킷트레이서로 직접 해볼 수 있게 첨부해두었습니다.


아래와 같은 그림에서 보면 서버가 있고 스위치가 있고 라우터가 있습니다.


스위치에서 서버에 저장되어 있는 IOS를 TFTP로 다운 받고 IOS Booting하는 것을 해볼 수 있습니다

고고고고


아주아주 쉽습니다.


패킷트레이서로 할 수 있게끔 첨부해두었습니다.


2016.05.10 Password Recovery.pkt


위의 패킷트레이서 토폴로지로 패스워드 리커버리와,  IOS 업그레이드 및 TFTP 사용을 해볼 수 있습니다.


IOS 업그레이드 / 백업 / 복구 

라우터의 IP: 192.168.0.1 

TFTP 서버의 IP: 192.168.0.2 

가져올 IOS 이미지 이름: c2600-i-mz.122-28.bin 

 
Copy 명령어를 사용해 TFTP 에서 플래시 메모리로 복사 

Router#copy tftp flash  
Address or name of remote host []? 192.168.0.2 
Source filename []? c2600-i-mz.122-28.bin 
Destination filename [c2600-i-mz.122-28.bin]? 
 
Accessing tftp://192.168.0.2/c2600-i-mz.122-28.bin... 
Loading c2600-i-mz.122-28.bin from 192.168.0.2: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
 
플래시 메모리에 파일 확인 

Router#show flash 
 
System flash directory: 
File  Length   Name/status 
  3   50938004 c2800nm-advipservicesk9-mz.124-15.T1.bin 
  6   4414921  c2960-lanbase-mz.122-25.FX.bin 
  5   4670455  c2960-lanbase-mz.122-25.SEE1.bin 
  2   28282    sigdef-category.xml 
  1   227537   sigdef-default.xml 
[60279199 bytes used, 3737185 available, 64016384 total] 
63488K bytes of processor board System flash (Read/Write) 
 
Router#delete c2960-lanbase-mz.122-25.SEE1.bin 
Delete filename [c2960-lanbase-mz.122-25.SEE1.bin]? 
Delete flash:/c2960-lanbase-mz.122-25.SEE1.bin? [confirm] 
 
Router# 
 
 
IOS 이미지 백업(Cisco -> TFTP) 

Router#copy flash tftp 
Source filename []? c2600-i-mz.122-28.bin 
Address or name of remote host []? 192.168.0.2 
Destination filename [c2600-i-mz.122-28.bin]? 
 
Writing c2600-i-mz.122-28.bin...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
[OK - 5571584 bytes] 
 
5571584 bytes copied in 3.281 secs (1698000 bytes/sec) 
 
ROMMON (라우터의 이미지가 망가졌을 ) 

Router#delete flash 
Delete filename []?c2600-ipbasek9-mz.124-8.bin 
Delete flash:/c2600-ipbasek9-mz.124-8.bin? [confirm] 
 
Router#sh flash 
 
System flash directory: 
File  Length   Name/status 
  2   28282    sigdef-category.xml 
  1   227537   sigdef-default.xml 
[255819 bytes used, 63760565 available, 64016384 total] 
63488K bytes of processor board System flash (Read/Write) 
 
Router#reload  # 새로운 이미지를 불러오는 명령어 
Proceed with reload? [confirm] 
%SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload Command. 
 
System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1) 
Copyright (c) 2000 by cisco Systems, Inc. 
cisco 2621 (MPC860) processor (revision 0x200) with 60416K/5120K bytes of memory 
 
Boot process failed... 
 
The system is unable to boot automatically.  The BOOT 
environment variable needs to be set to a bootable 
image. 
rommon 1 > 
 
부팅에 적절한 IOS 이미지 파일을 찾는데 실패하면 ROMMON 상태로 부팅. 
TFTP로부터 이미지를 받아오는데 필요한 정보 
라우터의 임시 IP 주소 

라우터의 서브넷 마스크 

디폴트 게이트웨이 

TFTP 서버의 주소 

IOS 이미지 파일명 


 
ROMMON 상태에서 TFTP로부터 IOS 이미지 가져오기 (대문자로 입력한 부분은  대문자로 입력) 

rommon 1 > IP_ADDRESS=192.168.0.1 
rommon 2 > IP_SUBNET_MASK=255.255.255.0 
rommon 3 > DEFAULT_GATEWAY=192.168.0.1 
rommon 4 > TFTP_SERVER=192.168.0.2 
rommon 5 > TFTP_FILE=c2600-i-mz.122-28.bin 
rommon 6 > tftpdnld 
 
          IP_ADDRESS: 192.168.0.1 
      IP_SUBNET_MASK: 255.255.255.0 
     DEFAULT_GATEWAY: 192.168.0.1 
         TFTP_SERVER: 192.168.0.2 
           TFTP_FILE: c2600-i-mz.122-28.bin 
Invoke this command for disaster recovery only. 
WARNING: all existing data in all partitions on flash will be lost! 
 
Do you wish to continue? y/n:  [n]:  y 
 
. 
Receiving c2600-i-mz.122-28.bin from 192.168.0.2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
File reception completed. 
Copying file c2600-i-mz.122-28.bin to flash. 
 
 
설정 파일 백업  / 복구 

 
라우터의 IP: 192.168.0.1 

TFTP 서버의 IP: 192.168.0.2 


 
 
설정 NVRAM 저장한  TFTP 서버에 백업 

Router#configure terminal  
Router(config)#hostname ConfigIsLoaded 
ConfigIsLoaded(config)#^Z 
ConfigIsLoaded#copy running-config startup-config  
Destination filename [startup-config]?  
Building configuration... 
[OK] 
ConfigIsLoaded#copy startup-config tftp 
Address or name of remote host []? 192.168.0.2 
Destination filename [ConfigIsLoaded-confg]?  
 
Writing startup-config...!! 
[OK - 659 bytes] 
 
659 bytes copied in 0.078 secs (8000 bytes/sec) 
 
NVRAM 있는 설정 지우고 리부팅  다시 TFTP 에서 가져와 NVRAM 저장 

 TFTP서버와 연결된 인터페이스의 IP 서브넷은 수동으로 설정 
ConfigIsLoaded#erase startup-config  
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm] 
[OK] 
Erase of nvram: complete 
%SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram 
ConfigIsLoaded#reload 
Proceed with reload? [confirm] 
------------------------리부팅 메시지 생략------------------------ 
Router>enable  
Router#configure terminal  
Router(config)#interface fastEthernet 0/0 
Router(config-if)#ip address 192.168.0.1 255.255.255.0 
Router(config-if)#no shutdown 
 
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up 
 
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up 
 
Router(config-if)#^Z 
Router#copy tftp running-config  
Address or name of remote host []? 192.168.0.2 
Source filename []? ConfigIsLoaded-confg 
Destination filename [running-config]?  
 
Accessing tftp://192.168.0.2/ConfigIsLoaded-confg.... 
Loading ConfigIsLoaded-confg from 192.168.0.2: ! 
[OK - 659 bytes] 
 
659 bytes copied in 3.046 secs (216 bytes/sec) 
 
ConfigIsLoaded#copy running-config startup-config  
Destination filename [startup-config]?  
Building configuration... 
[OK] 









반응형