Cisco路由器配置手册

来源:百度文库 编辑:神马文学网 时间:2024/04/28 04:27:23
 
  • Cisco路由器配置手册

2008-09-25 13:32:51 标签:Cisco 路由器配置 第 一 章 预 备 知 识
一、 设 置 方 式

---- 一 般 来 说, 可 以 用5 种 方 式 来 设 置 路 由 器:
Console 口 接 终 端 或 运 行 终 端 仿 真 软 件 的 微 机;
AUX 口 接MODEM, 通 过 电 话 线 与 远 方 的 终 端 或 运 行 终 端 仿 真 软 件 的 微 机 相 连; 通 过Ethernet 上 的TFTP 服 务 器; 通 过Ethernet 上 的TELNET 程 序; 通 过Ethernet 上 的SNMP 网 管 工 作 站。
但 路 由 器 的 第 一 次 设 置 必 须 通 过 第 一 种 方 式 进 行; 这 时 终 端 的 硬 件 设 置 为 波 特 率:9600, 数 据 位:8, 停 止 位:1, 无 校 验。
二、 命 令 状 态
router >
路 由 器 处 于 用 户 命 令 状 态, 这 时 用 户 可 以 看 路 由 器 的 连 接 状 态, 访 问 其 它 网 络 和 主 机, 但 不 能 看 到 和 更 改 路 由 器 的 设 置 内 容。
router#
路 由 器 处 于 特 权 命 令 状 态, 这 时 不 但 可 以 执 行 所 有 的 用 户 命 令, 还 可 以 看 到 和 更 改 路 由 器 的 设 置 内 容。
router(config)#
路 由 器 处 于 全 局 设 置 状 态, 这 时 可 以 设 置 路 由 器 的 全 局 参 数。
router(config-if)#; router (config-line)#; router(config-router)# … …
路 由 器 处 于 局 部 设 置 状 态, 这 时 可 以 设 置 路 由 器 某 个 局 部 的 参 数。
只 有 >
路 由 器 处 于RXBOOT 状 态, 在 开 机 后60 秒 内 按ctrl-break 可 进 入 此 状 态, 这 时 路 由 器 不 能 完 成 正 常 的 功 能, 只 能 进 行 软 件 升 级 和 手 工 引 导。
设 置 对 话 状 态
这 是 一 台 新 路 由 器 开 机 时 自 动 进 入 的 状 态, 在 特 权 命 令 状 态 使 用SETUP 命 令 也 可 进 入 此 状 态。 这 时 可 通 过 对 话 方 式 对 路 由 器 进 行 设 置。
三、 设 置 对 话 过 程
利 用 设 置 对 话 过 程 可 以 避 免 手 工 输 入 命 令 的 烦 琐, 但 它 还 不 能 完 全 代 替 手 工 设 置, 一 些 特 殊 的 设 置 还 必 须 通 过 手 工 输 入 的 方 式 完 成。
进 入 设 置 对 话 过 程 后, 路 由 器 首 先 会 显 示 一 些 提 示 信 息:
---System Configuration Dialog---
At any point you may enter a question mark '?' for help.
Use ctrl-c to abort configuration dialog at any prompt.
Default settings are in square brackets '[]'.
这 是 告 诉 你 在 设 置 对 话 过 程 中 的 任 何 地 方 都 可 以 键 入“ ?” 得 到 系 统 的 帮 助, 按ctrl-c 可 以 退 出 设 置 过 程, 缺 省 设 置 将 显 示 在'[]' 中。 然 后 路 由 器 会 问 是 否 进 入 设 置 对 话:
Would you like to enter the initial configuration dialog?[yes]:
如 果 按y 或 回 车, 路 由 器 就 会 进 入 设 置 对 话 过 程。 首 先 你 可 以 看 到 各 端 口 当 前 的 状 况:
First, would you like to see the current interface summary?[yes]:
Any interface listed with OK? Value "NO" does not have a valid configuration
Interface IP-Address OK? Nethod Status Protocol
Ethernet0 unassigned NO unset up up
Serial0 unassigned NO unset up up
…… …… … …… … …
然 后, 路 由 器 就 开 始 全 局 参 数 的 设 置:
Configuring global parameters:
设 置 路 由 器 名:
Enter host name [Router]:
设 置 进 入 特 权 状 态 的 密 文(secret), 此 密 文 在 设 置 以 后 不 会 以 明 文 方 式 显 示:
The enable secret is a one-way cryptographic secret used instead of the enable password when it exists.
-- Enter enable secret:cisco
设 置 进 入 特 权 状 态 的 密 码(password), 此 密 码 只 在 没 有 密 文 时 起 作 用, 并 且 在 设 置 以 后 会 以 明 文 方 式 显 示:
The enable password is used when there is no enable secret and when using older software and some boot images.
-- Enter enable password: pass
设 置 虚 拟 终 端 访 问 叶 的 密 码:
-- Enter virtual terminal password: cisco
询 问 是 否 要 设 置 路 由 器 支 持 的 各 种 网 络 协 议:
-- Configure SNMP Network Management?[yes]:
-- Configure DECnet?[no]:
-- Configure AppleTalk?[no]:
-- Configure IPX?[no]:
-- Configure IP?[yes]:
-- Configure IGRP routing?[yes]:
-- Configure RIP routing?[no]:
-- … …
如 果 配 置 的 是 拨 号 访 问 服 务 器, 系 统 还 会 设 置 异 步 口 的 参 数:
-- Configure Async lines?[yes]:
1) 设 置 线 路 的 最 高 速 度:
-- Async line speed[9600]:
2) 是 否 使 用 硬 件 流 控:
-- Configure for HW flow control?[yes]:
3) 是 否 设 置modem:
-- Configure for modems?[yes/no]:yes
4) 是 否 使 用 默 认 的modem 命 令:
-- Configure for default chat script?[yes]:
5) 是 否 设 置 异 步 口 的PPP 参 数:
-- configure for Dial-in IP SLIP/PPP access?[no]
6) 是 否 使 用 动 态IP 地 址:
-- Configure for Dynamic IP addresses?[yes]:
7) 是 否 使 用 缺 省IP 地 址:
-- Configure Default IP addresses?[no]: yes
8) 是 否 使 用TCP 头 压 缩:
-- Configure for TCP Header Compression?[yes]:
9) 是 否 在 异 步 口 上 使 用 路 由 表 更 新:
-- Configure for routing updates on async links?[no]:y
10) 是 否 设 置 异 步 口 上 的 其 它 协 议。
接 下 来, 系 统 会 一 个 接 口 连 行 参 数 的 设 置。
Configuring interface Ethernet0:
1) 是 否 使 用 此 接 口:
-- Is this interface in use?[yes]:
2) 是 否 设 置 此 接 口 的IP 参 数:
-- Configure IP on this interface?[yes]:
3) 设 置 接 口 的IP 地 址:
-- IP address for this interface:192.168.162.2
4) 设 置 接 口 的IP 子 网 掩 码:
-- Number of bits in subnet field[0]:
-- Class C network is 192.168.162.0, 0 subnet bits; maks is /24
在 设 置 完 所 有 接 口 的 参 数 后, 系 统 会 把 整 个 设 置 对 话 过 程 的 结 果 显 示 出 来:
The following configuration command script was created:
hostname Router
enable secret 5 $1$W5Oh$6J7tIgRMBOIKVXVG53Uh1
enable password pass
… … … …
请 注 意 在enable secret 后 面 显 示 的 是 乱 码, 而enable password 后 面 显 示 的 是 设 置 的 内 容。
显 示 结 束 后, 系 统 会 问 是 否 使 用 这 个 设 置;
Use this configuration?[yes/no]:yes
如 果 回 答yes, 系 统 就 会 把 设 置 的 结 果 存 入 路 由 器 的NVRAM 中, 然 后 结 束 设 置 对 话 过 程, 使 路 由 器 开 始 正 常 的 工 作。
四、 常 用 命 令
帮 助
在IOS 操 作 中, 无 论 任 何 状 态 和 位 置, 都 可 以 键 入“ ?” 得 到 系 统 的 帮 助。
改 变 命 令 状 态
进 入 特 权 命 令 状 态 enable
退 出 特 权 命 令 状 态 disable
进 入 设 置 对 话 状 态 setup
进 入 全 局 设 置 状 态 config terminal
退 出 全 局 设 置 状 态 end
进 入 端 口 设 置 状 态 interface type slot/number
进 入 子 端 口 设 置 状 态 interface type number. Subinter face
[point-to-point|multipoint]
进 入 线 路 设 置 状 态 line type slot/number
进 入 路 由 设 置 状 态 router protocol
退 出 局 部 设 置 状 态 exit

显 示 命 令
查 看 版 本 及 引 导 信 息 show version
查 看 运 行 设 置 show running-config
查 看 开 机 设 置 show startup-config
显 示 端 口 信 息 show interface type slot/number
显 示 路 由 信 息 show ip router

拷 贝 命 令
用 于IOS 及CONFIG 的 备 份 和 升 级
网 络 命 令
登 录 远 程 主 机 telnet hostname/IP address
网 络 侦 测 ping hostname/IP address
路 由 跟 踪 trace hostname/IP address

基 本 设 置 命 令
全 局 设 置 config terminal
设 置 访 问 用 户 密 码 username username password password
设 置 特 权 密 码 enable secret password
设 置 路 由 器 名 hostname name
设 置 静 态 路 由 ip route destination subnet-mask next-hop
启 动IPX 路 由 ipx routing
端 口 设 置 interface type slot/number
设 置IP 地 址 ip address address subnet-mask
设 置IPX 网 络 ipx network network
激 活 端 口 no shutdown
物 理 线 路 设 置 line type number
启 动 登 录 进 程 login [local|tacacs server]
设 置 登 录 密 码 password password 第 二 章 广 域 网 协 议 设 置
一、HDLC
HDLC 是CISCO 路 由 器 使 用 的 缺 省 协 议, 一 台 新 路 由 器 在HDLC 环 境 中 使 用 时 不 需 要 设 置 广 域 网 协 议。
有 关 命 令
端 口 设 置
设 置HDLC 封 装 encapsulation hdlc
设 置DCE 端 线 路 速 度

clockrate speed

举 例


Router1:
Interface Serial0
-- ip address 192.200.10.1 255.255.255.0
-- Clockrate 1000000
Router2:
-- interface Serial0
-- ip address 192.200.10.2 255.255.255.0
二、X.25
有 关 命 令
端 口 设 置
设 置X.25 封 装 encapsulation x25[dce]
设 置X.121 地 址 x25 address x.121-address
设 置 远 方 站 点 的 地 址 映 射 x25 map ip IP address x.121-address
举 例


Router1:
interface Serial0
-- encapsulation x25
-- ip address 192.200.10.1 255.255.255.0
-- x25 address 110101
-- x25 map ip 192.200.10.2 110102
Router2:
interface Serial0
-- encapsulation x25
-- ip address 192.200.10.2 255.255.255.0
-- x25 address 110102
-- x25 map ip 192.200.10.1 110101
三、Frame Relay
有 关 命 令
端 口 设 置
设 置FR 封 装 encapsulation frame-relay
设 置FR LMI 类 型
子 端 口 设 置 frame-relay lmi-type {ansi|cisco|q933a}
设 置FR DLCI 编 号 frame-relay interface-dlci dlci[broadcast]

举 例


Router1:
interface Serial0
-- encapsulation frame-relay
-- frame-relay lmi-type ansi
interface Serial0.16 point-to-point
-- ip address 192.200.10.1 255.255.255.0
-- frame-relay interfac dlci 16
Router2:
interfacte Serial0
-- encapsulation frame-relay
-- frame-relay lmi-type ansi
interface Serial0.17 point-to-point
-- ip address 192.200.10.2 255.255.255.0
-- frame-relay interface-dlci 17
四、PSTN
电 话 网 络(PSTN) 是 目 前 普 及 程 度 最 高、 成 本 最 低 的 公 用 通 讯 网 络, 它 在 网 络 互 连 中 也 有 广 泛 的 应 用。 电 话 网 络 的 应 用 一 般 可 分 为 两 种 类 型, 一 种 是 同 等 级 别 机 构 之 间 以 按 需 拨 号(DDR) 的 方 式 实 现 互 连, 一 种 是ISP 为 拨 号 上 网 的 用 户 提 供 的 服 务。 这 两 种 类 型 使 用 的 设 置 命 令 大 致 相 同, 但 在 设 置 思 想 上 又 有 重 要 的 差 别。
相 关 命 令
全 局 设 置:
设 置PPP 安 全 协 议 使 用 的 用 户 名 和 密 码 username username password password
设 置 路 由 器 与modem 的 接 口 指 令 chat-script script-name EXPECT SEND EXPECT SEND(etc.)
设 置 用 户 的IP 地 址 池 ip local pool {default|pool-name low-ip-address [high-ip-address]}
指 定 地 址 池 的 工 作 方 式 ip address-pool [dhcp-proxy-client|local]
指 定DHCP 服 务 器 ip dhcp-server [ip-address|name]
指 定TACACS 服 务 器 tacacs-server host hostname [single-connection] [port interger] [timeout integer] [key string]
异 步 口(async) 设 置:
设 置 封 装 形 式 为PPP encapsulation PPP
启 动 异 步 口 的 路 由 功 能 async default routing
设 置 异 步 口 的PPP 工 作 方 式 async mode {dedicated interactive}
启 动 按 需 拨 号 功 能 dialer in-band
设 置 用 户 的IP 地 址 peer default ip address {ip-address|dhcp|pool [pool-name]}
设 置IP 地 址 与Ethernet0 相 同 ip unnumbered Ehternet0
启 动TCP 头 压 缩 ip tcp header-compression passive
设 置 端 口 在 挂 断 前 的 等 待 时 间 dialer idle-timeout seconds
设 置IP 地 址 与 电 话 号 码 的 映 射 dialer map ip next-hop-address dialer-string
设 置PPP 安 全 协 议 ppp authentication protocol
line 拨 号 线 设 置:
指 定 特 定 情 况 下 路 由 器 使 用 的chat-script script {dialer|reset} script-name
设 置modem 的 工 作 方 式 modem {inout|dialin}
自 动 配 置modem 类 型 modem autoconfig discovery
设 置 拨 号 线 的 通 讯 速 率 speed speed
设 置 通 讯 线 路 的 流 控 方 式 flowcontrol hardware
连 通 后 自 动 执 行 命 令 autocommand command

DDR 实 例


北 京:
-- username guangzhou password Legend
-- (password 必 须 与 广 州 的 路 由 器 设 置 的password 一 样)
-- chat-script rstmdm"""AT&FS0=1&B1&C1&D2&H1&K1&M4&R2"OK
-- chat-script cisco-dial"""AT"TIMEOUT 30 OK" ATDT\T" TIMEOUT 30 CONNECT \c
-- interface async1
---- encapsulation ppp
---- async default routing
---- async mode dedicated
---- dialer in-band
---- ip unnumbered Ethernet0
---- ip tcp header-compression passive
---- dialer idle-timeout 300
---- dialer map ip 20.1.1.1 name Guangzhou 02088888888
---- ppp authentication chap
-- line aux 0
---- script dialer cisco-dial
---- script reset rstmdm
---- modem inout
---- modem autoconfig discovery
---- transport input all
---- rxspeed 38400
---- txspeed 38400
---- stopbits 1
---- flowcontrol hardware
-- line vty 0 4
---- password telnet
---- login
Access Server 实 例


Router:
hostname Router
enable secret 5 $ 1$EFqU$tYLJLrynNUKzE4bx6fmH//
chat-script cisco-default ABORT ERROR "" "AT Z"OK "ATDT \T"TIMEOUT 30 \c CONNE
interface Ethernet0
--ip address 10.111.4.20 255.255.252.0
interface Async1
--ip unnumbered Ethernet0
cencapsulation ppp
--keepalive 10
--async mode interactive
--peer default ip address pool Cisco 2511-Group-142
--ppp authentication pap
ip local pool Cisco2511-Group-142 10.111.4.21 10.111.4.36
tacacs-server host 10.111.4.2
line 1
--script dialer cisco-default
--login authentication tacacs
--modem InOut
--modem autoconfigure discovery
--flowcontrol hardware
五、ISDN MPPP
相 关 命 令
全 局 设 置:
设 置ISDN 交 换 类 型 isdn switch-type basic-nil
接 口 设 置
设 备PPP 封 装 encapsulation ppp
启 动PPP 多 连 接 ppp multilink
设 置 启 动 另 一 个B 通 道 的 阈 值 dialer load-threshold load

举 例:

Router1:
isdn switch-type basic-nil
interface Serial0
-- ip address 192.200.10.1 255.255.255.0
-- encapsulation ppp
-- dialer map ip 192.200.10.2 54321
-- dialer load-threshold 80
-- ppp multilink 第 三 章 路 由 协 议 设 置
一、RIP 协 议
有 关 命 令
全 局 设 置
指 定 使 用RIP 协 议 router rip
路 由 设 置
指 定 与 该 路 由 器 相 连 的 网 络 network network
指 定 与 该 路 由 器 相 邻 的 节 点 地 址 neighbor ip-address

举 例


Router1:
router rip
--network 192.200.10.0
--network 192.20.10.0
--neihbor 192.200.10.2
二、IGRP 协 议
有 关 命 令
全 局 设 置
指 定 使 用IGRP 协 议 router igrp
autonomous-system
路 由 设 置
指 定 与 该 路 由 器 相 连 的 网 络 network network

举 例


Router1:
-- router igrp 200
-- network 192.200.10.0
-- network 192.20.10.0
三、OSPF 协 议
有 关 命 令
全 局 设 置
指 定 使 用OSPF 协 议 router ospf process-id
路 由 设 置
指 定 与 该 路 由 器 相 连 的 网 络 network
address wildcard-mask area area-id
指 定 与 该 路 由 器 相 邻 的 节 点 地 址 neighbor ip-address

举 例


Router1:
-- router ospf 200
-- network 192.200.10.0.0.0.0.255 area1
-- network 192.200.20.0.0.0.0.255 area2
-- netghbor 192.200.10.2
-- neighbor 192.200.20.2
四、IPX 协 议 设 置
IPX 协 议 与IP 协 议 是 两 种 不 同 的 网 络 层 协 议, 它 们 的 路 由 协 议 也 不 一 样,IPX 的 路 由 协 议 不 象IP 的 路 由 协 议 那 样 丰 富, 所 以 设 置 起 来 比 较 简 单。 但IPX 协 议 在 以 太 网 上 运 行 时 必 须 指 定 封 装 形 式。
有 关 命 令
全 局 设 置
启 动IPX 路 由 ipx routing
端 口 设 置
设 置IPX 网 络 及 以 太 网 封 装 形 式 ipx network network [encapsulation encapsulation-type]

举 例


Router1:
-- ipx routing
-- interface ethernet0
-- ipx network 1a encapsulation sap
-- interface serial0
-- ipx network 3a00 第 四 章 服 务 质 量 及 访 问 控 制
一、 协 议 优 先 级 设 置
有 关 命 令
全 局 设 置
设 置 优 先 级 表 项 目 priority-list list-number protocol protocol {high|nedium|normal|low} queue-keyword keyword-value
端 口 设 置
使 用 指 定 的 优 先 级 表 priority-group list-number

举 例


Router1:
-- priority-list 1 ip high tcp telnet
-- priority-list 1 ip low tcp ftp
-- priority-list 1 default normal
internface serial 0
-- priority-group 1
二、 队 列 定 制
有 关 命 令
全 局 设 置
设 置 队 列 表 中 包 含 协 议 queue-list list-number protocol protocol-name queue-number queue-keyword keyword-value
设 置 队 列 表 中 队 列 的 大 小 queue-list list-number queue queue-number byte-count byte-count-number
端 口 设 置
使 用 指 定 的 队 列 表 custom-queue-list list

举 例

Router1:
-- queue-list 1 protocol ip 0 tcp telnet
-- queue-list 1 protocol ip 1 tcp http
-- queue-list 1 protocol ip 2 tcp ftp
-- queue-list 1 queue 0 byte-count 300
-- queue-list 1 queue 1 byte-count 200
-- queue-list 1 queue 2 byte-count 100
Interfact serial 0
-- Custom-queu-list 1
三、 访 问 控 制
有 关 命 令
全 局 设 置
设 置 访 问 表 项 目 access-list list {permit|deny} address mask
设 置 队 列 表 中 队 列 的 大 小 queue-list list-number queue queue-number byte-count byte-count number
端 口 设 置
使 用 指 定 的 访 问 表 ip access-group list {in|out}

举 例

Router1:
-- access-list 1 deny 192.1.3.0.0.0.0.255
-- access-list permit any
interface serial 0
-- ip access-group 1 in