読者です 読者をやめる 読者になる 読者になる

labunix's blog

labunixのラボUnix

Cisco 3750(L3-Switch)のバックアップ、初期化、リストア、バージョンアップ

■Cisco 3750(L3-Switch)のバックアップ、初期化、リストア、バージョンアップ

 Cisco Eos 情報サイト
 http://cisco.end-of-sale.info/eos/2680


$ sudo screen /dev/ttyS0
Switch>show version | include ^Model       
Model revision number           : R0
Model number                    : WS-C3750-24TS-E

■「IP SERVICES」なのでEIGRPとOSPFのすべての機能、BGPだけでなく、
 ルータACL、VLAN ACL、プライベートVLANが使えるちゃんとしたL3スイッチ。
 LAN BASEだとL2機能まで、IP BASEでは一部のL3機能までしか使えない。
 必要な機能が組み込まれているか事前に調べるには以下から。

 Cisco Feature Navigator
 http://tools.cisco.com/ITDIT/CFN/jsp/index.jsp

Switch>show flash

Directory of flash:/

    3  drwx         192   Mar 1 1993 00:10:18 +00:00  c3750-ipservicesk9-mz.122-52.SE
  425  -rwx        1048   Mar 1 1993 00:01:00 +00:00  multiple-fs

15998976 bytes total (914944 bytes free)

■「12.2.55-SE10」が最新。
 15.0系はEOLよりも後に出ている様子。

 Cisco Catalyst 3750-24TS Switch
 http://www.cisco.com/c/en/us/support/switches/catalyst-3750-24ts-switch/model.html

Switch>show version | include ^Cisco
Cisco IOS Software, C3750 Software (C3750-IPSERVICESK9-M), Version 12.2(52)SE, RELEASE SOFTWARE (fc3)

$ tar tvf c3750-ipserviceslmk9-tar.122-55.SE10.tar | \
    awk '/^d/ && !/html/{print $NF}'
c3750-ipservicesk9-mz.122-55.SE10/

■一時的にvlan.datを作成する。
 
enable
  vlan database
  vlan 100
  exit

Switch#show flash | include vlan
    2  -rwx         616   Mar 1 1993 01:14:45 +00:00  vlan.dat

■既存の設定のバックアップ

Switch#copy running-config flash:running-config.20151122
Destination filename [running-config.20151122]? 

1441 bytes copied in 0.998 secs (1444 bytes/sec)

Switch#copy flash:vlan.dat flash:vlan.dat.20151122
Destination filename [vlan.dat.20151122]? 
Copy in progress...C
616 bytes copied in 0.017 secs (36235 bytes/sec)

■ftpで外部保管するための一時設定
 fa1/0/1に接続したLANケーブルに、
 「172.31.31.0/24」に属する未使用のIPを割り当て、
 joeパスワードなユーザアカウント「admin」を設定する場合の
 流し込みコンフィグ。

configure terminal
  interface vlan 1
    ip address 172.31.31.59 255.255.255.0
    no shutdown
    exit
  interface fastEthernet 1/0/1
    switchport access vlan 1
    no shutdown
    exit
  ip ftp usernam admin
  ip ftp password admin
  end

■ftpでコピー

Switch#copy flash:running-config.20151122 ftp://172.31.31.254
Address or name of remote host [172.31.31.254]? 
Destination filename [running-config.20151122]? 
Writing running-config.20151122 !
1441 bytes copied in 0.100 secs (14410 bytes/sec)

Switch#copy flash:vlan.dat.20151122 ftp://172.31.31.254      
Address or name of remote host [172.31.31.254]? 
Destination filename [vlan.dat.20151122]? 
Writing vlan.dat.20151122 !
616 bytes copied in 0.092 secs (6696 bytes/sec)

■初期化

Switch#delete vlan.dat
Delete filename [vlan.dat]? 
Delete flash:vlan.dat? [confirm]

Switch#erase startup-config 
Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]
[OK]
Erase of nvram: complete

Switch#show startup-config 
startup-config is not present

Switch#reload 
Proceed with reload? [confirm]

■初回起動時のrunning-configをstartup-configに保存

Switch>enable 

Switch#show startup-config 
startup-config is not present

Switch#copy running-config startup-config
Destination filename [startup-config]? 
Building configuration...
[OK]
0 bytes copied in 1.141 secs (0 bytes/sec)

■リストア
 一時設定を再度流し込んで今度は逆方向にcopyする。
 先にvlan.datをコピーしないと、再度一時的なftp設定が必要となり、
 running-configが意図したものと異なる可能性があります。
 なお、今回はローカルにも残っているので、
 ftpサーバのコンフィグを一度flahにコピーしてから
 md5でチェックサムを比較して、running-configに適用しています。


Switch#copy ftp://172.31.31.254/vlan.dat.20151122 flash:vlan.dat
Destination filename [vlan.dat]? 
Accessing ftp://172.31.31.254/vlan.dat.20151122...
Loading vlan.dat.20151122 !
[OK - 616/4096 bytes]

616 bytes copied in 0.151 secs (4079 bytes/sec)

Switch#copy ftp://172.31.31.254/running-config.20151122 flsh:running-config.20151122.1
Destination filename [running-config]? 
Accessing ftp://172.31.31.254/running-config.20151122...
Loading running-config.20151122 !
[OK - 1441/4096 bytes]
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]

1441 bytes copied in 19.034 secs (76 bytes/sec)

Switch#verify /md5 flash:running-config.20151122.1                        
.Done!
verify /md5 (flash:running-config.20151122.1) = e687a7c6d28475f39add33635b95f93c


Switch#verify /md5 flash:running-config.20151122                          
.Done!
verify /md5 (flash:running-config.20151122) = e687a7c6d28475f39add33635b95f93c

Switch#copy flsh:running-config.20151122.1 running-config

■ファームウエアのバックアップ
 ftpなら、tftpの32MB制限に引っかかるかどうか調べなくても良い。
 一時的なftp設定を行ってIOSをtarで固めてftpでアップロード。
 「archive upload-sw」でも良い。ちゃんと1ステップづつ確認したい人向け。
 それぞれ約10分かかる。

Switch#archive tar /create c3750-ipservicesk9-mz.122-52.SE.tar c3750-ipservicesk9-mz.122-52.SE
archiving c3750-ipservicesk9-mz.122-52.SE.bin (12305677 bytes)

Switch#copy c3750-ipservicesk9-mz.122-52.SE.tar ftp://172.31.31.254

■ファームウエアのアップデート

Switch#archive download-sw ftp://172.31.31.254/c3750-ipserviceslmk9-tar.122-55.SE10.tar
Loading c3750-ipserviceslmk9-tar.122-55.SE10.tar !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 13608960/4096 bytes]

Loading c3750-ipserviceslmk9-tar.122-55.SE10.tar !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
examining image...
extracting info (111 bytes)
extracting c3750-ipservicesk9-mz.122-55.SE10/info (701 bytes)
extracting info (111 bytes)

Stacking Version Number: 1.45

System Type:             0x00000000
  Ios Image File Size:   0x00C69A00
  Total Image File Size: 0x00CFAA00
  Minimum Dram required: 0x08000000
  Image Suffix:          ipservicesk9-122-55.SE10
  Image Directory:       c3750-ipservicesk9-mz.122-55.SE10
  Image Name:            c3750-ipservicesk9-mz.122-55.SE10.bin
  Image Feature:         IP|LAYER_3|PLUS|SSH|3DES|MIN_DRAM_MEG=128
Old image for switch 1: flash:/c3750-ipservicesk9-mz.122-52.SE
  Old image will be deleted before download.

Deleting `flash:/c3750-ipservicesk9-mz.122-52.SE' to create required space
...
New software image installed in flash:/c3750-ipservicesk9-mz.122-55.SE10


All software images installed.
Switch#
Switch#reload

System configuration has been modified. Save? [yes/no]: no
Proceed with reload? [confirm]

■ファームウエアのアップデート確認

Switch>show version | include ^Cisco
Cisco IOS Software, C3750 Software (C3750-IPSERVICESK9-M), Version 12.2(55)SE10, RELEASE SOFTWARE (fc2)

Switch>show version | include ^Model
Model revision number           : R0
Model number                    : WS-C3750-24TS-E

Switch>show flash                   
Directory of flash:/

    2  -rwx         616   Mar 1 1993 00:10:14 +00:00  vlan.dat
  432  drwx         192   Mar 1 1993 00:47:31 +00:00  c3750-ipservicesk9-mz.122-55.SE10
  425  -rwx        1441   Mar 1 1993 00:11:35 +00:00  running-config.20151122
  426  -rwx         616   Mar 1 1993 01:19:21 +00:00  vlan.dat.20151122
   85  -rwx        1938   Mar 1 1993 00:01:39 +00:00  private-config.text
   86  -rwx        3096   Mar 1 1993 00:01:40 +00:00  multiple-fs
   84  -rwx        1721   Mar 1 1993 00:01:39 +00:00  config.text
  430  -rwx        1441   Mar 1 1993 00:15:22 +00:00  running-config.20151122.1

15998976 bytes total (2419712 bytes free)