(NW)Linux <--> SwitchのIOSリカバリー

投稿者: | 2020年7月16日
皆さんこんにちは。
今回はCisco Switch(Catalyst 3560)のIOSファイルをリカバリー手順をメモしておきます。色々いじってやらかしてしまったときの自分用メモです。 とりあえず以下のサイトを見ておけば大丈夫だとおもいます。
Catalyst – xmodem
Send file by xmodem or kermit protocol with GNU screen

MODEボタンを長押しして起動させる

これすることでxmodemでファイルを送信できるようになるっぽい。

IOSファイルをスイッチに転送する

接続環境はこんな感じです、
Gentoo Linux(screenコマンド) <—-> Switch

手元のLinuxにバックアップしておいたIOSファイルをスイッチに転送します。そのためにLinux側に「sxコマンド」が必要になるのでインストールしておきます。
### コマンドのパッケージを検索
hiro-gentoo ~ # e-file sx
[I] net-dialup/lrzsz
        Available Versions:     0.12.20-r3 0.12.20-r4 
        Last Installed Ver:     0.12.20-r4(2020年07月16日 20時08分31秒)
        Homepage:               https://www.ohse.de/uwe/software/lrzsz.html
        Description:            Communication package providing the X, Y, and ZMODEM file transfer protocols
        Matched Files:          /usr/bin/sx; 

### インストールする
hiro-gentoo ~ # emerge -av net-dialup/lrzsz

### インストール完了
hiro-gentoo ~ # which sx
/usr/bin/sx
次にIOSファイルをスイッチに転送します。
「screenコマンド」でスイッチに接続してるターミナル上で以下を入力します。
### 受信を開始するコマンドっぽい
switch: copy xmodem: flash:c3560-ipbasek9-mz.122-44.SE6.bin

### 上記コマンドをスイッチ上で実行したら「screenコマンド」の機能を使ってIOSファイルを転送します
* 「ctrl + a」を押す
* 「:」を入力する
* 「exec !! sx c3560-ipbasek9-mz.122-44.SE6.bin」を入力する
* エンターでIOSファイルがローカルPCからスイッチに転送されます
Begin the Xmodem or Xmodem-1K transfer now...
CSending nw-config/c3560-ipbasek9-mz.122-44.SE6/c3560-ipbasek9-mz.122-44.SE6.bin, 69152 blocks: Give your local XMODEM receive command now.
Xmodem sectors/kbytes sent:   0/ 0kRetry 0: NAK on sector
Xmodem sectors/kbytes sent:   1/ 0kRetry 0: NAK on sector
Xmodem sectors/kbytes sent: 7404/925k
### 転送完了。めちゃくちゃ時間かかります。(3時間ぐらい?)
switch: copy xmodem: flash:c3560-ipbasek9-mz.122-44.SE6.bin
Begin the Xmodem or Xmodem-1K transfer now...
CSending nw-config/c3560-ipbasek9-mz.122-44.SE6/c3560-ipbasek9-mz.122-44.SE6.bin, 69152 blocks: Give your local XMODEM receive command now.
Xmodem sectors/kbytes sent:   0/ 0kRetry 0: NAK on sector
Xmodem sectors/kbytes sent:   1/ 0kRetry 0: NAK on sector
Bytes Sent:8851584   BPS:881

Transfer complete
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
File "xmodem:" successfully copied to "flash:c3560-ipbasek9-mz.122-44.SE6.bin"
### 転送したIOSからブートさせる
switch: boot flash:c3560-ipbasek9-mz.122-44.SE6.bin
無事起動できました。。よかった。。
Switch#show version 
Cisco IOS Software, C3560 Software (C3560-IPBASEK9-M), Version 12.2(44)SE6, RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2009 by Cisco Systems, Inc.
Compiled Mon 09-Mar-09 17:42 by gereddy
Image text-base: 0x00003000, data-base: 0x01600000

ROM: Bootstrap program is C3560 boot loader
BOOTLDR: C3560 Boot Loader (C3560-HBOOT-M) Version 12.2(35r)SE2, RELEASE SOFTWARE (fc1)

Switch uptime is 1 minute
System returned to ROM by power-on
System image file is "flash:c3560-ipbasek9-mz.122-44.SE6.bin"


This product contains cryptographic features and is subject to United
States and local country laws governing import, export, transfer and
use. Delivery of Cisco cryptographic products does not imply
third-party authority to import, export, distribute or use encryption.
Importers, exporters, distributors and users are responsible for
compliance with U.S. and local country laws. By using this product you
agree to comply with applicable laws and regulations. If you are unable
to comply with U.S. and local laws, return this product immediately.
 --More-- 
それではまた。