第11讲 管理Cisco互联网络

Post on 24-May-2015

1.546 views 3 download

Transcript of 第11讲 管理Cisco互联网络

第 11 讲 管理 Cisco互联网络

www.cisco.com

本章目标本章目标

通过本章的学习,您应该掌握以下内容 :

• 清楚配置文件和 IOS 映象文件被加载的位置和过程

• 获取直接相邻设备的信息• 获取远程设备的信息

www.cisco.com

路由器加电 / 启动顺序路由器加电 / 启动顺序

• 加电自检 (POST)

• 加载并运行启动引导微代码• 寻找 IOS 映象文件• 加载 IOS 映象文件• 寻找配置文件• 加载配置文件• 正常运行

www.cisco.com

路由器内部组件路由器内部组件

RAM 配置寄存器

ROM

Flash

NVRAM

端口

www.cisco.com

ROM 功能ROM 功能

ROM

存放完成基本功能的微代码

Bootstrap

Mini IOSROM

monitor

POST

show version

控制台

www.cisco.com

确认当前的配置寄存器值确认当前的配置寄存器值wg_ro_a#show versionCisco Internetwork Operating System Software IOS (tm) 2500 Software (C2500-JS-L), Version 12.0(3), RELEASE SOFTWARE (fc1)Copyright (c) 1986-1999 by cisco Systems, Inc.Compiled Mon 08-Feb-99 18:18 by phanguyeImage text-base: 0x03050C84, data-base: 0x00001000

ROM: System Bootstrap, Version 11.0(10c), SOFTWAREBOOTFLASH: 3000 Bootstrap Software (IGS-BOOT-R), Version 11.0(10c), RELEASE SOFTWARE (fc1)

wg_ro_a uptime is 20 minutesSystem restarted by reloadSystem image file is "flash:c2500-js-l_120-3.bin"

--More--

Configuration register is 0x2102

用命令 show version 所显示的配置寄存器值

www.cisco.com

设定配置寄存器的值设定配置寄存器的值

• 配置寄存器的 3, 2, 1 和 0 位是启动选项位

Router#configure terminalRouter(config)#config-register 0x2102[Ctrl-Z]Router#reload

www.cisco.com

设定配置寄存器的值设定配置寄存器的值

• 配置寄存器的 3, 2, 1 和 0 位是启动选项位

配置寄存器启动选项部分的值

0x0

含义

进入 ROM monitor 模式( 人工启动时用 b 命令 )

Router#configure terminalRouter(config)#config-register 0x2102[Ctrl-Z]Router#reload

www.cisco.com

设定配置寄存器的值设定配置寄存器的值

• 配置寄存器的 3, 2, 1 和 0 位是启动选项位

配置寄存器启动选项部分的值

0x0

0x1

含义

进入 ROM monitor 模式( 人工启动时用 b 命令 )

自动从 ROM 启动( 提供完整 IOS 的一个子集 )

Router#configure terminalRouter(config)#config-register 0x2102[Ctrl-Z]Router#reload

www.cisco.com

• 配置寄存器的 3, 2, 1 和 0 位是启动选项位

• 用命令 show version 来检查配置寄存器的值

设定配置寄存器的值设定配置寄存器的值

配置寄存器启动选项部分的值

0x0

0x2 to 0xF

0x1

含义

进入 ROM monitor 模式( 人工启动时用 b 命令 )Rommon>

检查 NVRAM 之 boot system 命令 ( 如果路由器配有 Flash 则缺省值为 0x2)

自动从 ROM 启动( 提供完整 IOS 的一个子集 )Router(boot)>

Router#configure terminalRouter(config)#config-register 0x2102[Ctrl-Z]Router#reload

www.cisco.com

寻找 IOS 映象文件寻找 IOS 映象文件

Flash

showversion

show startup-config

IOS搜索顺序 :1. 检查配置寄存器 2. 解析 NVRAM 中的配置文件3. 缺省是使用 Flash 中的第一个文件4. 尝试从网络启动5. RXBOOT

6. ROMMON

控制台

配置寄存器

NVRAM

www.cisco.com

从 Flash 加载 IOS 映象文件从 Flash 加载 IOS 映象文件

Flash

IOS

IOSshow flash

Flash 中的映象文件解压缩到 RAM 中

控制台

RAM

www.cisco.com

使用 show flash 命令使用 show flash 命令

wg_ro_a#sh flash

System flash directory:File Length Name/status 1 10084696 c2500-js-l_120-3.bin [10084760 bytes used, 6692456 available, 16777216 total]16384K bytes of processor board System flash (Read ONLY)

wg_ro_a#sh flash

System flash directory:File Length Name/status 1 10084696 c2500-js-l_120-3.bin [10084760 bytes used, 6692456 available, 16777216 total]16384K bytes of processor board System flash (Read ONLY)

www.cisco.com

加载配置文件加载配置文件

控制台

IOS

Setup utility

showstartup-config

showrunning-config

• 从 NVRAM 中加载并运行配置文件• 如果 NVRAM 中没有配置文件 , 进入 setup 模式

ConfigConfig

RAM NVRAM

www.cisco.com

使用 show running 和 show startup 命令

使用 show running 和 show startup 命令

wg_ro_c#show startup-configUsing 1359 out of 32762 bytes!version 12.0!

-- More --

wg_ro_c#show running-configBuilding configuration...

Current configuration:!version 12.0!

-- More --

存在 NVRAM 中存在 RAM 中

显示当前运行的和保存的配置情况

www.cisco.com

路由器启动流程图路由器启动流程图

Use IOS fromFlash

Attempt to get

IOS from network

Use IOS in ROM(RXBoot mode)

Check start-upconfig

Boot field =0

0x0

Boot field =1

0x1

Boot system

commands?

Config regbit 13=1

?

5 failures?

Valid IOS inFlash

?

Do whatthey say

RunROM

Monitor

START

Yes

Yes

No

No

Yes

No

No

Yes

Yes

No

NoYes Success

?

No

Yes

Use file fromNetwork

Load IOSValid config

?

Config regbit 6=1

?

Yes

No Yes

SETUPDIALOG

NORMAL START UPCOMPLETE

No

www.cisco.com

Cisco 文件系统与设备Cisco 文件系统与设备

RAM NVRAM

TFTP服务器

Flash

flash:

system: nvram:

tftp:

www.cisco.com

配置参数的来源配置参数的来源

ConfigConfig

RAM NVRAM

• NVRAM

copy running startup

copy startup running

www.cisco.com

配置参数的来源配置参数的来源

ConfigConfig

RAM NVRAM

• NVRAM

• Terminal

copy running startup

copy startup running

Console

www.cisco.com

ConfigConfig

Console

RAM NVRAM

• NVRAM

• Terminal

• TFTP 服务器

copy running startup

copy startup running

TFTP服务器

copy start tftp

copy tftp start

copy run tftp

copy tftp run

配置参数的来源配置参数的来源

www.cisco.com

配置参数的来源配置参数的来源

ConfigConfig

Console

RAM NVRAM

• NVRAM

• Terminal

• TFTP server

• 删除启动配置文件

copy running startup

copy startup running

TFTP服务器

Blank000000000000

erasestartcopy tftp run

copy tftp start

copy start tftpcopy run tftp

www.cisco.com

使用 copy run tftp 和 copy tftp run 命令

使用 copy run tftp 和 copy tftp run 命令

wg_ro_a#copy running-config tftp Address or name of remote host []? 10.1.1.1 Destination filename [running-config]? wgroa.cfg .!!1684 bytes copied in 13.300 secs (129 bytes/sec) wg_ro_a#copy tftp running-config Address or name of remote host []? 10.1.1.1 Source filename []? wgroa.cfg Destination filename [running-config]? Accessing tftp://10.1.1.1/wgroa.cfg... Loading wgroa.cfg from 10.1.1.1 (via Ethernet0): ![OK - 1684/3072 bytes]

1684 bytes copied in 17.692 secs (99 bytes/sec)

wg_ro_a#copy running-config tftp Address or name of remote host []? 10.1.1.1 Destination filename [running-config]? wgroa.cfg .!!1684 bytes copied in 13.300 secs (129 bytes/sec) wg_ro_a#copy tftp running-config Address or name of remote host []? 10.1.1.1 Source filename []? wgroa.cfg Destination filename [running-config]? Accessing tftp://10.1.1.1/wgroa.cfg... Loading wgroa.cfg from 10.1.1.1 (via Ethernet0): ![OK - 1684/3072 bytes]

1684 bytes copied in 17.692 secs (99 bytes/sec)

www.cisco.com

Cisco IOS 升级

www.cisco.com

管理 IOS 映象文件管理 IOS 映象文件

网络服务器

FLASHFLASH

路由器

c2500-js-l_120-3.bin

网络服务器

www.cisco.com

映象文件备份的准备映象文件备份的准备

• 确认可以访问到网络服务

路由器网络

服务器

www.cisco.com

映象文件备份的准备映象文件备份的准备

• 确认可以访问到网络服务• 确认服务器上有足够的空间

路由器网络

服务器

www.cisco.com

映象文件备份的准备映象文件备份的准备

• 确认可以访问到网络服务• 确认服务器上有足够的空间• 确认文件名

路由器

c2500-js-l_120-3.bin

网络服务器

www.cisco.com

映象文件备份的准备映象文件备份的准备

路由器

c2500-js-l_120-3.bin

网络服务器

• 确认可以访问到网络服务• 确认服务器上有足够的空间• 确认文件名• 需要时在服务器上创建文件

www.cisco.com

wg_ro_a#show flash

System flash directory:File Length Name/status 1 10084696 c2500-js-l_120-3.bin

[10084760 bytes used, 6692456 available, 16777216 total]16384K bytes of processor board System flash (Read ONLY)

确认存贮空间并解析文件名确认存贮空间并解析文件名

确认 Flash 中有足够空间来存放 IOS 映象文件

www.cisco.com

wg_ro_a#copy flash tftpSource filename []? c2500-js-l_120-3.binAddress or name of remote host []? 10.1.1.1Destination filename [c2500-js-l_120-3.bin]? !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<output omitted>10084696 bytes copied in 709.228 secs (14223 bytes/sec)wg_ro_a#

作映象文件的备份作映象文件的备份

在升级 IOS 前备份当前的映象文件

网络服务器

FLASHFLASH

copy flash tftp

www.cisco.com

wg_ro_a#copy tftp flashAddress or name of remote host [10.1.1.1]? Source filename []? c2500-js-l_120-3.binDestination filename [c2500-js-l_120-3.bin]? Accessing tftp://10.1.1.1/c2500-js-l_120-3.bin...Erase flash: before copying? [confirm]Erasing the flash filesystem will remove all files! Continue? [confirm]Erasing device... eeeee (output omitted) ...erasedErase of flash: completeLoading c2500-js-l_120-3.bin from 10.1.1.1 (via Ethernet0): !!!!!!!!!!!!!!!!!!!!(output omitted)[OK - 10084696/20168704 bytes]Verifying checksum... OK (0x9AA0)10084696 bytes copied in 309.108 secs (32636 bytes/sec)wg_ro_a#

从网络升级 IOS从网络升级 IOS

• 加载新的映象文件前对Flash作适当的文件删除• 注意关于映象文件已经存在的提示信息

网络服务器

FLASHFLASH

www.cisco.com

Cisco 密码恢复

www.cisco.com

查看寄存器值; Router#show version ROM: System Bootstrap, Version 5.2(8a), RELEASE SOFTWARE BOOTFLASH: 3000 Bootstrap Software (IGS-RXBOOT), Version 10.2(8a), RELEASE SOFTW ARE (fc1)

RouterA uptime is 11 minutes System restarted by power-on System image file is "flash:c2500-d-l_113-5.bin", booted via flash Bridging software. X.25 software, Version 3.0.0. 1 Ethernet/IEEE 802.3 interface(s) 2 Serial network interface(s) 32K bytes of non-volatile configuration memory. 8192K bytes of processor board System flash (Read ONLY) Configuration register is 0x2102 注意:三个常用的寄存器值, 0x2102 正常启动,调用 NVRAM 配置信息; 0x2142 跳过 NVRAM 启动路由器 ;0x2101 Read/Write ,可擦写模式。

www.cisco.com

启动路由器,进入 ROMMON模式 打开路由器,按下 ctrl + break键,进入监视模式 System Bootstrap, Version 5.2(5), RELEASE SOFTWARE

Copyright (c) 1986-1994 by cisco Systems

2500 processor with 16384 Kbytes of main memory

Abort at 0x10201A2 (PC)

>

www.cisco.com

在 ROMMON 模式下将寄存器值改成 0x2142

并且重新启动路由器 CISCO 2500 系列命令 : CISCO 2600 系列命令 :

>o/r 0x2142 rommon>confreg 0x2142

>i rommon>reset

www.cisco.com

进入路由器命令行配置模式 在全局配置模式下重新设置密码覆盖先前遗忘的密码   Router(config)#enable secret password

Router(config)#line console 0

Router(config)#password password

Router(config)#login

 

www.cisco.com

  修改配置寄存器的值  Router(config)#config-register 0x2102

Router(config)#copy run start

  重新启动路由器  正常使用路由器

www.cisco.com

CDP 协议Cisco Discovery Protocol

CDP 协议Cisco Discovery Protocol

• 是一个提供关于直接相连的交换机、路由器和其它 Cisco设备的综合信息的专有工具

• CDP 能够发现直接相邻的设备而不管这些设备所运行的是什么协议栈

• 物理介质必须能够支持 Subnetwork Access Protocol (SNAP)

上层地址

Cisco 专有的链路层协议

介质必须能够支持 SNAP

TCP/IP Novell IPX

CDP 能 发现并显示关于直接相连的 Cisco 设备的信息

ATM OthersLANs 帧中继

AppleTalk Others

www.cisco.com

CDP 运行在使用 10.3 或更新版 Cisco IOS 的路由器以及 Cisco 交换机和集线器上能获取的信息包括 :

• 设备名• 对应各协议的地址• 端口名• 角色特征• 平台

CDP

show cdp

CDP

CDP

用 CDP 发现直接相邻的设备用 CDP 发现直接相邻的设备

www.cisco.com

使用 CDP使用 CDP

交换机 B路由器 A 路由器 B交换机 A

10.3.3.2 10.3.3.1 10.1.1.110.1.1.2

10.2.2.1 10.2.2.2

S0S1

RouterA#sh cdp ? entry Information for specific neighbor entry interface CDP interface status and configuration neighbors CDP neighbor entries traffic CDP statistics <cr>RouterA(config)#no cdp run RouterA(config)#interface serial0 RouterA(config-if)#no cdp enable

www.cisco.com

交换机 A 同时也显示其 Mac 地址

使用 show cdp neighbor 命令使用 show cdp neighbor 命令

RouterA#sh cdp neighborsCapability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater

Device ID Local Intrfce Holdtme Capability Platform Port IDRouterB Ser 0 148 R 2522 Ser 1SwitchA0050BD855780 Eth 0 167 T S 1900 2

10.3.3.2 10.3.3.1 10.1.1.110.1.1.2

10.2.2.1 10.2.2.2

S0S1

交换机 B路由器 A 路由器 B交换机 A

www.cisco.com

使用 show cdp entry 命令使用 show cdp entry 命令

RouterA#sh cdp entry *-------------------------Device ID: RouterB Entry address(es): IP address: 10.1.1.2 Platform: cisco 2522, Capabilities: Router Interface: Serial0, Port ID (outgoing port): Serial1Holdtime : 168 sec

Version :Cisco Internetwork Operating System Software IOS (tm) 2500 Software (C2500-JS-L), Version 12.0(3), RELEASE SOFTWARE (fci)Copyright (c) 1986-1999 by cisco Systems, Inc.Compiled Mon 08-Feb-99 18:18 by phanguye

10.3.3.2 10.3.3.1 10.1.1.110.1.1.2

10.2.2.1 10.2.2.2

S0S1

交换机 B路由器 A 路由器 B交换机 A

www.cisco.com

其它 CDP 命令其它 CDP 命令

RouterA#sh cdp trafficCDP counters :

Packets output: 56, Input: 38Hdr syntax: 0, Chksum error: 0, Encaps failed: 3No memory: 0, Invalid packet: 0, Fragmented: 0

RouterA#sh cdp interface BRI0 is administratively down, line protocol is down Encapsulation HDLC Sending CDP packets every 60 seconds Holdtime is 180 seconds

10.3.3.2 10.3.3.1 10.1.1.110.1.1.2

10.2.2.1 10.2.2.2

S0S1

交换机 B路由器 A 路由器 B交换机 A

www.cisco.com

用 Telnet 连接到远端设备用 Telnet 连接到远端设备

远端设备

10.3.3.2 10.3.3.1 10.1.1.110.1.1.2

10.2.2.1 10.2.2.2

S0S1

RouterA#telnet 10.2.2.2 Trying 10.2.2.2 ... Open-------------------------------------------------Catalyst 1900 Management ConsoleCopyright (c) Cisco Systems, Inc. 1993-1998All rights reserved.Enterprise Edition SoftwareEthernet Address: 00-90-86-73-33-40PCA Number: 73-2239-06PCA Serial Number: FAA02359H8KModel Number: WS-C1924-ENSystem Serial Number: FAA0237X0FQ..SwitchB>

交换机 B路由器 A 路由器 B交换机 A

www.cisco.com

查看 Telnet 连接查看 Telnet 连接

10.3.3.2 10.3.3.1 10.1.1.110.1.1.2

10.2.2.1 10.2.2.2

S0S1

RouterA#sh sessionConn Host Address Byte Idle Conn Name 1 10.1.1.2 10.1.1.2 0 1 10.1.1.2* 2 10.3.3.2 10.3.3.2 0 0 10.3.3.2

RouterA#sh user Line User Host(s) Idle Location* 0 con 0 10.1.1.2 3 10.3.3.2 2 11 vty 0 idle 1 10.1.1.2

交换机 B路由器 A 路由器 B交换机 A

www.cisco.com

挂起一个 Telnet会话挂起一个 Telnet会话

10.3.3.2 10.3.3.1 10.1.1.110.1.1.2

10.2.2.1 10.2.2.2

S0S1

RouterB#<Ctrl-Shift-6>xRouterA#sh sessionConn Host Address Byte Idle Conn Name 1 10.1.1.2 10.1.1.2 0 1 10.1.1.2RouterA#resume 1RouterB#

交换机 B路由器 A 路由器 B交换机 A

www.cisco.com

RouterA#disconnect Closing connection to 10.3.3.2 [confirm]

RouterA#clear line 11[confirm] [OK]

关闭一个 Telnet会话关闭一个 Telnet会话

关闭由远端设备建立的会话

关闭由自己建立的当前会话

10.3.3.2 10.3.3.1 10.1.1.110.1.1.2

10.2.2.1 10.2.2.2

S0S1

交换机 B路由器 A 路由器 B交换机 A

www.cisco.com

使用 ping 和 trace 命令使用 ping 和 trace 命令

测试对远端设备的连接性和路径

Router##ping 10.1.1.10

Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 10.1.1.10, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/4 ms

Router#trace 10.1.1.10

Type escape sequence to abort.Tracing the route to 10.1.1.10

1 10.1.1.10 4 msec 4 msec 4 msecRouter#

www.cisco.com

通过本章的学习,您应该掌握以下内容 :

• 在一个设备上利用 CDP 获取与其直接相邻的设备信息

• 用 Telnet 来获取远端设备的信息• 清楚被加载 IOS 映象文件的位置和过程

本章总结本章总结

www.cisco.com

问题回顾问题回顾

1. 哪个 CDP 命令用来获取某个指定直接相邻设备的 信息 ?

2. 哪些键的组合可以挂起一个 Telnet会话 ?3. 运行的配置内容可以源自于哪三个地方 ?

4.哪个 show 命令列出了配置寄存器的值 ?