Cisco IOSの更新

* [Cisco - IOSの更新でハマった - Qiita](http://qiita.com/tukiyo3/items/609b3328b2d425e3428d)
* [Cisco - L2SWにIPを設定する最短手順 - Qiita](http://qiita.com/tukiyo3/items/2967cfda5eeb75349b15)

も参照のこと。

# 参考

* [ソフトウェア アップグレード手順 - Cisco Systems](http://www.cisco.com/cisco/web/support/JP/102/1020/1020704_sw_upgrade_proc_ram-j.html#step6)
* [あいむの珍妄想ページ ～ののキューブ ～Cisco機器のFAQ集](http://homepage3.nifty.com/sony/sd/contents/cisco_faq.htm)

# 準備

[Macでtftpサーバを起動 - Qiita](http://qiita.com/tukiyo3/items/c9ca4bc6c62e78e80ae3)を済ませておく。

## ubuntuの場合

```
sudo apt-get install tftpd-hpa tftp
```

```diff:/etc/default/tftpd-hpa
  TFTP_USERNAME="tftp"
  TFTP_DIRECTORY="/srv/tftp"
  TFTP_ADDRESS=":69"
- TFTP_OPTIONS="--secure"
+ TFTP_OPTIONS="-c -v -s"
```

```sh
sudo chown tftp:tftp /srv/tftp/
sudo service tftpd-hpa restart
```

* /srv/tftp/ に `sample.txt`などなにかファイルを置いておく。

```sh
tftp localhost

# download
get sample.txt

# upload
put readme.txt
```



IOSをダウンロードしておく。

C3650の場合

* [Download Software - Cisco Systems](http://software.cisco.com/download/navigator.html)

![スクリーンショット 2014-11-07 15.08.31.png](https://qiita-image-store.s3.amazonaws.com/0/25728/3247cd43-0a9e-1ef0-5331-ceec20c1db21.png "スクリーンショット 2014-11-07 15.08.31.png")


![ios download-1.png](https://qiita-image-store.s3.amazonaws.com/0/25728/b6fe8dd8-ed5b-876d-d14e-e7863768d9f5.png "ios download-1.png")

C3750の場合

![無題.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/25728/fd647caa-d312-bb94-3df4-4c5c805f1fcf.png)



## flash領域にコピー

* MacのIPを192.168.100.103とする。

```bash:
#copy tftp: flash:
Address or name of remote host [192.168.100.103]?
Source filename [cat3k_caa-universalk9.SPA.03.03.05.SE.150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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[OK - 257651868 bytes]

257651868 bytes copied in 1360.900 secs (189325 bytes/sec)
```

> 1360.900 

23分かかった。

## flash領域確認

```bash:
#dir flash:
Directory of flash:/

 7746  -rw-    79121160  Aug 13 2014 18:09:32 +09:00  cat3k_caa-base.SPA.03.03.03SE.pkg
 7747  -rw-     6484668  Aug 13 2014 18:09:33 +09:00  cat3k_caa-drivers.SPA.03.03.03SE.pkg
 7748  -rw-    34522096  Aug 13 2014 18:09:32 +09:00  cat3k_caa-infra.SPA.03.03.03SE.pkg
 7749  -rw-    34821452  Aug 13 2014 18:09:33 +09:00  cat3k_caa-iosd-universalk9.SPA.150-1.EZ3.pkg
 7750  -rw-    25131920  Aug 13 2014 18:09:32 +09:00  cat3k_caa-platform.SPA.03.03.03SE.pkg
 7751  -rw-    77312832  Aug 13 2014 18:09:33 +09:00  cat3k_caa-wcm.SPA.10.1.130.0.pkg
 7752  -rw-        1248  Aug 13 2014 18:09:44 +09:00  packages.conf
 7753  -rw-     2097152   Nov 4 2014 10:34:06 +09:00  nvram_config
 7754  -rw-         916   Nov 4 2014 09:06:01 +09:00  vlan.dat
 7755  -rw-   257651868   Nov 7 2014 15:07:35 +09:00  cat3k_caa-universalk9.SPA.03.03.05.SE.150-1.EZ5.bin

1621966848 bytes total (1101815808 bytes free)
```

`cat3k_caa-universalk9.SPA.03.03.05.SE.150-1.EZ5.bin`があることを確認。


```bash:ファイルの検証
# verify flash:cat3k_caa-universalk9.SPA.03.03.05.SE.150-1.EZ5.bin
Digital signature successfully verified in package cat3k_caa-base.SPA.03.03.05SE.pkg
Digital signature successfully verified in package cat3k_caa-infra.SPA.03.03.05SE.pkg
Digital signature successfully verified in package cat3k_caa-platform.SPA.03.03.05SE.pkg
Digital signature successfully verified in package cat3k_caa-iosd-universalk9.SPA.150-1.EZ5.pkg
Digital signature successfully verified in package cat3k_caa-wcm.SPA.10.1.150.0.pkg
Digital signature successfully verified in package cat3k_caa-drivers.SPA.03.03.05SE.pkg
Digital signature successfully verified in file flash:cat3k_caa-universalk9.SPA.03.03.05.SE.150-1.EZ5.bin
```


## コンフィギュレーション レジスタの設定

* [すべての Cisco ルータ上でのコンフィギュレーション レジスタの使用 - Cisco Systems](http://www.cisco.com/cisco/web/support/JP/100/1004/1004550_config-register-use.html)

```bash:
#show ver | include register
Configuration register is 0x102
```

```bash:0x2102に設定
#conf t
(config)#config-register 0x2102
(config)#^Z
```

```bash:ブート変数の確認
#show ver | include register
```

* 今回は出力なし。

```bash:ブート変数の設定
#conf t
(config)#no boot system
(config)#boot system flash:cat3k_caa-universalk9.SPA.03.03.05.SE.150-1.EZ5.bin
(config)#^Z
```


```bash:ブート変数の確認
#show run | include boot system
boot system switch all flash:cat3k_caa-universalk9.SPA.03.03.05.SE.150-1.EZ5.bin
```

```bash:設定保存
#write memory
Building configuration...
Compressed configuration from 5968 bytes to 2645 bytes[OK]
```

```bash:再起動
#reload
Reload command is being issued on Active unit, this will reload the whole stack
Proceed with reload? [confirm]
Connection closed by foreign host.
```

起動まで5分はかかるので気長に待つ。

## バージョン確認

```bash:更新前
#show ver
Cisco IOS Software, IOS-XE Software, Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 03.03.03SE RELEASE SOFTWARE (fc2)
```

```bash:更新後
#show ver
Cisco IOS Software, IOS-XE Software, Catalyst L3 Switch Software (CAT3K_CAA-UNIVERSALK9-M), Version 03.03.05.SE RELEASE SOFTWARE (fc1)
```

## 現在の設定値確認

```bash:
#show ver | include register
Configuration register is 0x102
#show run | include boot system
boot system switch all flash:cat3k_caa-universalk9.SPA.03.03.05.SE.150-1.EZ5.bin
```

----

## tar形式のupload

* [Ciscoデバイスの管理 - Catalystスイッチ - archiveコマンドによるIOSのダウンロード](http://www.infraexpert.com/study/ciscoios15.html)

```
archive upload-sw http://192.168.100.98/c2960-lanbasek9-tar.122-55.SE11.tar
```

### 一括削除

　IOSイメージやHTMLファイル等を一括削除したくなった場合

```go
delete /force /recursive flash:
```