メインだよ(カテゴリーアーカイブ)

2006年6月15日

flashのIOSイメージが壊れているとき

悲しいことに、電源をいれてみたらIOSが起動しませんでした。

System Bootstrap, Version 12.3(8r)YH8, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2006 by cisco Systems, Inc.
C1800 platform with 131072 Kbytes of main memory with parity disabled

Upgrade ROMMON initialized
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......
open(): Open Error = -47
loadprog: error - on file open
boot: cannot load "flash:"

System Bootstrap, Version 12.3(8r)YH8, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2006 by cisco Systems, Inc.
C1800 platform with 131072 Kbytes of main memory with parity disabled

Upgrade ROMMON initialized
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......
open(): Open Error = -47
loadprog: error - on file open
boot: cannot load "flash:"

System Bootstrap, Version 12.3(8r)YH8, RELEASE SOFTWARE (fc2)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 2006 by cisco Systems, Inc.
C1800 platform with 131072 Kbytes of main memory with parity disabled

Upgrade ROMMON initialized
rommon 1 >


■ROMモニターからIOSを起動させてみる

rommon 23 > boot
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......
open(): Open Error = -47
loadprog: error - on file open
boot: cannot load "flash:"


やっぱだめだ。。。


■ROMモニターからflashの中を見る

rommon 4 > dir flash:
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......
Directory of flash:

2 16882452 -rw- c181x-advipservicesk9-mz.124-6.T.bin
4124 2202 -rw- sdmconfig-1811-1812.cfg
4125 4052480 -rw- sdm.tar
5115 812032 -rw- es.tar
5314 1007616 -rw- common.tar
5560 1038 -rw- home.shtml
5561 113152 -rw- home.tar
5589 511939 -rw- 128MB.sdf


一応、IOSのファイルはあるので、イメージが壊れちゃったのかもしれない。


運よく他の正常に起動する1812JのIOSイメージをtftpサーバーに保存しておいたので、それをflashに書き込むことにする。

■メモリを確認する

rommon 30 > meminfo
Main memory size: 128 MB.
Available main memory starts at 0x80012000, size 0x1ffb8 KB
IO (packet) memory size: 10 percent of main memory.
NVRAM size: 192 KB

IOSのイメージは17MBくらいだからだいじょうぶかな?


■環境変数(っていうのかな?)を確認する

rommon 31 > set
PS1=rommon ! >
RET_2_RTS=14:40:45 UTC Wed May 10 2006
WARM_REBOOT=FALSE
BSI=0
RET_2_RCALTS=
RANDOM_NUM=1663698727
?=0


■tftpを使えるように環境変数をセットする

rommon 42 > IP_ADDRESS=10.0.16.36
rommon 44 > IP_SUBNET_MASK=255.255.255.0
rommon 45 > DEFAULT_GATEWAY=10.0.16.254
rommon 46 > TFTP_SERVER=10.0.16.11
rommon 47 > TFTP_FILE=c181x-advipservicesk9-mz.124-6.T.bin
rommon 49 > TFTP_VERBOSE=2


■tftpdnldコマンドのHELP

rommon 37 > tftpdnld -h

Missing or illegal ip address for variable IP_ADDRESS
Illegal IP address.

usage: tftpdnld [-hr]
Use this command for disaster recovery only to recover an image via TFTP.
Monitor variables are used to set up parameters for the transfer.
(Syntax: "VARIABLE_NAME=value" and use "set" to show current variables.)
"ctrl-c" or "break" stops the transfer before flash erase begins.

The following variables are REQUIRED to be set for tftpdnld:
IP_ADDRESS: The IP address for this unit
IP_SUBNET_MASK: The subnet mask for this unit
DEFAULT_GATEWAY: The default gateway for this unit
TFTP_SERVER: The IP address of the server to fetch from
TFTP_FILE: The filename to fetch

The following variables are OPTIONAL:
TFTP_VERBOSE: Print setting. 0=quiet, 1=progress(default), 2=verbose
TFTP_RETRY_COUNT: Retry count for ARP and TFTP (default=18)
TFTP_TIMEOUT: Overall timeout of operation in seconds (default=7200)
TFTP_CHECKSUM: Perform checksum test on image, 0=no, 1=yes (default=1)
FE_PORT: 0(default), 1
FE_SPEED_MODE: 0=10/hdx, 1=10/fdx, 2=100/hdx, 3=100/fdx,
4=Auto (default)

Command line options:
-h: this help screen
-r: do not write flash, load to DRAM only and launch image


■TFTPでIOSイメージをflashに書き込んでみる
※EtherケーブルはFE0に挿す

rommon 50 > tftpdnld

IP_ADDRESS: 10.0.16.36
IP_SUBNET_MASK: 255.255.255.0
DEFAULT_GATEWAY: 10.0.16.254
TFTP_SERVER: 10.0.16.11
TFTP_FILE: c181x-advipservicesk9-mz.124-6.T.bin
TFTP_MACADDR: 00:17:e0:b9:b0:6e
TFTP_VERBOSE: Verbose
TFTP_RETRY_COUNT: 18
TFTP_TIMEOUT: 7200
TFTP_CHECKSUM: Yes
FE_PORT: 0
FE_SPEED_MODE: Auto Detect

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

Performing tftpdnld over Fast Enet.
Initializing interface.
ARPing for 10.0.16.11
ARP reply for 10.0.16.11 received. MAC address 00:03:ff:b9:b1:46
Receiving c181x-advipservicesk9-mz.124-6.T.bin from 10.0.16.11 !!!!!!!!!!!!!!!!!
(省略)
File reception completed.
Validating checksum.
Copying file c181x-advipservicesk9-mz.124-6.T.bin to flash.
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......

Format: Drive communication & 1st Sector Write OK...
Writing Monlib sectors.
................................................................................
......................
Monlib write complete

Format: All system sectors written. OK...
Format: Operation completed successfully.

Format of flash: complete
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......

rommon 54 > dir flash:
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......
Directory of flash:

2 16882452 -rw- c181x-advipservicesk9-mz.124-6.T.bin


■再びflushからIOSを起動してみる

rommon 55 > b
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......
program load complete, entry point: 0x80012000, size: 0xc0c0

Initializing ATA monitor library.......

program load complete, entry point: 0x80012000, size: 0x101999c
Stack pointer : 0x08000000
monstack : 0x8000549C
monra : 0x00000000
edata : 0x800167D0
magic : 0xFEEDFACE
memsize : 0x08000000
uncomp_size : 0x03299C54
comp_size : 0x010151B6
STACK_BYTES : 0x00008000
COPY_CODE_BUF : 0x00000800
_end : 0x8003F044
comp_checksum : 0x10E5B470
comp_checksum : 0x10E5B470
uncomp_checksum : 0x253667B2
Self decompressing the image : #################################################
################################################################################
################################################################################
################################################################################
############################### [OK]
Source elf_hdr->e_shnum = 0x00000009
Setting up to copy ELF section 0x00000001
to image_info section 0x00000000
sh_name = 0x0000000B
sh_type = 0x00000001
sh_flags = 0x00000007
sh_addr = 0x80012000
sh_offset = 0x00000060
sh_size = 0x01F0ACEC
sh_link = 0x00000000
sh_info = 0x00000000
sh_addralign = 0x00000020
sh_entsize = 0x00000000
Setting up to copy ELF section 0x00000002
to image_info section 0x00000001
sh_name = 0x00000011
sh_type = 0x00000001
sh_flags = 0x00000002
sh_addr = 0x81F1CCEC
sh_offset = 0x01F0AD4C
sh_size = 0x01054F9C
sh_link = 0x00000000
sh_info = 0x00000000
sh_addralign = 0x00000008
sh_entsize = 0x00000000
Setting up to copy ELF section 0x00000004
to image_info section 0x00000002
sh_name = 0x00000021
sh_type = 0x00000001
sh_flags = 0x00000003
sh_addr = 0x82F71C88
sh_offset = 0x02F5FCE8
sh_size = 0x00339B98
sh_link = 0x00000000
sh_info = 0x00000000
sh_addralign = 0x00000008
sh_entsize = 0x00000000
Setting up to copy ELF section 0x00000005
to image_info section 0x00000003
sh_name = 0x00000027
sh_type = 0x00000001
sh_flags = 0x00000003
sh_addr = 0x832AB820
sh_offset = 0x03299880
sh_size = 0x00000230
sh_link = 0x00000000
sh_info = 0x00000000
sh_addralign = 0x00000004
sh_entsize = 0x00000000
cpu type : 0x00000013
uncomp_size : 0x03299C54
monstack : 0x8000549C

image_info.entry_point = 0x80012000
image_info.section_count = 0x00000004
image_info.monstack = 0x8000549C
image_info.monra = 0x00000000
image_info.param0 = 0x00000002
image_info.param1 = 0x00000000
image_info.param2 = 0x00000000
image_info.param3 = 0x00000000
Section Index = 0x00000000
source = 0x8003F1A4
dest = 0x80012000
bytes = 0x01F0ACEC
Section Index = 0x00000001
source = 0x81F49E90
dest = 0x81F1CCEC
bytes = 0x01054F9C
Section Index = 0x00000002
source = 0x82F9EE2C
dest = 0x82F71C88
bytes = 0x00339B98
Section Index = 0x00000003
source = 0x832D89C4
dest = 0x832AB820
bytes = 0x00000230

Restricted Rights Legend

Use, duplication, or disclosure by the Government is
subject to restrictions as set forth in subparagraph
(c) of the Commercial Computer Software - Restricted
Rights clause at FAR sec. 52.227-19 and subparagraph
(c) (1) (ii) of the Rights in Technical Data and Computer
Software clause at DFARS sec. 252.227-7013.

cisco Systems, Inc.
170 West Tasman Drive
San Jose, California 95134-1706

Cisco IOS Software, C181X Software (C181X-ADVIPSERVICESK9-M), Version 12.4(6)T,
RELEASE SOFTWARE (fc1)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2006 by Cisco Systems, Inc.
Compiled Wed 22-Feb-06 21:22 by ccai
Image text-base: 0x80012124, data-base: 0x81F1CCEC


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.

A summary of U.S. laws governing Cisco cryptographic products may be found at:
http://www.cisco.com/wwl/export/crypto/tool/stqrg.html

If you require further assistance please contact us by sending email to
export@cisco.com.

Installed image archive
Cisco 1812-J (MPC8500) processor (revision 0x400) with 118784K/12288K bytes of m
emory.
Processor board ID FHK1019226G, with hardware revision 0000

10 FastEthernet interfaces
1 ISDN Basic Rate interface
31360K bytes of ATA CompactFlash (Read/Write)


--- System Configuration Dialog ---

Would you like to enter the initial configuration dialog? [yes/no]: no


Press RETURN to get started!

Router>


やったー!


■しかし、flashの中のファイルはIOSのイメージしかなくなってしまったので、他のも移し変える必要があると思う。

Router>enalbe
Router#show flash
-#- --length-- -----date/time------ path
1 16882452 May 29 1905 09:26:48 +00:00 c181x-advipservicesk9-mz.124-6.T.bin

15048704 bytes available (16883712 bytes used)

Router#


■移し変えました。

Router#show flash
-#- --length-- -----date/time------ path
1 16882452 May 29 1905 09:26:48 +00:00 c181x-advipservicesk9-mz.124-6.T.bin
2 1007616 Jun 15 2006 12:06:16 +00:00 common.tar
3 511939 Jun 15 2006 12:06:42 +00:00 128MB.sdf
4 4052480 Jun 15 2006 12:07:10 +00:00 sdm.tar
5 2202 Jun 15 2006 12:09:38 +00:00 sdmconfig-1811-1812.cfg
6 812032 Jun 15 2006 12:09:58 +00:00 es.tar
7 1038 Jun 15 2006 12:10:18 +00:00 home.shtml
8 113152 Jun 15 2006 12:11:26 +00:00 home.tar

8536064 bytes available (23396352 bytes used)


■コンフィグレーションレジスタが0xA102になっているので、0x2102に書き換えてリブートします

Router#conf t
Router(config)#config-register 0x2102
Router(config)#^Z
Router#
Router#reload

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

*Jun 15 12:18:44.927: %SYS-5-RELOAD: Reload requested by console. Reload Reason:
Reload Command.


2006年5月10日

時刻を設定する

■NTPサーバーと同期するには

(config)# ntp server 10.0.1.4
(config)# clock timezone JST 9

などとする。

■時刻を確認するには?

cc-gw#show clock
.09:39:36.843 JST Mon Feb 10 2003

■LOGに時刻を残すには

#conf t
service timestamps log datetime localtime show-timezone

■syslogサーバーにlogを出力するには

#conf t
logging [syslogサーバーのIPアドレス]

コンフィギュレーションレジスタ

■ブートシーケンス
1.ルータがPOST(電源投入時自己診断)を実行する。
2.ブートストラップがIOSを探して(フラッシュメモリから)ロードする。
3.IOSがNVRAMからコンフィギュレーションファイルを探す。
  このファイルはstartup-configという
4.startup-configがある場合はそれをロードし、ない場合はセットアップコンフィギュレーションに入る。

続きを読む "コンフィギュレーションレジスタ " »

パスワードの復旧

1.ルーターをブートした後、ブレイクを実行してブートシーケンスを中断する
  ブート中に[Ctrl] + [Break]を押せばよい (TeraTermはAlt+B)

2514>
System Bootstrap, Version 5.2(8a), RELEASE SOFTWARE Copyright (c) 1986-1995 by cisco Systems 2500 processor with 2048 Kbytes of main memory

Abort at 0x10205AC (PC)
>


続きを読む "パスワードの復旧" »

パスワードの設定

■ユーザーモードのパスワードを設定する

G002253(config)#line ?
First Line number
aux Auxiliary line
console Primary terminal line
vty Virtual terminal

【コンソールの場合】

G002253(config)#line con 0
G002253(config-line)#password ************* G002253(config-line)#^Z

【telnetの場合】

G002253(config)#line vty 0
G002253(config-line)#password ************* G002253(config-line)#^Z


■イネーブルシークレットパスワードの設定

2514#conf t
Enter configuration commands, one per line. End with CNTL/Z.
2514(config)#enable secret ***********
2514(config)#^Z

※enable password コマンドでは設定ファイルに平文で保存されてしまうので注意

工場出荷時に設定を戻す

■コンフィギュレーションを消去する

# erase startup-config


IOSのバージョンの見方

■IOSのバージョンの見方

例:12.0(7a)とある場合
・12.0はメジャーリリースを指す
・7は保守レベル
・aは7においてバグフィックスが行われたことを示す
・保守レベルが7.2とかだったら暫定ビルド版
・初期配布リリースにはナンバーに大文字がつく

IOSのバックアップ

IOSのバックアップ

■TFTPサーバーの設定

1./tftpboot は 707 か 777 がよい。

2.あらかじめファイルを作っておく
  例:ios-11.2.bak

■バックアップ
0.iosのファイル名を確認する

yourname#show flash
-#- --length-- -----date/time------ path
1 16882452 May 10 2006 23:10:42 +00:00 c181x-advipservicesk9-mz.124-6.T.bin
2 2202 May 10 2006 23:11:54 +00:00 sdmconfig-1811-1812.cfg
3 4052480 May 10 2006 23:12:24 +00:00 sdm.tar
4 812032 May 10 2006 23:12:44 +00:00 es.tar
5 1007616 May 10 2006 23:13:06 +00:00 common.tar
6 1038 May 10 2006 23:13:22 +00:00 home.shtml
7 113152 May 10 2006 23:13:38 +00:00 home.tar
8 511939 May 10 2006 23:13:58 +00:00 128MB.sdf

8540160 bytes available (23396352 bytes used)

1.copy flash tftp コマンドを実行する

G002253#copy flash tftp

System flash directory:
File Length Name/status
1 4181132 c2500-i-l.112-7a.bin
[4181196 bytes used, 4207412 available, 8388608 total]

2.tftpサーバーのIPアドレスを指定する

Address or name of remote host [192.168.0.254]?

3.ソースファイルを指定する。

Source file name? c2500-i-l.112-7a.bin

4.サーバー側のファイル名を指定する

Destination file name [c2500-i-l.112-7a.bin]? ios-11.2.bak Verifying checksum for 'c2500-i-l.112-7a.bin' (file # 1)... OK

5.yes を選択する

Copy 'c2500-i-l.112-7a.bin' from Flash to server as 'ios-11.2.bak'? [yes/no]yes !!!!!!!!!!!!!!!!!!!!!!! (以下略)
Upload to server done
Flash copy took 00:00:49 [hh:mm:ss]

■IOSのリストアを行う

設定ファイルのバックアップ

■TFTPサーバーの設定

1./tftpboot は 707 か 777 がよい。

2.あらかじめファイルを作っておく
  例:G002253.bak

■設定ファイルのバックアップ

1.copy startup-config tftp または copy running-config tftp を実行する

#copy running-config tftp

2.TFTPサーバーの場所を指定する

Remote host []? 192.168.0.254

3.TFTPサーバーの方のファイル名を指定する

Name of configuration file to write [g002253-confg]? G002253.bak

4.yes でバックアップを始める

Write file G002253.bak on host 192.168.0.254? [confirm]y Building configuration...

Writing G002253.bak !! [OK]

■設定ファイルのリストア
#copy tftp running-config
#copy running-config startup-config