Cisco IOS 的一些硬手段

Cisco Router 的一些组件 :
bootstrap: 存储在 ROM 中的微码 (microcode) , 用来在初始化的时候启动 router, 然后加载 IOS
POST: 存储在 ROM 中的微码中 , 用来检查硬件基本配置是否正常 , 然后决定哪些接口可用
ROM monitor: 存储在 ROM 中的微码中 , 作用是测试和排疑等
Mini-IOS:Cisco 叫它 RXBOOT bootloader, 它是存储在 ROM 中的 ,IOS 的简化版本 , 用来把 IOS 加载到闪存中
RAM(random-access memory): 用来保存数据包缓存 ,ARP 缓存 , 路由表 , running-config 配置文件 . 某些 router ,IOS 可以从 RAM 中运行
ROM(read-only memory): 用来启动和维持 router 正常化
Flash memory( 闪存 ): 用来存放 IOS, router 重新启动的时候闪存是不会被擦除的 , Intel 创造的 EEPROM
NVRAM(nonvolatile RAM): 存储 startup-config 配置文件 , router 重新启动的后 , 这些文件是不会被擦除的
configuration register: 用来控制 router 如何启动 , 这个值可以使用 show version 来查看 , 一般为 0x2102(16 进制 ), 含义是告诉 router 从闪存里加载 IOS 和从 NVRAM 里加载配置文件
The Router Boot Sequence
启动序列用来测试硬件和加载所必需的软件 , 包括以下几个步骤 :
1. 先进行 POST, 测试硬件
2.bootstrap 查找和加载 IOS
3.IOS NVRAM 中查找有效的 startup-comfig 配置文件
4. 如果在 NVRAM 里查找到了这个配置文件 ,router 就可操作 ; 如果文件不存在 ,router 进到 setup 模式
Managing Configuration Registers
Cisco router 1 个存储在 NVRAM 中的 ,16 位长的 configuration register. 默认这个值 0x2102 设置成从闪存中加载 IOS 和从 NVRAM 中查找启动配置文件
Understanding the Configuration Register Bits
一些常见的位的含义 :
1. 0 3 : 启动字段
2. 6 : 忽略 NVRAM 内容
3. 8 : 禁用 BREAK
启动字段 (00 03):
1. 设置成 00:ROM monitor 模式 , 进入到这个模式 ,configuration register 的值设置成 2100. 然后要启动 router 的话需要手动在命令行提示符 rommon> 下输入 b( 感觉有点类似 Solaris OpenBoot 哈哈 )
2. 设置成 01: ROM 中的镜象启动 , configuration register 的值设置成 2101, 提示符为 router(boot)>
3. 设置成 02 0F : 定义默认启动文件名 , NVRAM 中查找
Checking the Current Configuration Register Value
使用 show version 命令可以查看当前 configuration register 的值 , 在输出的最下部分 . 这个命令将会显示硬件的配置信息 , 软件版本 , 配置文件信息 , 启动镜象等
Changing the Configuration Register
可以通过修改 configuration register 的值来决定 router 的启动和运行方式 . 在全局配置模式下使用 config-register 的命令 . 修改值为 0x101, 注意输出内容 , 如下 :
Router(config)#config-register 0x101
Router(config)#^Z
Router#sh ver
( )
Configuration register is 0x2102 (will be 0x0101 at next reload)
注意修改后的值和当前值 , 修改后的值只在重新启动后生效
Recovering Passwords
如果你把密码忘记了怎么办 ? 之前提到过 , 6 可以忽略掉 NVRAM 里的储存的启动配置文件的内容 , 默认是 0x2102, 所以我们把值修改成 0x2142, 就可以达到忽略 NVRAM 这个效果 . 下面是密码恢复的主要几个步骤 :
1. 在启动 router 的时候使用 BREAK 中断启动
2. configuration register 的值设置成 0x2142
3. 重新启动
4. 进入特权模式
5. startup-config 文件复制到 running-config 文件中
6. 修改密码
7. configuration register 的值还原为 0x2102
8. 保存配置
9. 重新启动
具体的修改 ,2500 系列和 2600 系列有一点不一样 , 我们先来看 2600 系列的修改实例 , 使用 Ctrl+BREAK 中断启动 . 注意提示 monitor: command boot aborted due to user interrupt.
如下 :
System Bootstrap, Version 11.3(2)XA4, RELEASE SOFTWARE (fc1)
( )
PC = 0xfff 0a 530, Vector = 0x500, SP = 0x80004374
monitor: command “boot” aborted due to user interrupt
rommon 1 >confreg 0x2142
You must reset or power cycle for new config to take effect
提示重新启动 , 如下 :
rommon 1>reset
重新启动后 , 进入特权模式 , startup-config 复制到 running-config , 并修改密码 . 如下 :
Router#copy start run
Router#conf t
Router(config)#enable secret noko
configuration register 的值还原 , 并保存 , 如下 :
Router(config)#config-register 0x2102
Router(config)#^Z
Router#copy run start
2500 系列下的修改 , 在启动时输入 o 中断启动 , 再用 o/r 修改 configuration register 的值 , 如下 :
System Bootstrap, Version 11.0( 10c ), SOFTWARE
( )
Abort at 0x1098FEC (PC)
>o
( )
>0x2142
重新启动 , 输入 I, 如下 :
>I
接下来的步骤和 2600 系列一样 , 如下 :
Router#copy start run
Router#conf t
Router(config)#enable secret noko
configuration register 的值还原 , 并保存 , 如下 :
Router(config)#config-register 0x2102
Router(config)#^Z
Router#copy run start
Backing Up and Restoring the Cisco IOS
IOS 备份到 TFTP 服务器前的准备工作 :
1. 确认你可以访问 TFTP 服务器
2. 确认 TFTP 服务器是否有足够空间来保存 IOS 文件
3. 确定名称和路径
Verifying Flash Memory
验证闪存信息 , 使用 show flash 命令 , 如下 :
Router#sh flash
System flash directory:
File Length Name/status
1 8121000 c 2500-js-l.112-18.bin
Backing Up the Cisco IOS
IOS 备份到 TFTP 服务器上 , 特权模式下使用 copy flash tftp 命令 , 记住备份之前最好对服务器 ping 下看是否是通的
Restoring or Upgrading the Cisco Router IOS
TFTP 恢复或者升级 IOS, 特权模式下使用 copy tftp flash 命令
Backing Up and Restore the Cisco Configuration
把配置文件备份到 TFTP 服务器 , 和把 IOS 备份到 TFTP 服务器的命令类似 ; 恢复也是如此 :
1.startup-config 文件的备份 :copy startup-config tftp
2.startup-config 文件的恢复 :copy tftp startup-config
3.running-config 文件的备份 :copy running-config tftp
4.running-config 文件的恢复 :copy tftp running-config
验证命令为 show running-config show startup-config
Erasing the Configuration
擦除启动配置文件 startup-config 文件 , 在特权模式下使用 erase startup-config 命令 , 擦除了以后 , 立即重新启动的话 ,router 将进到 setup 模式

你可能感兴趣的:(职场,休闲)