CCNA05-网络设备启动流程和Cisco设备文件管理与密码恢复详解


1,网络设备硬件组成

RAM:随机读取存储器,也就是我们所说的PC机的内存,一般的交换机是16M,32M,64M,路由器一般是128M,256M,512M,1024M,这里的网路设备的内存和我们普通笔记本的内存不一样,但是都会在掉电之后被清空

ROM:只读存储器,这里存放的是IOS的残像,这里的残像是实现设备的最基本的功能,一般用于故障恢复

Flash:闪存(可以扩充),这里就是网络设备的磁盘,这里放的就是我们真正的IOS(实现我们网络设备的几乎所有功能)

NVRAM:在掉电之后不会被清空,就相当于我们的PC机的磁盘。存放启动配置文件(startup configuration)和运行配置文件(running configuration),在NVRAM中还有一个很重要的东西,那就是配置寄存器(configuration Register),配置寄存器的作用就是告诉系统从哪里,以什么方式加载IOS。

Interface:接口

CPU:cisco的网络设备的CPU是cisco自己生产的



2,路由器的启动流程

1,加电自检(power-on self-test),检查硬件是否可以正常工作

2,加载和运行启动代码(bootstrap code),也就是读取配置寄存器(configuration register),也就是说系统要知道从哪里加载,以什么方式加载IOS

3,寻找IOS

4,解压缩和加载IOS,将IOS导到RAM中

5,寻找启动配置文件,如果没有找到启动配置文件,那么就会弹出初始化的对话框

6,加载启动配置文件配置文件,如果有配置文件,就会加载

7,运行配置好了的IOS系统



3,索引IOS镜像

145651409.jpg


在路由器的启动过程中,通过configuration register的值只能告诉硬件要到哪里,以什么方式去寻找IOS,我们知道一般的IOS是存放在flash中的,但是如果在flash中有很多IOS,这个时候应该如何去加载IOS呢?

当我们的flash中有很多IOS,例如路由器,交换机,安全,语音相关的IOS,会优先加载第一个IOS,如果第一个IOS加载失败,才会加载第二个IOS,第二个IOS加载失败,才会加载第三个IOS,依次进行下去,但是我们更本无法加载我们想要加载的IOS,为了解决这个问题,cisco提供了加载系统命令(boot system command),加载系统命令存放在启动配置文件中。加载系统命令告诉硬件具体的要加载哪个IOS

索引IOS的顺序

1,检查配置寄存器

2,解析启动系统命令,当启动配置文件中有启动系统命令,那么这一步是在系统启动流程的2.5步,而不是在第6步

3,如果没有启动系统命令,那么默认的是在flash中加载第一个IOS

4,如果flash的IOS加载失败,那么就会尝试使用TFTP协议从网络加载IOS

5,如果网路加载IOS失败,那么就会启动帮助加载镜像(boot helper image)

6,如果启动帮助加载也失败,那么就会加载IOS的残像(ROMMON:ROM monitor)



4,加载配置文件


153045225.jpg


运行配置文件在RAM中,启动配置文件在NVRAM中。

当我们通过路由器的Console口连接到路由器的时候,我们所做的所有的配置都是在RAM中进行的,当我们关闭路由器的时候,路由器不会保存我们的配置,除非是我们手动的保存运行配置文件到NVERAM中,如果在保存之前NVRAM中有启动配置文件,那么就会覆盖。当我们把路由器开启的时候,会将NVRAM中启动配置文件导到RAM中作为运行配置文件。

注意:在网络设备中,只有一个配置文件,不会有多个配置文件



5,配置寄存器(configuration register)

config-register16位,以416进制数表示
  格式:0xABCD
  赋值范围从0x00xFFFF

0x2102 :标准默认值
0x2142 :从FLASH中启动,但不使用NVRAM中的配置文件(用于口令恢复)
0x2101 :从Boot RAM中启动,应用于更新系统文件
0x2141 :从Boot RAM中启动,但不使用NVRAM中的配置文件
  其中C位的第三位为1时表示关闭Break键,反之表示打开Break键。
0x141:表示关闭Break键,不使用NVRAM中的配置文件,并且从系统默认的ROM
  的系统中启动。
0x0040:表示允许路由器读取NVRAM中的配置文件。

  表1config-register中各位的含义

Configuration Register

Routers use a16-bit software configuration register, with which you can set specific systemparameters. Settings for the software configuration register are written intononvolatile random access memory (NVRAM).

Some reasons for changing the software configurationregister settings are as follows:

To set and display the configuration registervalue

To force the system into the ROM monitor or bootROM

To select a boot source and default boot filename

To enable or disable the Break function

To control broadcast addresses

To set the console terminal baud rate

To load operating software from Flash memory

To enable booting from a Trivial File TransferProtocol (TFTP) server

To recover a lost password

To manually boot the system using the boot commandat the bootstrap program prompt.

To force the switch router to boot automaticallyfrom the system bootstrap software (boot image) or from its default systemimage in onboard Flash memory, and read any boot system commands that arestored in the configuration file in NVRAM

Boot Field

Config Register #

2

1

0

2

Bit Number

15 14 13 12

11 10 9 8

7 6 5 4

3 2 1 0

Binary

0 0 1  0

0 0 0 1

0 0 0 0

0 0 1 0

The lowest fourbits of the configuration register (bits 3, 2, 1, and 0) form the boot field.The order in which the switch/router looks for system bootstrap informationdepends on the boot field setting in the configuration register.

When the boot fieldis set to either 0 or 1 (0-0-0-0 or 0-0-0-1), the system ignores any bootinstructions in the system configuration file and the following occurs:

When the boot field is set to 1 (the factorydefault), you will boot from an IOS image stored in ROM.

When the boot field is set to 0, you must boot theoperating system manually by giving a boot command to the systembootstrap program, or ROM monitor.

Boot Command

You can enter the boot command only, or include additional bootinstructions with the command, such as the name of a file stored in Flashmemory or a file that you specify for booting from a network tftp server.

If you use the boot command without specifying a file or any otherboot instructions, the system boots from the default Flash image (the firstimage in onboard Flash memory). Otherwise, you can instruct the system toboot from a specific Flash image (using the boot system flash filename command), or boot from a network server bysending broadcast TFTP requests (using the boot system filename command), or by sending a direct TFTP request toa specific server (using the boot system filenameip address command).

You can also usethe boot command to boot images stored in the PersonalComputer Memory Card International Association (PCMCIA) Flash memory cards inthe route processor. If you set the boot field to any bit pattern otherthan 0 or 1, the system uses the resulting number to form a filename forbooting over the network. The system uses the filename to invoke thesystem image by booting over the net. However, if the configuration filecontains any boot instructions, the system uses those boot instructions insteadof the filename it computed from the configuration register settings.

You must set theboot field for the boot functions you require. For more detailedinformation on the software configuration register features, refer to thefollowing sections.

Changing theSoftware Configuration Register

Settings for thesoftware configuration register are written into NVRAM. The factorydefault value for Cisco router is 0x2102.

You can change thedefault configuration register setting with the enabled config-mode command config-register. Use a hexadecimal number as the argumentto this command. For example, the command

Router(config)# config-register    0x2100

configures therouter to boot to ROM monitor mode.

A Summary of Boot Tasks and Their Register Values

To change the bootfield and leave all the other bits set to their default values, follow theseguidelines:

To enter the ROM monitor (primarily a programmer'senvironment), set the configuration register value to 0x2100. This valuesets the boot field bits to 0-0-0-0.

From the ROM monitor, boot the operating systemmanually by issuing the bootcommand at the ROM monitor prompt.

To boot the system automatically from ROM, set theconfiguration register to 0x2101. This value sets the boot field bits to0-0-0-1.

To configure the system to use the boot systemcommands in NVRAM, set the configuration register to any value from 0x2102 to0x210F. These values setthe boot field bits to 0-0-1-0 through 1-1-1-1.

Software Configuration Register

Bit Number

Hexadecimal

Meaning

00 to 03

0x0000 to 0x000F

Boot field 启动位

06

0x0040

Causes system software to ignore NVRAM contents

使得系统软件忽略NVRAM中的内容

07

0x0080

OEM bit enabled OEM位开启

08

0x0100

Break disabled Break键关闭

09

0x0200

Use secondary bootstrap

10

0x0400

IP broadcast with all zeros IP广播到所有域

11 to 12

0x0800 to 0x1000

Console line speed (default is 9600 baud) Console口速率

13

0x2000

Boot default Flash software if network boot fails

如果网络启动失败,默认从ROM中启动

14

0x4000

IP broadcasts do not have network numbers

不包含网络号的IP广播

15

0x8000

Enable diagnostic messages and ignore NVRAM contents

启动诊断信息同时忽略NVRAM内容


Configuration Register Boot Field

Boot Field

Meaning

Used For:

00

ROM monitor mode

To boot to ROM monitor mode, set the configuration register to 2100. You must then manually boot the router with the b command. The router will show a rommon> prompt.

01

Boot image from ROM

To boot an IOS image stored in ROM, set the configuration register to 2101. The router will show the router(boot)> prompt.

02 to 0F

Specifies a default boot filename

Any value from 2102 to 210F tells the router to use the boot commands specified in NVRAM.


Understanding the Boot Field Commands

The lowest fourbits of the software configuration register (bits 3, 2, 1, and 0) form the bootfield. The boot field specifies a number in binary form which you have toconvert to Hexadecimal to use in the configuration register. If you setthe boot field value to 0, you must boot the operating system manuallyby entering the boot command at thebootstrap prompt ( either >or for newer platforms rommon> ).

Definitions of the Boot Command Options

Command

Function

boot

Boots the default system software from Flash memory.

boot flash [filename]

Boots the first file in onboard Flash memory. The optional filename argument is the name of the system image file to boot from onboard Flash memory.

bootfilename [ip address]

Boots from server host using TFTP. IP address of the TFTP server on which the system image resides. If omitted, this value defaults to the IP broadcast address of 255.255.255.255

Changing RegisterSettings While Running System Software

To change theconfiguration register while running the system software, follow these steps:

Step 1 At the privileged EXEC prompt (Router#), enterthe configureterminal command to enterglobal configuration mode.

Router#configure terminal

Router(config)#

Step 2 Set the contents of the configuration register byentering the config-register valueconfiguration command, where value is a hexadecimal number preceded by 0x as in the following example:

Router(config)# config-register0x2142

Step 3 Press Ctrl-Z to exit Global Configurationmode.

Step 4 Display the current configuration register value,which will be used at the next system reload, by entering the show version command.

The value isdisplayed on the last line of the screen display, as in the following example:

Configuration register is 0x2102(will be 0x2142 at next reload)

Step 5 Restart the router.

Changes to theconfiguration register take effect only when the system reloads.

Router# reload

Proceed with reload? [confirm]

%SYS-5-RELOAD: Reload Requested

启动位
00
启动后停留在bootstrap状态
01
中启动
02-F
指定默认的启动文件系统启动

Console口速率设定表



6,Cisco设备文件管理与密码恢复

http://www.qingsword.com/qing/707.html#ciscomgr-1

本文出自 “好好活着” 博客,转载请与作者联系!

你可能感兴趣的:(CCNA05-网络设备启动流程和Cisco设备文件管理与密码恢复详解)