CISCO 路 由 器 产 品 配 置 手 册 第 一 章 路 由 器 配 置 基 础... 2 一 基 本 设 置 方 式... 2 二 命 令 状 态... 2 三 设 置 对 话 过 程... 3 四 常 用 命 令... 5 五 配 置 IP 寻 址... 6 六 配 置 静 态 路 由... 9 第 二 章 广 域 网 协 议 设 置... 11 一 HDLC... 11 二 PPP... 14 三 X.25... 15 四 Frame Relay... 19 五 ISDN... 22 六 PSTN... 29 第 三 章 路 由 协 议 设 置... 42 一 RIP 协 议... 42 二 IGRP 协 议... 43 三 OSPF 协 议... 43 四 重 新 分 配 路 由... 47 五 IPX 协 议 设 置... 49 第 四 章 服 务 质 量 及 访 问 控 制... 52 一 协 议 优 先 级 设 置... 52 二 队 列 定 制... 52 三 访 问 控 制... 53 第 五 章 虚 拟 局 域 网 (VLAN) 路 由... 54 一 虚 拟 局 域 网 (VLAN)... 54 二 交 换 机 间 链 路 (ISL) 协 议... 54 三 虚 拟 局 域 网 (VLAN) 路 由 实 例... 54 参 考 :... 61 一 Cisco 路 由 器 口 令 恢 复... 61 2 IP 地 址 分 配... 61 1
第 一 章 路 由 器 配 置 基 础 一 基 本 设 置 方 式 一 般 来 说, 可 以 用 5 种 方 式 来 设 置 路 由 器 : 1. Console 口 接 终 端 或 运 行 终 端 仿 真 软 件 的 微 机 ; 2. AUX 口 接 MODEM, 通 过 电 话 线 与 远 方 的 终 端 或 运 行 终 端 仿 真 软 件 的 微 机 相 连 ; 3. 通 过 Ethernet 上 的 TFTP 服 务 器 ; 4. 通 过 Ethernet 上 的 TELNET 程 序 ; 5. 通 过 Ethernet 上 的 SNMP 网 管 工 作 站 TFTP 服 务 器 Telnet SNMP 网 管 工 作 站 Console 终 端 / 终 端 仿 真 AUX 终 端 / 终 端 仿 真 但 路 由 器 的 第 一 次 设 置 必 须 通 过 第 一 种 方 式 进 行, 此 时 终 端 的 硬 件 设 置 如 下 : 波 特 率 :9600 数 据 位 :8 停 止 位 :1 奇 偶 校 验 : 无 二 命 令 状 态 1. router> 路 由 器 处 于 用 户 命 令 状 态, 这 时 用 户 可 以 看 路 由 器 的 连 接 状 态, 访 问 其 它 网 络 和 主 机, 但 不 能 看 到 和 更 改 路 由 器 的 设 置 内 容 2. router# 在 router> 提 示 符 下 键 入 enable, 路 由 器 进 入 特 权 命 令 状 态 router#, 这 时 不 但 可 以 执 行 所 有 的 用 户 命 令, 还 可 以 看 到 和 更 改 路 由 器 的 设 置 内 容 3. router(config)# 在 router# 提 示 符 下 键 入 configure terminal, 出 现 提 示 符 router(config)#, 此 时 路 由 器 处 于 全 局 设 置 状 态, 这 时 可 以 设 置 路 由 器 的 全 局 参 数 4. router(config-if)#; router(config-line)#; router(config-router)#; 2
路 由 器 处 于 局 部 设 置 状 态, 这 时 可 以 设 置 路 由 器 某 个 局 部 的 参 数 5. > 路 由 器 处 于 RXBOOT 状 态, 在 开 机 后 60 秒 内 按 ctrl-break 可 进 入 此 状 态, 这 时 路 由 器 不 能 完 成 正 常 的 功 能, 只 能 进 行 软 件 升 级 和 手 工 引 导 6. 设 置 对 话 状 态 这 是 一 台 新 路 由 器 开 机 时 自 动 进 入 的 状 态, 在 特 权 命 令 状 态 使 用 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? Method Status Protocol Ethernet0 unassigned NO unset up up Serial0 unassigned NO unset up up 然 后, 路 由 器 就 开 始 全 局 参 数 的 设 置 : Configuring global parameters: 1. 设 置 路 由 器 名 : Enter host name [Router]: 2. 设 置 进 入 特 权 状 态 的 密 文 (secret), 此 密 文 在 设 置 以 后 不 会 以 明 文 方 式 显 示 : The enable secret is a one-way cryptographic secret used instead of the enable password when it exists. Enter enable secret: cisco 3. 设 置 进 入 特 权 状 态 的 密 码 (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 4. 设 置 虚 拟 终 端 访 问 时 的 密 码 : Enter virtual terminal password: cisco 5. 询 问 是 否 要 设 置 路 由 器 支 持 的 各 种 网 络 协 议 : 3
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]: 6. 如 果 配 置 的 是 拨 号 访 问 服 务 器, 系 统 还 会 设 置 异 步 口 的 参 数 : 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]: yes 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) 是 否 设 置 异 步 口 上 的 其 它 协 议 接 下 来, 系 统 会 对 每 个 接 口 进 行 参 数 的 设 置 1.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; mask is /24 在 设 置 完 所 有 接 口 的 参 数 后, 系 统 会 把 整 个 设 置 对 话 过 程 的 结 果 显 示 出 来 : The following configuration command script was created: hostname Router 4
enable secret 5 $1$W5Oh$p6J7tIgRMBOIKVXVG53Uh1 enable password pass 请 注 意 在 enable secret 后 面 显 示 的 是 乱 码, 而 enable password 后 面 显 示 的 是 设 置 的 内 容 显 示 结 束 后, 系 统 会 问 是 否 使 用 这 个 设 置 : Use this configuration? [yes/no]: yes 如 果 回 答 yes, 系 统 就 会 把 设 置 的 结 果 存 入 路 由 器 的 NVRAM 中, 然 后 结 束 设 置 对 话 过 程, 使 路 由 器 开 始 正 常 的 工 作 四 常 用 命 令 1. 帮 助 在 IOS 操 作 中, 无 论 任 何 状 态 和 位 置, 都 可 以 键 入? 得 到 系 统 的 帮 助 2. 改 变 命 令 状 态 任 务 进 入 特 权 命 令 状 态 退 出 特 权 命 令 状 态 进 入 设 置 对 话 状 态 进 入 全 局 设 置 状 态 退 出 全 局 设 置 状 态 进 入 端 口 设 置 状 态 进 入 子 端 口 设 置 状 态 进 入 线 路 设 置 状 态 进 入 路 由 设 置 状 态 退 出 局 部 设 置 状 态 命 令 enable disable setup config terminal end interface type slot/number interface type number.subinterface [point-to-point multipoint] line type slot/number router protocol exit 3. 显 示 命 令 任 务 查 看 版 本 及 引 导 信 息 查 看 运 行 设 置 查 看 开 机 设 置 显 示 端 口 信 息 显 示 路 由 信 息 命 令 show version show running-config show startup-config show interface type slot/number show ip router 4. 拷 贝 命 令 用 于 IOS 及 CONFIG 的 备 份 和 升 级 5
flash startup config copy start running copy running start running config copy start tftp copy tftp start copy flash tftp copy tftp running copy flash tftp TFTP Server copy running tftp 5. 网 络 命 令 任 务 登 录 远 程 主 机 网 络 侦 测 路 由 跟 踪 命 令 telnet hostname IP address ping hostname IP address trace hostname IP address 6. 基 本 设 置 命 令 任 务 全 局 设 置 设 置 访 问 用 户 及 密 码 设 置 特 权 密 码 设 置 路 由 器 名 设 置 静 态 路 由 启 动 IP 路 由 启 动 IPX 路 由 端 口 设 置 设 置 IP 地 址 设 置 IPX 网 络 激 活 端 口 物 理 线 路 设 置 启 动 登 录 进 程 设 置 登 录 密 码 命 令 config terminal username username password password enable secret password hostname name ip route destination subnet-mask next-hop ip routing ipx routing interface type slot/number ip address address subnet-mask ipx network network no shutdown line type number login [local tacacs server] password password Router1 S0: 192.200.10.5 /30 WAN S0: 192.200.10.6 /30 Router2 E0 192.1.0.129/26 E0 192.1.0.65/26 五 配 置 IP 寻 址 1. IP 地 址 分 类 IP 地 址 分 为 网 络 地 址 和 主 机 地 址 二 个 部 分,A 类 地 址 前 8 位 为 网 络 地 址, 后 24 位 为 6
主 机 地 址,B 类 地 址 16 位 为 网 络 地 址, 后 16 位 为 主 机 地 址,C 类 地 址 前 24 位 为 网 络 地 址, 后 8 位 为 主 机 地 址, 网 络 地 址 范 围 如 下 表 所 示 : 种 类 A B C D E 网 络 地 址 范 围 1.0.0.0 到 126.0.0.0 有 效 0.0.0.0 和 127.0.0.0 保 留 128.1.0.0 到 191.254.0.0 有 效 128.0.0.0 和 191.255.0.0 保 留 192.0.1.0 到 223.255.254.0 有 效 192.0.0.0 和 223.255.255.0 保 留 224.0.0.0 到 239.255.255.255 用 于 多 点 广 播 240.0.0.0 到 255.255.255.254 保 留 255.255.255.255 用 于 广 播 2. 分 配 接 口 IP 地 址 任 务 命 令 接 口 设 置 interface type slot/number 为 接 口 设 置 IP 地 址 ip address ip-address mask 掩 玛 (mask) 用 于 识 别 IP 地 址 中 的 网 络 地 址 位 数,IP 地 址 (ip-address) 和 掩 码 (mask) 相 与 即 得 到 网 络 地 址 3. 使 用 可 变 长 的 子 网 掩 码 通 过 使 用 可 变 长 的 子 网 掩 码 可 以 让 位 于 不 同 接 口 的 同 一 网 络 编 号 的 网 络 使 用 不 同 的 掩 码, 这 样 可 以 节 省 IP 地 址, 充 分 利 用 有 效 的 IP 地 址 空 间 如 下 图 所 示 : Router1 和 Router2 的 E0 端 口 均 使 用 了 C 类 地 址 192.1.0.0 作 为 网 络 地 址,Router1 的 E0 的 网 络 地 址 为 192.1.0.128, 掩 码 为 255.255.255.192, Router2 的 E0 的 网 络 地 址 为 192.1.0.64, 掩 码 为 255.255.255.192, 这 样 就 将 一 个 C 类 网 络 地 址 分 配 给 了 二 个 网, 既 划 分 了 二 个 子 网, 起 到 了 节 约 地 址 的 作 用 4. 使 用 网 络 地 址 翻 译 (NAT) NAT(Network Address Translation) 起 到 将 内 部 私 有 地 址 翻 译 成 外 部 合 法 的 全 局 地 址 的 功 能, 它 使 得 不 具 有 合 法 IP 地 址 的 用 户 可 以 通 过 NAT 访 问 到 外 部 Internet. 当 建 立 内 部 网 的 时 候, 建 议 使 用 以 下 地 址 组 用 于 主 机, 这 些 地 址 是 由 Network Working Group(RFC 1918) 保 留 用 于 私 有 网 络 地 址 分 配 的. Class A:10.1.1.1 to 10.254.254.254 Class B:172.16.1.1 to 172.31.254.254 Class C:192.168.1.1 to 192.168.254.254 命 令 描 述 如 下 : 任 务 命 令 定 义 一 个 标 准 访 问 列 表 access-list access-list-number permit source [source-wildcard] 定 义 一 个 全 局 地 址 池 ip nat pool name start-ip end-ip {netmask netmask prefix-length prefix-length} [type rotary] 建 立 动 态 地 址 翻 译 ip nat inside source {list {access-list-number name} pool name [overload] static local-ip 7
指 定 内 部 和 外 部 端 口 global-ip} ip nat {inside outside} 如 下 图 所 示, 路 由 器 的 Ethernet 0 端 口 为 inside 端 口, 即 此 端 口 连 接 内 部 网 络, 并 且 此 端 口 所 连 接 的 网 络 应 该 被 翻 译,Serial 0 端 口 为 outside 端 口, 其 拥 有 合 法 IP 地 址 ( 由 NIC 或 服 务 提 供 商 所 分 配 的 合 法 的 IP 地 址 ), 来 自 网 络 10.0.0.0/24 的 主 机 将 从 IP 地 址 池 c2501 中 选 择 一 个 地 址 作 为 自 己 的 合 法 地 址, 经 由 Serial 0 口 访 问 Internet 命 令 ip nat Internet Router S0: 202.200.10.5/30 E0 10.0.0.1/24 inside source list 2 pool c2501 overload 中 的 参 数 overload, 将 允 许 多 个 内 部 地 址 使 用 相 同 的 全 局 地 址 ( 一 个 合 法 IP 地 址, 它 是 由 NIC 或 服 务 提 供 商 所 分 配 的 地 址 ) 命 令 ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192 定 义 了 全 局 地 址 的 范 围 设 置 如 下 : ip nat pool c2501 202.96.38.1 202.96.38.62 netmask 255.255.255.192 interface Ethernet 0 ip address 10.0.0.1 255.255.255.0 ip nat inside interface Serial 0 ip address 202.200.10.5 255.255.255.252 ip nat outside ip route 0.0.0.0 0.0.0.0 Serial 0 access-list 2 permit 10.0.0.0 0.0.0.255 Dynamic NAT ip nat inside source list 2 pool c2501 overload line console 0 exec-timeout 0 0 line vty 0 4 end 8
六 配 置 静 态 路 由 通 过 配 置 静 态 路 由, 用 户 可 以 人 为 地 指 定 对 某 一 网 络 访 问 时 所 要 经 过 的 路 径, 在 网 络 结 构 比 较 简 单, 且 一 般 到 达 某 一 网 络 所 经 过 的 路 径 唯 一 的 情 况 下 采 用 静 态 路 由 任 务 命 令 建 立 静 态 路 由 ip route prefix mask {address interface} [distance] [tag tag] ] [permanent] Prefix : 所 要 到 达 的 目 的 网 络 mask : 子 网 掩 码 address : 下 一 个 跳 的 IP 地 址, 即 相 邻 路 由 器 的 端 口 地 址 interface : 本 地 网 络 接 口 distance : 管 理 距 离 ( 可 选 ) tag tag :tag 值 ( 可 选 ) permanent : 指 定 此 路 由 即 使 该 端 口 关 掉 也 不 被 移 掉 以 下 在 Router1 上 设 置 了 访 问 192.1.0.64/26 这 个 网 下 一 跳 地 址 为 192.200.10.6, 即 当 有 目 的 地 址 属 于 192.1.0.64/26 的 网 络 范 围 的 数 据 报, 应 将 其 路 由 到 地 址 为 192.200.10.6 的 相 邻 路 由 器 在 Router3 上 设 置 了 访 问 192.1.0.128/26 及 192.200.10.4/30 这 二 个 网 下 一 跳 地 址 为 192.1.0.65 由 于 在 Router1 上 端 口 Serial 0 地 址 为 192.200.10.5,192.200.10.4/30 这 个 网 属 于 直 连 的 网, 已 经 存 在 访 问 192.200.10.4/30 的 路 径, 所 以 不 需 要 在 Router1 上 添 加 静 态 路 由 Router1: Router1 S0: 192.200.10.5 /30 WAN S0: 192.200.10.6 /30 Router2 E0 : 192.1.0.65/26 E0: 192.1.0.129/26 E0: 192.1.0.66/26 Router3 ip route 192.1.0.64 255.255.255.192 192.200.10.6 Router3: ip route 192.1.0.128 255.255.255.192 192.1.0.65 ip route 192.200.10.4 255.255.255.252 192.1.0.65 同 时 由 于 路 由 器 Router3 除 了 与 路 由 器 Router2 相 连 外, 不 再 与 其 他 路 由 器 相 连, 所 以 也 可 以 为 它 赋 予 一 条 默 认 路 由 以 代 替 以 上 的 二 条 静 态 路 由, ip route 0.0.0.0 0.0.0.0 192.1.0.65 9
即 只 要 没 有 在 路 由 表 里 找 到 去 特 定 目 的 地 址 的 路 径, 则 数 据 均 被 路 由 到 地 址 为 192.1.0.65 的 相 邻 路 由 器 10
第 二 章 广 域 网 协 议 设 置 一 HDLC HDLC 是 CISCO 路 由 器 使 用 的 缺 省 协 议, 一 台 新 路 由 器 在 未 指 定 封 装 协 议 时 默 认 使 用 HDLC 封 装 1. 有 关 命 令 端 口 设 置 任 务 命 令 设 置 HDLC 封 装 encapsulation hdlc 设 置 DCE 端 线 路 速 度 clockrate speed 复 位 一 个 硬 件 接 口 clear interface serial unit 显 示 接 口 状 态 show interfaces serial [unit] 1 注 :1. 以 下 给 出 一 个 显 示 Cisco 同 步 串 口 状 态 的 例 子. Router#show interface serial 0 Serial 0 is up, line protocol is up Hardware is MCI Serial Internet address is 150.136.190.203, subnet mask is 255.255.255.0 MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, rely 255/255, load 1/255 Encapsulation HDLC, loopback not set, keepalive set (10 sec) Last input 0:00:07, output 0:00:00, output hang never Output queue 0/40, 0 drops; input queue 0/75, 0 drops Five minute input rate 0 bits/sec, 0 packets/sec Five minute output rate 0 bits/sec, 0 packets/sec 16263 packets input, 1347238 bytes, 0 no buffer Received 13983 broadcasts, 0 runts, 0 giants 2 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 2 abort 22146 packets output, 2383680 bytes, 0 underruns 0 output errors, 0 collisions, 2 interface resets, 0 restarts 1 carrier transitions 2. 举 例 (DTE)S0 192.200.10 192.200.10 192.200.10.2 S0(DCE) Router1 11
设 置 如 下 : 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 3. 举 例 使 用 E1 线 路 实 现 多 个 64K 专 线 连 接. 相 关 命 令 : 射 任 务 命 令 进 入 controller 配 置 模 式 controller {t1 e1} number 选 择 帧 类 型 framing {crc4 no-crc4} 选 择 line-code 类 型 linecode {ami b8zs hdb3} 建 立 逻 辑 通 道 组 与 时 隙 的 映 channel-group number timeslots range 1 显 示 controllers 接 口 状 态 show controllers e1 [slot/port] 2 注 : 1. 当 链 路 为 T1 时,channel-group 编 号 为 0-23, Timeslot 范 围 1-24; 当 链 路 为 E1 时, channel-group 编 号 为 0-30, Timeslot 范 围 1-31. 2. 使 用 show controllers e1 观 察 controller 状 态, 以 下 为 帧 类 型 为 crc4 时 controllers 正 常 的 状 态. Router# show controllers e1 e1 0/0 is up. Applique type is Channelized E1 - unbalanced Framing is CRC4, Line Code is HDB3 No alarms detected. Data in current interval (725 seconds elapsed): 0 Line Code Violations, 0 Path Code Violations 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs Total Data (last 24 hours) 0 Line Code Violations, 0 Path Code Violations, 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins, 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 0 Unavail Secs 以 下 例 子 为 E1 连 接 3 条 64K 专 线, 帧 类 型 为 NO-CRC4, 非 平 衡 链 路, 路 由 器 具 体 设 置 如 下 : shanxi#wri t Building configuration... Current configuration: 12
version 11.2 no service udp-small-servers no service tcp-small-servers hostname shanxi enable secret 5 $1$XN08$Ttr8nfLoP9.2RgZhcBzkk/ enable password shanxi ip subnet-zero controller E1 0 framing NO-CRC4 channel-group 0 timeslots 1 channel-group 1 timeslots 2 channel-group 2 timeslots 3 interface Ethernet0 ip address 133.118.40.1 255.255.0.0 media-type 10BaseT interface Ethernet1 no ip address shutdown interface Serial0:0 ip address 202.119.96.1 255.255.255.252 no ip mroute-cache interface Serial0:1 ip address 202.119.96.5 255.255.255.252 no ip mroute-cache interface Serial0:2 ip address 202.119.96.9 255.255.255.252 no ip mroute-cache no ip classless ip route 133.210.40.0 255.255.255.0 Serial0:0 ip route 133.210.41.0 255.255.255.0 Serial0:1 ip route 133.210.42.0 255.255.255.0 Serial0:2 13
line con 0 line aux 0 line vty 0 4 password shanxi login end 二 PPP PPP(Point-to-Point Protocol) 是 SLIP(Serial Line IP protocol) 的 继 承 者, 它 提 供 了 跨 过 同 步 和 异 步 电 路 实 现 路 由 器 到 路 由 器 (router-to-router) 和 主 机 到 网 络 (host-to-network) 的 连 接 CHAP(Challenge Handshake Authentication Protocol) 和 PAP(Password Authentication Protocol) (PAP) 通 常 被 用 于 在 PPP 封 装 的 串 行 线 路 上 提 供 安 全 性 认 证 使 用 CHAP 和 PAP 认 证, 每 个 路 由 器 通 过 名 字 来 识 别, 可 以 防 止 未 经 授 权 的 访 问 CHAP 和 PAP 在 RFC 1334 上 有 详 细 的 说 明 1. 有 关 命 令 端 口 设 置 任 务 命 令 设 置 PPP 封 装 encapsulation ppp 1 设 置 认 证 方 法 ppp authentication {chap chap pap pap chap pap} [if-needed] [list-name default] [callin] 指 定 口 令 username name password secret 设 置 DCE 端 线 路 速 度 clockrate speed 注 :1 要 使 用 CHAP/PAP 必 须 使 用 PPP 封 装 在 与 非 Cisco 路 由 器 连 接 时, 一 般 采 用 PPP 封 装, 其 它 厂 家 路 由 器 一 般 不 支 持 Cisco 的 HDLC 封 装 协 议 2. 举 例 路 由 器 Router1 和 Router2 的 S0 口 均 封 装 PPP 协 议, 采 用 CHAP 做 认 证, 在 Router1 中 应 建 立 一 个 用 户, 以 对 端 路 由 器 主 机 名 作 为 用 户 名, 即 用 户 名 应 为 router2 同 时 在 Router2 中 应 建 立 一 个 用 户, 以 对 端 路 由 器 主 机 名 作 为 用 户 名, 即 用 户 名 应 为 router1 所 建 的 这 两 用 户 的 password 必 须 相 同 (DTE)S0 192.200.10.1 192.200.10 192.200.10 S0(DCE) Router1 设 置 如 下 : Router1: 14
hostname router1 username router2 password xxx interface Serial0 ip address 192.200.10.1 255.255.255.0 clockrate 1000000 ppp authentication chap Router2: hostname router2 username router1 password xxx interface Serial0 ip address 192.200.10.2 255.255.255.0 ppp authentication chap 三 X.25 X25 技 术 X.25 规 范 对 应 OSI 三 层,X.25 的 第 三 层 描 述 了 分 组 的 格 式 及 分 组 交 换 的 过 程 X.25 的 第 二 层 由 LAPB(Link Access Procedure, Balanced) 实 现, 它 定 义 了 用 于 DTE/DCE 连 接 的 帧 格 式 X.25 的 第 一 层 定 义 了 电 气 和 物 理 端 口 特 性 X.25 网 络 设 备 分 为 数 据 终 端 设 备 (DTE) 数 据 电 路 终 端 设 备 (DCE) 及 分 组 交 换 设 备 (PSE) DTE 是 X.25 的 末 端 系 统, 如 终 端 计 算 机 或 网 络 主 机, 一 般 位 于 用 户 端,Cisco 路 由 器 就 是 DTE 设 备 DCE 设 备 是 专 用 通 信 设 备, 如 调 制 解 调 器 和 分 组 交 换 机 PSE 是 公 共 网 络 的 主 干 交 换 机 X.25 定 义 了 数 据 通 讯 的 电 话 网 络, 每 个 分 配 给 用 户 的 x.25 端 口 都 具 有 一 个 x.121 地 址, 当 用 户 申 请 到 的 是 SVC( 交 换 虚 电 路 ) 时,x.25 一 端 的 用 户 在 访 问 另 一 端 的 用 户 时, 首 先 将 呼 叫 对 方 x.121 地 址, 然 后 接 收 到 呼 叫 的 一 端 可 以 接 受 或 拒 绝, 如 果 接 受 请 求, 于 是 连 接 建 立 实 现 数 据 传 输, 当 没 有 数 据 传 输 时 挂 断 连 接, 整 个 呼 叫 过 程 就 类 似 我 们 拨 打 普 通 电 话 一 样, 其 不 同 的 是 x.25 可 以 实 现 一 点 对 多 点 的 连 接 其 中 x.121 地 址 htc 均 必 须 与 x.25 服 务 提 供 商 分 配 的 参 数 相 同 X.25 PVC( 永 久 虚 电 路 ), 没 有 呼 叫 的 过 程, 类 似 DDN 专 线 1. 有 关 命 令 : 任 务 设 置 X.25 封 装 设 置 X.121 地 址 设 置 远 方 站 点 的 地 址 映 射 命 令 encapsulation x25 [dce] x25 address x.121-address x25 map protocol address [protocol2 address2[...[protocol9 address9]]] x121-address [option] 设 置 最 大 的 双 向 虚 电 路 数 x25 htc citcuit-number 1 设 置 一 次 连 接 可 同 时 建 立 的 x25 nvc count 2 虚 电 路 数 设 置 x25 在 清 除 空 闲 虚 电 路 x25 idle minutes 前 的 等 待 周 期 重 新 启 动 x25, 或 清 一 个 svc, clear x25 {serial number 15
启 动 一 个 pvc 相 关 参 数 cmns-interface mac-address} [vc-number] 3 清 x25 虚 电 路 clear x25-vc 显 示 接 口 及 x25 相 关 信 息 show interfaces serial show x25 interface show x25 map show x25 vc 注 :1 虚 电 路 号 从 1 到 4095,Cisco 路 由 器 默 认 为 1024, 国 内 一 般 分 配 为 16 2 虚 电 路 计 数 从 1 到 8, 缺 省 为 1 3 在 改 变 了 x.25 各 层 的 相 关 参 数 后, 应 重 新 启 动 x25( 使 用 clear x25 {serial number cmns-interface mac-address} [vc-number] 或 clear x25-vc 命 令 ), 否 则 新 设 置 的 参 数 可 能 不 能 生 效 同 时 应 对 照 服 务 提 供 商 对 于 x.25 交 换 机 端 口 的 设 置 来 配 置 路 由 器 的 相 关 参 数, 若 出 现 参 数 不 匹 配 则 可 能 会 导 致 连 接 失 败 或 其 它 意 外 情 况 实 例 : 3.1. 在 以 下 实 例 中 每 二 个 路 由 器 间 均 通 过 svc 实 现 连 接 S0:110101 Router1 192.200.10.1 /24 S0:110102 192.200.10.2 /24 Router2 E0: 192.1.0.129/26 X.25 E0 : 192.1.0.65/26 S0:110103 192.200.10.3/24 Router 3 路 由 器 设 置 如 下 : Router1: interface Serial0 encapsulation x25 ip address 192.200.10.1 255.255.255.0 x25 address 110101 x25 htc 16 x25 nvc 2 x25 map ip 192.200.10.2 110102 broadcast x25 map ip 192.200.10.3 110103 broadcast Router2: interface Serial0 encapsulation x25 ip address 192.200.10.2 255.255.255.0 x25 address 110102 x25 htc 16 x25 nvc 2 x25 map ip 192.200.10.1 110101 broadcast x25 map ip 192.200.10.3 110103 broadcast 16
Router: interface Serial0 encapsulation x25 ip address 192.200.10.3 255.255.255.0 x25 address 110103 x25 htc 16 x25 nvc 2 x25 map ip 192.200.10.1 110101 broadcast x25 map ip 192.200.10.2 110102 broadcast 相 关 调 试 命 令 : clear x25-vc show interfaces serial show x25 map show x25 route show x25 vc 3.2. 在 以 下 实 例 中 路 由 器 router1 和 router2 均 通 过 svc 与 router 连 接, 但 router1 和 router2 不 通 过 svc 直 接 连 接, 此 三 个 路 由 器 的 串 口 运 行 RIP 路 由 协 议, 使 用 了 子 接 口 的 概 念 由 于 使 用 子 接 口,router1 和 router2 均 学 习 到 了 访 问 对 方 局 域 网 的 路 径, 若 不 使 用 子 接 口,router1 和 router2 将 学 不 到 到 对 方 局 域 网 的 路 由 Router1 S0:110101 192.200.10.1/ 24 S0:110102 192.200.11.2 /24 Router2 E0: 192.1.0.129/26 X.25 E0 : 192.1.0.65/26 S0:110103 S0.1:192.200.10.3/24 S0.2:192.200.11.3/24 Router 3 子 接 口 (Subinterface) 是 一 个 物 理 接 口 上 的 多 个 虚 接 口, 可 以 用 于 在 同 一 个 物 理 接 口 上 连 接 多 个 网 我 们 知 道 为 了 避 免 路 由 循 环, 路 由 器 支 持 split horizon 法 则, 它 只 允 许 路 由 更 新 被 分 配 到 路 由 器 的 其 它 接 口, 而 不 会 再 分 配 路 由 更 新 回 到 此 路 由 被 接 收 的 接 口 无 论 如 何, 在 广 域 网 环 境 使 用 基 于 连 接 的 接 口 ( 象 X.25 和 Frame Relay), 同 一 接 口 通 过 虚 电 路 (vc) 连 接 多 台 远 端 路 由 器 时, 从 同 一 接 口 来 的 路 由 更 新 信 息 不 可 以 再 被 发 回 到 相 同 的 接 口, 除 非 强 制 使 用 分 开 的 物 理 接 口 连 接 不 同 的 路 由 器 Cisco 提 供 子 接 口 (subinterface) 作 为 分 开 的 接 口 对 待 你 可 以 将 路 由 器 逻 辑 地 连 接 到 相 同 物 理 接 口 的 不 同 子 接 口, 这 样 来 自 不 同 子 接 口 的 路 由 更 新 就 可 以 被 分 配 到 其 他 子 接 口, 同 时 又 满 足 split horizon 法 则 Router1: 17
interface Serial0 encapsulation x25 ip address 192.200.10.1 255.255.255.0 x25 address 110101 x25 htc 16 x25 nvc 2 x25 map ip 192.200.10.3 110103 broadcast router rip network 192.200.10.0 Router2: interface Serial0 encapsulation x25 ip address 192.200.11.2 255.255.255.0 x25 address 110102 x25 htc 16 x25 nvc 2 x25 map ip 192.200.11.3 110103 broadcast router rip network 192.200.11.0 Router: interface Serial0 encapsulation x25 x25 address 110103 x25 htc 16 x25 nvc 2 interface Serial0.1 point-to-point ip address 192.200.10.3 255.255.255.0 x25 map ip 192.200.10.1 110101 broadcast interface Serial0.2 point-to-point ip address 192.200.11.3 255.255.255.0 x25 map ip 192.200.11.2 110102 broadcast router rip network 192.200.10.0 network 192.200.11.0 18
四 Frame Relay 1. 帧 中 继 技 术 帧 中 继 是 一 种 高 性 能 的 WAN 协 议, 它 运 行 在 OSI 参 考 模 型 的 物 理 层 和 数 据 链 路 层 它 是 一 种 数 据 包 交 换 技 术, 是 X.25 的 简 化 版 本 它 省 略 了 X.25 的 一 些 强 健 功 能, 如 提 供 窗 口 技 术 和 数 据 重 发 技 术, 而 是 依 靠 高 层 协 议 提 供 纠 错 功 能, 这 是 因 为 帧 中 继 工 作 在 更 好 的 WAN 设 备 上, 这 些 设 备 较 之 X.25 的 WAN 设 备 具 有 更 可 靠 的 连 接 服 务 和 更 高 的 可 靠 性, 它 严 格 地 对 应 于 OSI 参 考 模 型 的 最 低 二 层, 而 X.25 还 提 供 第 三 层 的 服 务, 所 以, 帧 中 继 比 X.25 具 有 更 高 的 性 能 和 更 有 效 的 传 输 效 率 Data-Link Connection Identifier(DLCI) CSU/ DSU Frame Relay Switch Frame Relay Switch Frame Relay Switch Token Ring Local Management Interface(LMI) Committed Information Rate(CIR) 帧 中 继 广 域 网 的 设 备 分 为 数 据 终 端 设 备 (DTE) 和 数 据 电 路 终 端 设 备 (DCE),Cisco 路 由 器 作 为 DTE 设 备 帧 中 继 技 术 提 供 面 向 连 接 的 数 据 链 路 层 的 通 信, 在 每 对 设 备 之 间 都 存 在 一 条 定 义 好 的 通 信 链 路, 且 该 链 路 有 一 个 链 路 识 别 码 这 种 服 务 通 过 帧 中 继 虚 电 路 实 现, 每 个 帧 中 继 虚 电 路 都 以 数 据 链 路 识 别 码 (DLCI) 标 识 自 己 DLCI 的 值 一 般 由 帧 中 继 服 务 提 供 商 指 定 帧 中 继 即 支 持 PVC 也 支 持 SVC 帧 中 继 本 地 管 理 接 口 (LMI) 是 对 基 本 的 帧 中 继 标 准 的 扩 展 它 是 路 由 器 和 帧 中 继 交 换 机 之 间 信 令 标 准, 提 供 帧 中 继 管 理 机 制 它 提 供 了 许 多 管 理 复 杂 互 联 网 络 的 特 性, 其 中 包 括 全 局 寻 址 虚 电 路 状 态 消 息 和 多 目 发 送 等 功 能 2. 有 关 命 令 : 端 口 设 置 任 务 命 令 设 置 Frame Relay 封 装 encapsulation frame-relay[ietf] 1 设 置 Frame Relay LMI 类 型 frame-relay lmi-type {ansi cisco q933a} 2 设 置 子 接 口 interface interface-type interface-number.subinterface-number [multipoint point-to-point] 映 射 协 议 地 址 与 DLCI frame-relay map protocol protocol-address dlci [broadcast] 3 19
设 置 FR DLCI 编 号 frame-relay interface-dlci dlci [broadcast] 注 :1. 若 使 Cisco 路 由 器 与 其 它 厂 家 路 由 设 备 相 连, 则 使 用 Internet 工 程 任 务 组 (IETF) 规 定 的 帧 中 继 封 装 格 式 2. 从 Cisco IOS 版 本 11.2 开 始, 软 件 支 持 本 地 管 理 接 口 (LMI) 自 动 感 觉, 自 动 感 觉 使 接 口 能 确 定 交 换 机 支 持 的 LMI 类 型, 用 户 可 以 不 明 确 配 置 LMI 接 口 类 型 3.broadcast 选 项 允 许 在 帧 中 继 网 络 上 传 输 路 由 广 播 信 息 3. 帧 中 继 point to point 配 置 实 例 : Router4 Router3 Router5 172.16.4.0 172.16.3.0 Frame Relay Network 172.16.1.0 172.16.2.0 DLCI 201 203 DLCI 105 104 102 Router1 Router2 Router1: interface serial 0 encapsulation frame-relay interface serial 0.1 point-to-point ip address 172.16.1.1 255.255.255.0 frame-reply interface-dlci 105 interface serial 0.2 point-to-point ip address 172.16.2.1 255.255.255.0 frame-reply interface-dlci 102 interface serial 0.3 point-to-point ip address 172.16.4.1 255.255.255.0 frame-reply interface-dlci 104 Router2: interface serial 0 encapsulation frame-relay interface serial 0.1 point-to-point ip address 172.16.2.2 255.255.255.0 20
frame-reply interface-dlci 201 interface serial 0.2 point-to-point ip address 172.16.3.1 255.255.255.0 frame-reply interface-dlci 203 相 关 调 试 命 令 : show frame-relay lmi show frame-relay map show frame-relay pvc show frame-relay route show interfaces serial 4. 帧 中 继 Multipoint 配 置 实 例 : Router3 DLCI:103 172.16.1.3/24 Router4 DLCI:104 172.16.1.4/24 Frame Relay Network Router1: DLCI:201 301 401 172.16.1.2/24 Router2 DLCI:102 172.16.1.1/24 Router1: interface serial 0 encapsulation frame-reply interface serial 0.1 multipoint ip address 172.16.1.2 255.255.255.0 frame-reply map ip 172.16.1.1 201 broadcast frame-reply map ip 172.16.1.3 301 broadcast frame-reply map ip 172.16.1.4 401 broadcast Router2: interface serial 0 encapsulation frame-reply interface serial 0.1 multipoint ip address 172.16.1.1 255.255.255.0 frame-reply map ip 172.16.1.2 102 broadcast frame-reply map ip 172.16.1.3 102 broadcast 21
frame-reply map ip 172.16.1.4 102 broadcast 五 ISDN 1. 综 合 数 字 业 务 网 (ISDN) 综 合 数 字 业 务 网 (ISDN) 由 数 字 电 话 和 数 据 传 输 服 务 两 部 分 组 成, 一 般 由 电 话 局 提 供 这 种 服 务 ISDN 的 基 本 速 率 接 口 (BRI) 服 务 提 供 2 个 B 信 道 和 1 个 D 信 道 (2B+D) BRI 的 B 信 道 速 率 为 64Kbps, 用 于 传 输 用 户 数 据 D 信 道 的 速 率 为 16Kbps, 主 要 传 输 控 制 信 号 在 北 美 和 日 本,ISDN 的 主 速 率 接 口 (PRI) 提 供 23 个 B 信 道 和 1 个 D 信 道, 总 速 率 可 达 1.544Mbps, 其 中 D 信 道 速 率 为 64Kbps 而 在 欧 洲 澳 大 利 亚 等 国 家,ISDN 的 PRI 提 供 30 个 B 信 道 和 1 个 64Kbps D 信 道, 总 速 率 可 达 2.048Mbps 我 国 电 话 局 所 提 供 ISDN PRI 为 30B+D 2. 基 本 命 令 任 务 命 令 设 置 ISDN 交 换 类 型 isdn switch-type switch-type 1 接 口 设 置 interface bri 0 设 置 PPP 封 装 encapsulation ppp 设 置 协 议 地 址 与 电 话 号 码 的 映 射 dialer map protocol next-hop-address [name hostname] [broadcast] [dial-string] 启 动 PPP 多 连 接 ppp multilink 设 置 启 动 另 一 个 B 通 道 的 阈 dialer load-threshold load 值 显 示 ISDN 有 关 信 息 show isdn {active history memory services status [dsl interface-type number] timers} 字 注 :1. 交 换 机 类 型 如 下 表, 国 内 交 换 机 一 般 为 basic-net3 按 区 域 分 关 键 交 换 机 类 型 Australia basic-ts013 Australian TS013 switches Europe basic-1tr6 German 1TR6 ISDN switches basic-nwnet3 Norway NET3 switches (phase 1) basic-net3 NET3 ISDN switches (UK, Denmark, and other nations); covers the Euro-ISDN E-DSS1 signalling system primary-net5 NET5 switches (UK and Europe) vn2 French VN2 ISDN switches vn3 French VN3 ISDN switches Japan ntt Japanese NTT ISDN switches primary-ntt Japanese ISDN PRI switches North America basic-5ess AT&T basic rate switches basic-dms100 NT DMS-100 basic rate switches basic-ni1 National ISDN-1 switches primary-4ess AT&T 4ESS switch type for the U.S. (ISDN PRI only) primary-5ess AT&T 5ESS switch type for the U.S. (ISDN PRI only) 22
0 primary-dms10 New Zealand basic-nznet3 NT DMS-100 switch type for the U.S. (ISDN PRI only) New Zealand Net3 switches 3. ISDN 实 现 DDR(dial-on-demand routing) 实 例 : BRI0: 192.200.10.1 电 话 号 码 : 571 ISDN BRI0: 192.200.10.2 电 话 号 码 : 572 Router1 Router2 设 置 如 下 : Router1: hostname router1 user router2 password cisco isdn switch-type basic-net3 interface bri 0 ip address 192.200.10.1 255.255.255.0 encapsulation ppp dialer map ip 192.200.10.2 name router2 572 dialer load-threshold 80 ppp multilink dialer-group 1 ppp authentication chap dialer-list 1 protocol ip permit Router2: hostname router2 user router1 password cisco isdn switch-type basic-net3 interface bri 0 ip address 192.200.10.2 255.255.255.0 encapsulation ppp dialer map ip 192.200.10.1 name router1 571 dialer load-threshold 80 ppp multilink dialer-group 1 ppp authentication chap 23
dialer-list 1 protocol ip permit Cisco 路 由 器 同 时 支 持 回 拨 功 能, 我 们 将 路 由 器 Router1 作 为 Callback Server,Router2 作 为 Callback Client 与 回 拨 相 关 命 令 : 任 务 映 射 协 议 地 址 和 电 话 号 码, 并 在 接 口 上 使 用 在 全 局 模 式 下 定 义 的 PPP 回 拨 的 映 射 类 别 设 置 接 口 支 持 PPP 回 拨 在 全 局 模 式 下 为 PPP 回 拨 设 置 映 射 类 别 通 过 查 找 注 册 在 dialer map 里 的 主 机 名 来 决 定 回 拨. 设 置 接 口 要 求 PPP 回 拨 命 令 dialer map protocol address name hostname class classname dial-string ppp callback accept map-class dialer classname dialer callback-server [username] ppp callback request 设 置 如 下 : Router1: hostname router1 user router2 password cisco isdn switch-type basic-net3 interface bri 0 ip address 192.200.10.1 255.255.255.0 encapsulation ppp dialer map ip 192.200.10.2 name router2 class s3 572 dialer load-threshold 80 ppp callback accept ppp multilink dialer-group 1 ppp authentication chap map-class dialer s3 dialer callback-server username dialer-list 1 protocol ip permit Router2: hostname router2 user router1 password cisco isdn switch-type basic-net3 24
interface bri 0 ip address 192.200.10.2 255.255.255.0 encapsulation ppp dialer map ip 192.200.10.1 name router1 571 dialer load-threshold 80 ppp callback request ppp multilink dialer-group 1 ppp authentication chap dialer-list 1 protocol ip permit 相 关 调 试 命 令 : debug dialer debug isdn event debug isdn q921 debug isdn q931 debug ppp authentication debug ppp error debug ppp negotiation debug ppp packet show dialer show isdn status 举 例 : 执 行 debug dialer 命 令 观 察 router2 呼 叫 router1,router1 回 拨 router2 的 过 程. router1#debug dialer router2#ping 192.200.10.1 router1# 00:03:50: %LINK-3-UPDOWN: Interface BRI0:1, changed state to up 00:03:50: BRI0:1:PPP callback Callback server starting to router2 572 00:03:50: BRI0:1: disconnecting call 00:03:50: %LINK-3-UPDOWN: Interface BRI0:1, changed state to down 00:03:50: BRI0:1: disconnecting call 00:03:50: BRI0:1: disconnecting call 00:03:51: %LINK-3-UPDOWN: Interface BRI0:2, changed state to up 00:03:52: callback to router2 already started 00:03:52: BRI0:2: disconnecting call 00:03:52: %LINK-3-UPDOWN: Interface BRI0:2, changed state to down 00:03:52: BRI0:2: disconnecting call 00:03:52: BRI0:2: disconnecting call 00:04:05: : Callback timer expired 00:04:05: BRI0:beginning callback to router2 572 25
00:04:05: BRI0: Attempting to dial 572 00:04:05: Freeing callback to router2 572 00:04:05: %LINK-3-UPDOWN: Interface BRI0:1, changed state to up 00:04:05: BRI0:1: No callback negotiated 00:04:05: %LINK-3-UPDOWN: Interface Virtual-Access1, changed state to up 00:04:05: dialer Protocol up for Vi1 00:04:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface BRI0:1, changed state to up 00:04:06: %LINEPROTO-5-UPDOWN: Line protocol on Interface Virtual-Access1, chang ed state to up 00:04:11: %ISDN-6-CONNECT: Interface BRI0:1 is now connected to 572 #router1 4. ISDN 访 问 首 都 在 线 263 网 实 例 : 263 BRI0: 动 态 获 得 IP 地 址 Router E0 10.0.0.1/24 本 地 局 部 网 地 址 为 10.0.0.0/24, 属 于 保 留 地 址, 通 过 NAT 地 址 翻 译 功 能, 局 域 网 用 户 可 以 通 过 ISDN 上 263 网 访 问 Internet 263 的 ISDN 电 话 号 码 为 2633, 用 户 为 263, 口 令 为 263, 所 涉 及 的 命 令 如 下 表 : 任 务 命 令 指 定 接 口 通 过 PPP/IPCP 地 址 ip address negotiated 协 商 获 得 IP 地 址 指 定 内 部 和 外 部 端 口 ip nat {inside outside} 使 用 ppp/pap 作 认 证 ppp authentication pap callin 指 定 接 口 属 于 拨 号 组 1 dialer-group 1 定 义 拨 号 组 1 允 许 所 有 IP 协 dialer-list 1 protocol ip permit 议 设 定 拨 号, 号 码 为 2633 dialer string 2633 设 定 登 录 263 的 用 户 名 和 口 ppp pap sent-username 263 password 263 令 设 定 默 认 路 由 ip route 0.0.0.0 0.0.0.0 bri 0 设 定 符 合 访 问 列 表 2 的 所 有 源 地 址 被 翻 译 为 bri 0 所 拥 有 的 ip nat inside source list 2 interface bri 0 overload 地 址 设 定 访 问 列 表 2, 允 许 所 有 协 access-list 2 permit any 议 具 体 配 置 如 下 : hostname Cisco2503 26
isdn switch-type type basic-net3 ip subnet-zero no ip domain-lookup ip routing interface Ethernet 0 ip address 10.0.0.1 255.255.255.0 ip nat inside no shutdown interface Serial 0 shutdown no description no ip address interface Serial 1 shutdown no description no ip address interface bri 0 ip address negotiated ip nat outside encapsulation ppp ppp authentication pap callin ppp multilink dialer-group 1 dialer hold-queue 10 dialer string 2633 dialer idle-timeout 120 ppp pap sent-username 263 password 263 no cdp enable no ip split-horizon no shutdown ip classless Static Routes ip route 0.0.0.0 0.0.0.0 bri 0 Access Control List 2 27
access-list 2 permit any dialer-list list 1 protocol ip permit Dynamic NAT ip nat inside source list 2 interface bri 0 overload snmp-server community public ro line console 0 exec-timeout 0 0 line vty 0 4 end 5. Cisco765M 通 过 ISDN 拨 号 上 263 由 于 Cisco765 的 设 置 命 令 与 我 们 常 用 的 Cisco 路 由 器 的 命 令 不 同, 所 以 以 下 列 举 了 通 过 Cisco765 上 263 访 问 Internet 的 具 体 命 令 行 设 置 步 骤 >set system c765 c765> set multidestination on c765> set switch net3 c765> set ppp multilink on c765> cd lan c765:lan> set ip routing on c765:lan> set ip address 10.0.0.1 c765:lan> set ip netmask 255.0.0.0 c765:lan> set briding off c765:lan>cd c765> set user remotenet New user remotenet being created c765:remotenet> set ip routing on c765:remotenet> set bridging off c765:remotenet> set ip framing none c765:remotenet> set ppp clientname 263 c765:remotenet> set ppp password client Enter new Password: 263 Re-Type new Password: 263 c765:remotenet> set ppp authentication out none c765:remotenet> set ip address 0.0.0.0 c765:remotenet> set ip netmask 0.0.0.0 c765:remotenet> set ppp address negotiation local on 28
c765:remotenet> set ip pat on c765:remotenet> set ip route destination 0.0.0.0/0 gateway 0.0.0.0 c765:remotenet> set number 2633 c765:remotenet> set active 命 令 描 述 如 下 : 任 务 命 令 设 置 路 由 器 系 统 名 称 set system c765 允 许 路 由 器 呼 叫 多 个 目 的 地 set multidestination on 设 置 ISDN 交 换 机 类 型 为 set switch net3 NET3 允 许 点 到 点 间 多 条 通 道 连 接 set ppp multilink on 实 现 负 载 均 衡 关 掉 桥 接 set briding off 建 立 用 户 预 制 文 件 用 于 设 置 set user remotenet 拨 号 连 接 参 数 - 可 以 设 置 多 个 用 户 预 制 文 件 用 于 相 同 的 物 理 端 口 对 应 于 不 同 的 连 接 使 用 PPP/IPCP set ip framing none 设 置 上 网 用 户 帐 号 set ppp clientname 263 设 置 上 网 口 令 set ppp password client Enter new Password: 263 Re-Type new Password: 263 不 用 PPP/CHAP 或 PAP 做 认 set ppp authentication out none 证 允 许 地 址 磋 商 set ppp address negotiation local on 设 置 地 址 翻 译 set ip pat on 设 置 默 认 路 由 set ip route destination 0.0.0.0/0 gateway 0.0.0.0 设 置 ISP 的 电 话 号 码 set number 2633 激 活 用 户 预 制 文 件 set active 六 PSTN 电 话 网 络 (PSTN) 是 目 前 普 及 程 度 最 高 成 本 最 低 的 公 用 通 讯 网 络, 它 在 网 络 互 连 中 也 有 广 泛 的 应 用 电 话 网 络 的 应 用 一 般 可 分 为 两 种 类 型, 一 种 是 同 等 级 别 机 构 之 间 以 按 需 拨 号 (DDR) 的 方 式 实 现 互 连, 一 种 是 ISP 为 拨 号 上 网 为 用 户 提 供 的 远 程 访 问 服 务 的 功 能 1. 远 程 访 问 1.1. Access Server 基 本 设 置 : PSTN 10.111.4.20/24 10.111.4.2/24 选 用 Cisco2511 作 为 访 问 服 务 器, 采 用 IP 地 址 池 动 态 分 配 地 址. 远 程 工 作 站 使 用 WIN95 拨 号 网 络 实 现 连 接 全 局 设 置 : 任 务 设 置 用 户 名 和 密 码 命 令 username username password password 29
设 置 用 户 的 IP 地 址 池 ip local pool {default pool-name low-ip-address [high-ip-address]} 指 定 地 址 池 的 工 作 方 式 ip address-pool [dhcp-proxy-client local] 基 本 接 口 设 置 命 令 : 任 务 命 令 设 置 封 装 形 式 为 PPP encapsulation ppp 启 动 异 步 口 的 路 由 功 能 async default routing 设 置 异 步 口 的 PPP 工 作 方 式 async mode {dedicated interactive} 设 置 用 户 的 IP 地 址 peer default ip address {ip-address dhcp pool [pool-name]} 设 置 IP 地 址 与 Ethernet0 相 ip unnumbered ethernet0 同 line 拨 号 线 设 置 : 任 务 命 令 设 置 modem 的 工 作 方 式 modem {inout dialin} 自 动 配 置 modem 类 型 modem autoconfig discovery 设 置 拨 号 线 的 通 讯 速 率 speed speed 设 置 通 讯 线 路 的 流 控 方 式 flowcontrol {none software [lock] [in out] hardware [in out]} 连 通 后 自 动 执 行 命 令 autocommand command 访 问 服 务 器 设 置 如 下 : Router: hostname Router enable secret 5 $1$EFqU$tYLJLrynNUKzE4bx6fmH// interface Ethernet0 ip address 10.111.4.20 255.255.255.0 interface Async1 ip unnumbered Ethernet0 encapsulation ppp keepalive 10 async mode interactive peer default ip address pool Cisco2511-Group-142 ip local pool Cisco2511-Group-142 10.111.4.21 10.111.4.36 line con 0 exec-timeout 0 0 password cisco line 1 16 modem InOut modem autoconfigure discovery flowcontrol hardware 30
line aux 0 transport input all line vty 0 4 password cisco end 相 关 调 试 命 令 : show interface show line 1.2. Access Server 通 过 Tacacs 服 务 器 实 现 安 全 认 证 : 使 用 一 台 WINDOWS NT 服 务 器 作 为 Tacacs 服 务 器, 地 址 为 10.111.4.2, 运 行 Cisco2511 随 机 带 的 Easy ACS 1.0 软 件 实 现 用 户 认 证 功 能. 相 关 设 置 : 任 务 命 令 激 活 AAA 访 问 控 制 aaa new-model 用 户 登 录 时 默 认 起 用 aaa authentication login default tacacs+ Tacacs+ 做 AAA 认 证 列 表 名 为 no_tacacs 使 用 aaa authentication login no_tacacs enable ENABLE 口 令 做 认 证 在 运 行 PPP 的 串 行 线 上 采 用 aaa authentication ppp default tacacs+ Tacacs+ 做 认 证 由 TACACS+ 服 务 器 授 权 运 aaa authorization exec tacacs+ 行 EXEC 由 TACACS+ 服 务 器 授 权 与 aaa authorization network tacacs+ 网 络 相 关 的 服 务 请 求 为 EXEC 会 话 运 行 记 帐. 进 程 aaa accounting exec start-stop tacacs+ 开 始 和 结 束 时 发 通 告 给 TACACS+ 服 务 器 为 与 网 络 相 关 的 服 务 需 求 运 aaa accounting network start-stop tacacs+ 行 记 帐 包 括 SLIP,PPP,PPP NCPs,ARAP 等. 在 进 程 开 始 和 结 束 时 发 通 告 给 TACACS+ 服 务 器 指 定 Tacacs 服 务 器 地 址 tacacs-server host 10.111.4.2 在 Tacacs+ 服 务 器 和 访 问 服 tacacs-server key tac 务 器 设 定 共 享 的 关 键 字, 访 问 服 务 器 和 Tacacs+ 服 务 器 使 用 这 个 关 键 字 去 加 密 口 令 和 响 应 信 息 这 里 使 用 tac 作 为 关 键 字 访 问 服 务 器 设 置 如 下 : hostname router aaa new-model aaa authentication login default tacacs+ aaa authentication login no_tacacs enable aaa authentication ppp default tacacs+ 31
aaa authorization exec tacacs+ aaa authorization network tacacs+ aaa accounting exec start-stop tacacs+ aaa accounting network start-stop tacacs+ enable secret 5 $1$kN4g$CvS4d2.rJzWntCnn/0hvE0 interface Ethernet0 ip address 10.111.4.20 255.255.255.0 interface Serial0 no ip address shutdown interface Serial1 no ip address shutdown interface Group-Async1 ip unnumbered Ethernet0 encapsulation ppp async mode interactive peer default ip address pool Cisco2511-Group-142 no cdp enable group-range 1 16 ip local pool Cisco2511-Group-142 10.111.4.21 10.111.4.36 tacacs-server host 10.111.4.2 tacacs-server key tac line con 0 exec-timeout 0 0 password cisco login authentication no_tacacs line 1 16 login authentication tacacs modem InOut modem autoconfigure type usr_courier autocommand ppp transport input all stopbits 1 rxspeed 115200 txspeed 115200 flowcontrol hardware line aux 0 transport input all 32
line vty 0 4 password cisco end 2. DDR(dial-on-demand routing) 实 例 此 例 通 过 Cisco 2500 系 列 路 由 器 的 aux 端 口 实 现 异 步 拨 号 DDR 连 接 Router1 拨 号 连 接 到 Router2 其 中 采 用 PPP/CHAP 做 安 全 认 证, 在 Router1 中 应 建 立 一 个 用 户, 以 对 端 路 由 器 主 机 名 作 为 用 户 名, 即 用 户 名 应 为 Router2 同 时 在 Router2 中 应 建 立 一 个 用 户, 以 对 端 路 由 器 主 机 名 作 为 用 户 名, 即 用 户 名 应 为 Router1 所 建 的 这 两 用 户 的 password 必 须 相 同 Async1: 192.200.10.1 Async1: 192.200.10.2 PSTN Router1 Router2 相 关 命 令 如 下 : 任 务 设 置 路 由 器 与 modem 的 接 口 指 令 设 置 端 口 在 挂 断 前 的 等 待 时 间 设 置 协 议 地 址 与 电 话 号 码 的 映 射 设 置 电 话 号 码 指 定 在 特 定 线 路 下 路 由 器 默 认 使 用 的 chat-script 命 令 chat-script script-name EXPECT SEND EXPECT SEND (etc.) dialer idle-timeout seconds dialer map protocol next-hop-address [name hostname] [broadcast] [modem-script modem-regexp] [system-script system-regexp] [dial-string] dialer string dial-string script {dialer reset} script-name \c Router1: hostname Router1 enable secret 5 $1$QKI7$wXjpFqC74vDAyKBUMallw/ username Router2 password cisco chat-script cisco-default "" "AT" TIMEOUT 30 OK "ATDT \T" TIMEOUT 30 CONNECT interface Ethernet0 ip address 10.0.0.1 255.255.255.0 interface Async1 ip address 192.200.10.1 255.255.255.0 encapsulation ppp 33
async default routing async mode dedicated dialer in-band dialer idle-timeout 60 dialer map ip 192.200.10.2 name Router2 modem-script cisco-default 573 dialer-group 1 ppp authentication chap ip route 10.0.1.0 255.255.255.0 192.200.10.2 dialer-list 1 protocol ip permit line con 0 line aux 0 modem InOut modem autoconfigure discovery flowcontrol hardware Router2: hostname Router2 enable secret 5 $1$F6EV$5U8puzNt2/o9g.t56PXHo. username Router1 password cisco interface Ethernet0 ip address 10.0.1.1 255.255.255.0 interface Async1 ip address 192.200.10.2 255.255.255.0 encapsulation ppp async default routing async mode dedicated dialer in-band dialer idle-timeout 60 dialer map ip 192.200.10.1 name Router1 dialer-group 1 ppp authentication chap ip route 10.0.0.0 255.255.255.0 192.200.10.1 dialer-list 1 protocol ip permit line con 0 34
line aux 0 modem InOut modem autoconfigure discovery flowcontrol hardware 相 关 调 试 命 令 : debug dialer debug ppp authentication debug ppp error debug ppp negotiation debug ppp packet show dialer 3. 异 步 拨 号 备 份 DDN 专 线 : c2522rb S0: 16.250.123.18/252 DDN 专 线 S0: 16.250.123.17/252 c4700 Async1: 16.249.123.18/252 PSTN Async1: 16.249.123.17/252 此 例 主 连 接 采 用 DDN 专 线, 备 份 线 路 为 电 话 拨 号 当 DDN 专 线 连 接 正 常 时, 主 端 口 S0 状 态 为 up,line protocol 亦 为 up, 则 备 份 线 路 状 态 为 standby,line protocol 为 down, 此 时 所 有 通 信 均 通 过 主 接 口 进 行 当 主 接 口 连 接 发 生 故 障 时, 端 口 状 态 为 down, 则 激 活 备 份 接 口, 完 成 数 据 通 信 此 方 法 不 适 合 为 X.25 做 备 份 因 为, 配 置 封 装 为 X.25 的 接 口 只 要 和 X.25 交 换 机 之 间 的 连 接 正 常 其 接 口 及 line protocol 的 状 态 亦 为 up, 它 并 不 考 虑 其 它 地 方 需 与 之 通 信 的 路 由 器 的 状 态 如 何, 所 以 若 本 地 路 由 器 状 态 正 常, 而 对 方 路 由 器 连 接 即 使 发 生 故 障, 本 地 也 不 会 激 活 备 份 线 路 例 4 将 会 描 述 如 何 为 X.25 做 拨 号 备 份 以 下 是 相 关 命 令 : 任 务 指 定 主 线 路 改 变 后, 次 线 路 状 态 发 生 改 变 的 延 迟 时 间 指 定 一 个 接 口 作 为 备 份 接 口 命 令 backup delay {enable-delay never} {disable-delay never} backup interface type number hostname c2522rb enable secret 5 $1$J5vn$ceYDe2FwPhrZi6qsIIz6g0 enable password cisco username c4700 password 0 cisco ip subnet-zero chat-script cisco-default "" "AT" TIMEOUT 30 OK "ATDT \T" TIMEOUT 30 CONNECT 35
\c chat-script reset atz interface Ethernet0 ip address 16.122.51.254 255.255.255.0 no ip mroute-cache interface Serial0 backup delay 10 10 backup interface Serial2 ip address 16.250.123.18 255.255.255.252 no ip mroute-cache no fair-queue interface Serial1 no ip address no ip mroute-cache shutdown interface Serial2 physical-layer async ip address 16.249.123.18 255.255.255.252 encapsulation ppp async mode dedicated dialer in-band dialer idle-timeout 60 dialer map ip 16.249.123.17 name c4700 6825179 dialer-group 1 ppp authentication chap interface Serial3 no ip address shutdown no cdp enable interface Serial4 no ip address shutdown no cdp enable interface Serial5 no ip address no ip mroute-cache shutdown 36
interface Serial6 no ip address no ip mroute-cache shutdown interface Serial7 no ip address no ip mroute-cache shutdown interface Serial8 no ip address no ip mroute-cache shutdown interface Serial9 no ip address no ip mroute-cache shutdown interface BRI0 no ip address no ip mroute-cache shutdown router eigrp 200 network 16.0.0.0 ip classless dialer-list 1 protocol ip permit line con 0 line 2 script dialer cisco-default script reset reset modem InOut modem autoconfigure discovery rxspeed 38400 txspeed 38400 flowcontrol hardware line aux 0 line vty 0 4 37
password cisco login end c2522rb# 4. 异 步 拨 号 备 份 X.25: Router1 x.121:10112227 10112227 S0:202.96.0.1/24 Async1: 202.96.1.1/252 X.25 PSTN x.121:10112225 S0:202.96.0.2/24 Async1: 202.96.1.2/252 Router2 设 置 X.25 的 拨 号 备 份, 首 先 X.25 连 接 的 端 口 必 须 运 行 动 态 路 由 协 议, 异 步 拨 号 口 必 须 使 用 静 态 路 由. 本 例 选 择 EIGRP 作 为 路 由 选 择 协 议, 将 静 态 路 由 的 Metric 的 值 设 置 为 200, 由 于 EIGRP 的 默 认 Metric 为 90, 所 以 当 同 时 有 两 条 路 径 通 往 同 一 网 段 时, 其 中 Metric 值 小 的 路 径 生 效, 而 当 X.25 连 接 出 现 问 题 时, 路 由 器 无 法 通 过 路 由 协 议 学 习 到 路 由 表, 则 此 时 静 态 路 由 生 效, 访 问 通 过 拨 号 端 口 实 现 当 X.25 连 接 恢 复 正 常 时, 路 由 器 又 可 以 学 习 到 路 由 表, 则 由 于 Metric 值 的 不 同, 静 态 路 由 自 动 被 动 态 路 由 所 代 替, 这 样 就 实 现 了 备 份 的 功 能 路 由 器 Router1 配 置 如 下 : \c hostname router1 enable secret 5 $1$UTvD$99YiY2XsRMxHudcYeHn.Y. enable password cisco username router2 password cisco ip subnet-zero chat-script cisco-default "" "AT" TIMEOUT 30 OK "ATDT \T" TIMEOUT 30 CONNECT chat-script reset atz interface Ethernet0 ip address 202.96.38.100 255.255.255.0 interface Serial0 ip address 202.96.0.1 255.255.255.0 encapsulation x25 x25 address 10112227 x25 htc 16 38
x25 map ip 202.96.0.2 10112225 broadcast interface Serial1 no ip address shutdown interface Async 1 ip address 202.96.1.1 255.255.255.252 encapsulation ppp dialer in-band dialer idle-timeout 60 dialer map ip 202.96.1.2 name router2 modem-script cisco-default 2113470 dialer-group 1 ppp authentication chap router eigrp 200 redistribute connected network 202.96.0.0 ip route 202.96.37.0 255.255.255.0 202.96.1.2 200 dialer-list 1 protocol ip permit line con 0 line aux 0 script dialer cisco-default script reset reset modem InOut modem autoconfigure discovery transport input all rxspeed 38400 txspeed 38400 flowcontrol hardware line vty 0 4 password cisco login end 路 由 器 Router2 配 置 如 下 : hostname router2 enable secret 5 $1$T4IU$2cIqak8f/E4Ug6dLT0k.J0 enable password cisco 39
\c username router1 password cisco ip subnet-zero chat-script cisco-default "" "AT" TIMEOUT 30 OK "ATDT \T" TIMEOUT 30 CONNECT chat-script reset atz interface Ethernet0 ip address 202.96.37.100 255.255.255.0 interface Serial0 ip address 202.96.0.2 255.255.255.0 no ip mroute-cache encapsulation x25 x25 address 10112225 x25 htc 16 x25 map ip 202.96.0.1 10112227 broadcast interface Serial1 no ip address shutdown interface Async1 ip address 202.96.1.2 255.255.255.252 encapsulation ppp keepalive 30 async default routing async mode dedicated dialer in-band dialer idle-timeout 60 dialer wait-for-carrier-time 120 dialer map ip 202.96.1.1 name router1 modem-script cisco-default 2113469 dialer-group 1 ppp authentication chap router eigrp 200 redistribute static network 202.96.0.0 no ip classless ip route 202.96.38.0 255.255.255.0 202.96.1.1 200 dialer-list 1 protocol ip permit line con 0 exec-timeout 0 0 40
line aux 0 script reset reset modem InOut modem autoconfigure discovery transport input all rxspeed 38400 txspeed 38400 flowcontrol hardware line vty 0 4 password cisco login end 41
第 三 章 路 由 协 议 设 置 一 RIP 协 议 RIP(Routing information Protocol) 是 应 用 较 早 使 用 较 普 遍 的 内 部 网 关 协 议 (Interior Gateway Protocol, 简 称 IGP), 适 用 于 小 型 同 类 网 络, 是 典 型 的 距 离 向 量 (distance-vector) 协 议 文 档 见 RFC1058 RFC1723 RIP 通 过 广 播 UDP 报 文 来 交 换 路 由 信 息, 每 30 秒 发 送 一 次 路 由 信 息 更 新 RIP 提 供 跳 跃 计 数 (hop count) 作 为 尺 度 来 衡 量 路 由 距 离, 跳 跃 计 数 是 一 个 包 到 达 目 标 所 必 须 经 过 的 路 由 器 的 数 目 如 果 到 相 同 目 标 有 二 个 不 等 速 或 不 同 带 宽 的 路 由 器, 但 跳 跃 计 数 相 同, 则 RIP 认 为 两 个 路 由 是 等 距 离 的 RIP 最 多 支 持 的 跳 数 为 15, 即 在 源 和 目 的 网 间 所 要 经 过 的 最 多 路 由 器 的 数 目 为 15, 跳 数 16 表 示 不 可 达 1. 有 关 命 令 (VLSMs) 任 务 命 令 指 定 使 用 RIP 协 议 router rip 指 定 RIP 版 本 version {1 2} 1 指 定 与 该 路 由 器 相 连 的 网 络 network network 注 :1.Cisco 的 RIP 版 本 2 支 持 验 证 密 钥 管 理 路 由 汇 总 无 类 域 间 路 由 (CIDR) 和 变 长 子 网 掩 码 2. 举 例 Router1 192.200.10.1 192.200.10.2 S0(DCE) E0:192.20.10.1 /24 S0(DTE) Router2 Router1: router rip version 2 network 192.200.10.0 network 192.20.10.0 相 关 调 试 命 令 : show ip protocol show ip route 42
二 IGRP 协 议 IGRP (Interior Gateway Routing Protocol) 是 一 种 动 态 距 离 向 量 路 由 协 议, 它 由 Cisco 公 司 八 十 年 代 中 期 设 计 使 用 组 合 用 户 配 置 尺 度, 包 括 延 迟 带 宽 可 靠 性 和 负 载 缺 省 情 况 下,IGRP 每 90 秒 发 送 一 次 路 由 更 新 广 播, 在 3 个 更 新 周 期 内 ( 即 270 秒 ), 没 有 从 路 由 中 的 第 一 个 路 由 器 接 收 到 更 新, 则 宣 布 路 由 不 可 访 问 在 7 个 更 新 周 期 即 630 秒 后,Cisco IOS 软 件 从 路 由 表 中 清 除 路 由 1. 有 关 命 令 任 务 命 令 指 定 使 用 RIP 协 议 router igrp autonomous-system 1 指 定 与 该 路 由 器 相 连 的 网 络 network network 指 定 与 该 路 由 器 相 邻 的 节 点 neighbor ip-address 地 址 注 :1 autonomous-system 可 以 随 意 建 立, 并 非 实 际 意 义 上 的 autonomous-system, 但 运 行 IGRP 的 路 由 器 要 想 交 换 路 由 更 新 信 息 其 autonomous-system 需 相 同 2. 举 例 Router1 192.200.10.1 192.200.10.2 S0(DCE) E0:192.20.10.1 /24 S0(DTE) Router2 Router1: router igrp 200 自 治 系 统 200 network 192.200.10.0 network 192.20.10.0 三 OSPF 协 议 OSPF(Open Shortest Path First) 是 一 个 内 部 网 关 协 议 (Interior Gateway Protocol, 简 称 IGP), 用 于 在 单 一 自 治 系 统 (autonomous system,as) 内 决 策 路 由 与 RIP 相 对,OSPF 是 链 路 状 态 路 有 协 议, 而 RIP 是 距 离 向 量 路 由 协 议 链 路 是 路 由 器 接 口 的 另 一 种 说 法, 因 此 OSPF 也 称 为 接 口 状 态 路 由 协 议 OSPF 通 过 路 由 器 之 间 通 告 网 络 接 口 的 状 态 来 建 立 链 路 状 态 数 据 库, 生 成 最 短 路 径 树, 每 个 OSPF 路 由 器 使 用 这 些 最 短 路 径 构 造 路 由 表 文 档 见 RFC2178 1. 有 关 命 令 43
全 局 设 置 任 务 命 令 指 定 使 用 OSPF 协 议 router ospf process-id 1 指 定 与 该 路 由 器 相 连 的 网 络 network address wildcard-mask area area-id 2 指 定 与 该 路 由 器 相 邻 的 节 点 neighbor ip-address 地 址 注 :1 OSPF 路 由 进 程 process-id 必 须 指 定 范 围 在 1-65535, 多 个 OSPF 进 程 可 以 在 同 一 个 路 由 器 上 配 置, 但 最 好 不 这 样 做 多 个 OSPF 进 程 需 要 多 个 OSPF 数 据 库 的 副 本, 必 须 运 行 多 个 最 短 路 径 算 法 的 副 本 process-id 只 在 路 由 器 内 部 起 作 用, 不 同 路 由 器 的 process-id 可 以 不 同 2 wildcard-mask 是 子 网 掩 码 的 反 码, 网 络 区 域 ID area-id 在 0-4294967295 内 的 十 进 制 数, 也 可 以 是 带 有 IP 地 址 格 式 的 x.x.x.x 当 网 络 区 域 ID 为 0 或 0.0.0.0 时 为 主 干 域 不 同 网 络 区 域 的 路 由 器 通 过 主 干 域 学 习 路 由 信 息 2. 基 本 配 置 举 例 : Router1 E0 192.1.0.129/26 S0: 192.200.10.5 /30 区 域 0 WAN S0: 192.200.10.6 /30 Router2 E0 192.1.0.65/26 E0 E0 区 域 1 192.1.0.130/26 区 域 2 192.1.0.66/26 Router3 Router4 Router1: interface ethernet 0 ip address 192.1.0.129 255.255.255.192 interface serial 0 ip address 192.200.10.5 255.255.255.252 router ospf 100 network 192.200.10.4 0.0.0.3 area 0 network 192.1.0.128 0.0.0.63 area 1 Router2: interface ethernet 0 ip address 192.1.0.65 255.255.255.192 interface serial 0 ip address 192.200.10.6 255.255.255.252 router ospf 200 network 192.200.10.4 0.0.0.3 area 0 network 192.1.0.64 0.0.0.63 area 2 44
Router3: interface ethernet 0 ip address 192.1.0.130 255.255.255.192 router ospf 300 network 192.1.0.128 0.0.0.63 area 1 Router4: interface ethernet 0 ip address 192.1.0.66 255.255.255.192 router ospf 400 network 192.1.0.64 0.0.0.63 area 1 相 关 调 试 命 令 : debug ip ospf events debug ip ospf packet show ip ospf show ip ospf database show ip ospf interface show ip ospf neighbor show ip route 3. 使 用 身 份 验 证 为 了 安 全 的 原 因, 我 们 可 以 在 相 同 OSPF 区 域 的 路 由 器 上 启 用 身 份 验 证 的 功 能, 只 有 经 过 身 份 验 证 的 同 一 区 域 的 路 由 器 才 能 互 相 通 告 路 由 信 息 在 默 认 情 况 下 OSPF 不 使 用 区 域 验 证 通 过 两 种 方 法 可 启 用 身 份 验 证 功 能, 纯 文 本 身 份 验 证 和 消 息 摘 要 (md5) 身 份 验 证 纯 文 本 身 份 验 证 传 送 的 身 份 验 证 口 令 为 纯 文 本, 它 会 被 网 络 探 测 器 确 定, 所 以 不 安 全, 不 建 议 使 用 而 消 息 摘 要 (md5) 身 份 验 证 在 传 输 身 份 验 证 口 令 前, 要 对 口 令 进 行 加 密, 所 以 一 般 建 议 使 用 此 种 方 法 进 行 身 份 验 证 使 用 身 份 验 证 时, 区 域 内 所 有 的 路 由 器 接 口 必 须 使 用 相 同 的 身 份 验 证 方 法 为 起 用 身 份 验 证, 必 须 在 路 由 器 接 口 配 置 模 式 下, 为 区 域 的 每 个 路 由 器 接 口 配 置 口 令 证 任 务 指 定 身 份 验 证 使 用 纯 文 本 身 份 验 证 使 用 消 息 摘 要 (md5) 身 份 验 命 令 area area-id authentication [message-digest] ip ospf authentication-key password ip ospf message-digest-key keyid md5 key 以 下 列 举 两 种 验 证 设 置 的 示 例, 示 例 的 网 络 分 布 及 地 址 分 配 环 境 与 以 上 基 本 配 置 举 例 相 同, 只 是 在 Router1 和 Router2 的 区 域 0 上 使 用 了 身 份 验 证 的 功 能 : 例 1. 使 用 纯 文 本 身 份 验 证 45
Router1: interface ethernet 0 ip address 192.1.0.129 255.255.255.192 interface serial 0 ip address 192.200.10.5 255.255.255.252 ip ospf authentication-key cisco router ospf 100 network 192.200.10.4 0.0.0.3 area 0 network 192.1.0.128 0.0.0.63 area 1 area 0 authentication Router2: interface ethernet 0 ip address 192.1.0.65 255.255.255.192 interface serial 0 ip address 192.200.10.6 255.255.255.252 ip ospf authentication-key cisco router ospf 200 network 192.200.10.4 0.0.0.3 area 0 network 192.1.0.64 0.0.0.63 area 2 area 0 authentication 例 2. 消 息 摘 要 (md5) 身 份 验 证 : Router1: interface ethernet 0 ip address 192.1.0.129 255.255.255.192 interface serial 0 ip address 192.200.10.5 255.255.255.252 ip ospf message-digest-key 1 md5 cisco router ospf 100 network 192.200.10.4 0.0.0.3 area 0 network 192.1.0.128 0.0.0.63 area 1 area 0 authentication message-digest 46
Router2: interface ethernet 0 ip address 192.1.0.65 255.255.255.192 interface serial 0 ip address 192.200.10.6 255.255.255.252 ip ospf message-digest-key 1 md5 cisco router ospf 200 network 192.200.10.4 0.0.0.3 area 0 network 192.1.0.64 0.0.0.63 area 2 area 0 authentication message-digest 相 关 调 试 命 令 : debug ip ospf adj debug ip ospf events 四 重 新 分 配 路 由 在 实 际 工 作 中, 我 们 会 遇 到 使 用 多 个 IP 路 由 协 议 的 网 络 为 了 使 整 个 网 络 正 常 地 工 作, 必 须 在 多 个 路 由 协 议 之 间 进 行 成 功 的 路 由 再 分 配 以 下 列 举 了 OSPF 与 RIP 之 间 重 新 分 配 路 由 的 设 置 范 例 : Router1 E0 192.168.1.1/24 S0: 192.200.10.5 /30 ospf WAN S0: 192.200.10.6 /30 Router2 E0 192.168.0.2/24 rip 2 E0 192.168.1.2/24 Router3 E0 192.168.0.1/24 Router4 static E1 192.168.2.1/24 Router1 的 Serial 0 端 口 和 Router2 的 Serial 0 端 口 运 行 OSPF, 在 Router1 的 Ethernet 0 端 口 运 行 RIP 2, Router3 运 行 RIP2, Router2 有 指 向 Router4 的 192.168.2.0/24 网 的 静 态 路 由,Router4 使 用 默 认 静 态 路 由 需 要 在 Router1 和 Router3 之 间 重 新 分 配 OSPF 和 RIP 路 由, 在 Router2 上 重 新 分 配 静 态 路 由 和 直 连 的 路 由 范 例 所 涉 及 的 命 令 任 务 重 新 分 配 直 连 的 路 由 重 新 分 配 静 态 路 由 命 令 redistribute connected redistribute static 47