青蛙不是癞蛤蟆

CCNA Chapter 9

Chapter9 Managing a Cisco Internetwork
The Internal Components of a Cisco Router
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


如上,CISCO配置寄存器表示,采用OxXXXX表示,软件配置意义如下:


启动字段(00 到03):
1.设置成00:ROM monitor 模式,进入到这个模式,configuration register 的值设置成2100.然后要启动router 的话需要手动在命令行提示符rommon>下输入b
2.设置成01:从ROM 中的镜象启动,把configuration register 的值设置成2101,提示符为
router(boot)>
3.设置成02 到0F:定义默认启动文件名,在NVRAM 中查找
Checking the Current Configuration Register Value
使用show version 命令可以查看当前configuration register 的值,在输出的最下部分.这个命令将会显示硬件的配置信息,软件版本,配置文件信息,启动镜象等
Router#sh version
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-I-M), Version 12.1(8)T3,
RELEASE SOFTWARE (fc1)
[output cut]
Configuration register is 0x2102
Changing the Configuration Register
可以通过修改configuration register 的值来决定router 的启动和运行方式.在全局配置模式下使用config-register 的命令.修改值为0x101,注意输出内容,如下:
Router(config)#config-register 0x101
Router(config)#^Z
Router#sh ver
Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-I-M), Version 12.1(8)T3,
RELEASE SOFTWARE (fc1)
[output cut]
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)
[output cut]
PC = 0xfff0a530, 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 kaka
把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
Copyright (c) 1986-1996 by cisco Systems
2500 processor with 14336 Kbytes of main memory
Abort at 0x1098FEC (PC)
>o
Configuration register = 0x2102 at last boot
Bit# Configuration register option settings:
15 Diagnostic mode disabled
14 IP broadcasts do not have network numbers
13 Boot default ROM software if network boot fails
12-11 Console speed is 9600 baud
10 IP broadcasts with ones
08 Break disabled
07 OEM disabled
06 Ignore configuration disabled
03-00 Boot file is cisco2-2500 (or 'boot system' command)
>o/r 0x2142

接下来的步骤和2600 系列一样,如下:
Router#copy start run
Router#conf t
Router(config)#enable secret kaka
把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
Router#sh flash
System flash directory:
File Length Name/status
1 8121000 c2500-js-l.112-18.bin
[8121064 bytes used, 8656152 available, 16777216 total]
16384K bytes of processor board System flash (Read ONLY)
Router#
如上,router共有16M的空间,当前ios使用了8M,
_ c 2500 is the platform.
_ j indicates that the file is an enterprise image.
_ s indicates that the file contains extended capabilities.
_ l indicates that the file can be moved from flash memory if needed and is not compressed.
_ 11.2-18 is the revision number.
_ .bin indicates that the Cisco IOS is a binary executable file.
_ f indicates that the image runs from Flash memory.
_ m indicates that the image runs from RAM.
_ r indicates that the image runs from ROM.
_ l indicates that the image is relocatable.
_ z indicates that the image is zip compressed.
_ x indicates that the image is mzip compressed.
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 模式
Using Cisco Discovery Protocol(CDP)
Cisco Discovery Protocol是Cisco私有的一个协议,用来帮助网管员收集相邻设备的硬件和协议信息。
Getting CDP Timers and Holdtime Information
之前提到过CDP 的一些介绍,show cdp 命令提供2 个信息给你:
1.CDP timer:CDP 包传给每个活跃接口的时间间隔,默认是60 秒
2.CDP holdtime:某设备从相邻设备收到的包的保持时间,默认是180 秒
如下:

Router#sh cdp
Global CDP information:
Sending CDP packets every 60 seconds
Sending a holdtime value of 180 seconds
Router#
可以修改默认的时间,分别在全局配置模式下使用cdp timer 和cdp holdtime 命令,如下:
Router#conf t
Router(config)#cdp timer 90
Router(config)#cdp holdtime 240
在所有接口上关闭CDP,在全局配置模式下使用no cdp run 命令;关闭某个接口的CDP 使用no cdp enable 命令.再次打开分别使用cdp run 和ccdp enable 命令.如下:
Router(config)#no cdp run
Router(config)#int fa0/1
Router(config-if)#no cdp enable
Gathering Neighbor Information
使用show cdp neighbour 可以显示直接相连的设备的信息,如下:
Router#sh cdp nei
Capability Codes: R – Router, T – Trans Bridge,
B – Source Route Bridge, S – Switch, H – Host,
I – IGMP, r – Repeater
Device ID Local Interface Holdtime Capability Platform Port ID
1900Switch Eth 0 238 T S 1900 2
2500B Ser 0 138 R 2500 Ser 0
Router#
一些选项的解释如下:
1.Device ID:直接相连的设备的主机名
2.Local Interface:接收CDP 包的接口
3.Holdtime:某设备从相邻设备收到的包的保持时间,如果过了这个时间仍然没收到新的CDP包,就将被丢弃
4.Capability:见输出最顶部信息
5.Platform:Cisco 设备的类型
6.Port ID:相连设备的接受CDP 包信息的接口
要查看更为详细的CDP 信息可以使用show cdp neighbor detail 或show cdp entry *命令
Gathering Interface Traffic Information
使用show cdp traffic 命令显示接口CDP 包流量信息,如下:
Router#sh cdp traffic
CDP counters:
Packets output: 13, Input: 8
Hdr syntax: 0, Chksum error: 0, Encaps failed: 0
No memory: 0, Invalid packet: 0, Fragmented: 0
Router#

Gathering Port and Interface Information
使用show cdp interface 命令显示接口的CDP 状态信息
Using Telnet
在特权模式下使用telnet [IP 地址]的命令进行telnet,如下:
Router#telnet 172.16.10.2
Trying 172.16.10.2 … Open
Password required, but none set
[Connection to 172.16.10.2 closed by foreign host]
Router#
由上面提示可以看出,VTY 没有密码配置的话是不允许你telnet 的(除非你使用了no login 命令,但是安全性几乎为0).所以在telnet 前,记得先给目标设备的VTY 线路配置密码
Telnetting into Multiple Devices Simultaneously
当你telnet 到远程设备的时候,可以在任何情况下使用exit 命令来终止连接.但是假如你想保持这个连接,同时又对另外1 个设备进行telnet 的时候,使用Ctrl+Shift+6,再按下X 键,就可以回到本地console,再对另外1 设备进行telnet.如下:
2500#telnet 172.16.10.2
Trying 172.16.10.2 … Open
User Access Verification
Password:
2600>[Ctrl+Shift+6,X]
2500#telnet 192.168.0.32
(略)
Checking Telnet Connections
查看从本地到远程的连接会话,使用show sessions 命令,如下:
2500#sh sessions
Conn Host Address Byte Idle Conn Name
1 172.16.10.2 172.16.10.2 0 0 172.16.10.2
*2 192.168.0.32 192.168.0.32 0 0 192.168.0.32
2500#
注意*所在的会话代表你的最后1 个会话,可以直接敲2 下Enter 键回到*号会话,也可以输入前面的数字,再敲2 下Enter 键回到相应会话

Checking Telnet Users
使用show users 命令列举本地所有活动console 和VTY 端口,如下:
2500#sh users
Line User Host(s) Idle Location
* 0 con 0 172.16.10.2 00:07:52
192.168.0.32 00:07:18
注意上面输出的con 代表本地console,这个例子可以看到从本地console 连接了远程的2 个设备.接下来在我们远程设备上使用这个命令,如下:
2600>sh users
Line User Host(s) Idle Location
0 con 0 idle 9
*2 vty 0
这个输出内容可以看出console 是活动的,而且VTY 端口2 被使用
Closing Telnet Sessions
之前说过,要终止telnet 会话,在远程(被telnet)设备上使用exit 命令.但是要从本地设备终止会话的话,就需要在本地使用disconnect 命令,如下:

2500#disconnect ?
<1-2> The number of an active network connection
WORD The name of an active network connection
<cr>
2500#disconnect 1
Closing connection to 172.16.10.2 [confirm]
2500#
验证如下:
2600#sh users
Line User Host(s) Idle Location
*0 con 0 idle 0
1 aux 0 idle 0
2 vty 0 idle 172.16.10.1
清除连接,使用clear line 命令,并验证,如下:
2600#clear line 2
[confirm]
[OK]
2600#sh users
Line User Host(s) Idle Location
*0   con 0       idle 0
1    aux 0       idle 1
2600#
Resolving Hostnames
2 种解析主机名到IP 地址的办法:
1.在每个router 上建立主机表(host table)
2.建立DNS 服务器(Domain Name System server),这个类似动态主机表
Building a Host Table
主机表只提供包含其中的解析,建立主机表的命令是ip host [主机名] [TCP 端口号] [IP 地址],默认TCP 端口号为23.1 个主机可以对应最多8 个IP 地址.如下:
2500(config)#ip host 2501B 172.16.10.2
2500(config)#ip host 1900S 192.168.0.32
2500(config)#^Z
使用show hosts 命令验证新建的主机表,如下:
2500#sh hosts
Default domain is not set
Name/address lookup uses domain service
Name servers are 255.255.255.255
Host     Flags      Age   Type    Address(es)
2501B    (perm, OK)  0     IP     172.16.10.2
1900S    (perm, OK)  0     IP     192.168.0.32
2500#
注意Flags 选项的perm,代表是手动输入的,如果这项是temp 的话,表明是由DNS 解析的
Using DNS to Resolve Names
假如你在CLI 下输入了1 个Cisco 设备不能识别的命令,它会默认通过DNS 来进行解析(它认为是主机名).这个不好的地方是要花费额外的时间等待DNS 解析完.可以在全局配置模式下使用no ip domain-lookup 命令关闭它
假如你在你的网络里有DNS 服务器,可以使用1 些命令使DNS 解析开始工作:
1.第一条命令是:ip domain-lookup,这个命令默认是打开了的.如果你之前使用了no ipdomain-lookup 的话,就要用这条命令打开它
2.第二条命令是:ip name-server.设置DNS 服务器的IP 地址,可以使1 个IP 地址对应多达6 个服务器
3.最后条命令是:ip domain-name.虽然这个命令是可选的,但是最好还是设置1 下
实例如下:
2500(config)#ip domain-lookup
2500(config)#ip name-server 192.168.0.23
2500(config)#ip domain-name kaka.com
2500(config)#^Z
2500#
可以使用ping 命令来严正下,如下:
2500#ping 1900S
Translating “1900S”…domain server (192.168.0.23) [OK]
(略)
使用show hosts 命令验证下,如下:
2500#sh hosts
Default domain is kaka.com
Name/address lookup uses domain service
Name servers are 192.168.023
Host               Flags    Age Type   Address(es)
2501B          (perm, OK)    0   IP    172.16.10.2
1900S.kaka.com (temp, OK)    0   IP    192.168.0.32
2500#
Checking Network Connectivity
ping 和traceroute 命令是检查网络连接是否完好的利器
2500#ping ?
WORD Ping destination address or hostname
apollo Apollo echo
appletalk Appletalk echo
clns CLNS echo
decnet DECnet echo
ip IP echo
ipx Novell/IPX echo
srb srb echo
tag Tag encapsulated IP echo
vines Vines echo
xns XNS echo
<cr>
2500#traceroute ?
WORD Trace route to destination address or
hostname
appletalk AppleTalk Trace
clns ISO CLNS Trace
ip IP Trace
ipx IPX Trace
oldvines Vines Trace (Cisco)
vines Vines Trace (Banyan)
<cr>

posted on 2006-08-17 09:35 学习资料库 阅读(601) 评论(0)  编辑 收藏 引用 网摘 所属分类: Lan Switch


只有注册用户登录后才能发表评论。
网站导航: