Packet Tracer实验集

Similar documents
路由器基本配置

Cisco Cisco Cisco (ROM) (FLASH) (RAM) RAM(NVRAM) Cisco

ch08.PDF

通过动态路由协议实现链路备份

D E 答 案 :C 3. 工 作 站 A 配 置 的 IP 地 址 为 /28. 工 作 站 B 配 置 的 IP 地 址 为 /28. 两 个 工 作 站 之 间 有 直 通 线 连 接, 两 台

Microsoft Word - chp21路由优化.doc

Microsoft Word - chp20路由重分布.doc

IP505SM_manual_cn.doc

epub

幻灯片 1

IP-Routing-05.pdf

Simulator By SunLingxi 2003

mppp-ddr.pdf

¶C¶L§§¬_™¨ A.PDF

<4D F736F F D CAB5D1E9CDD8C6CBA1A2D6D5B6CBB7FECEF1C6F7C5E4D6C32E646F63>

AL-M200 Series

active phisical rp address: backup phisical rp address: 截取部分 TOPO 图说明到 不通的问题 : internet internet tengige 0/0/0/0 tengige

计算机网络 实验指导书 / 实验四 : 动态路由协议 实验四 : 动态路由协议 一 实验目的 1 进一步理解路由器的工作原理; 2 掌握 RIP 的基本原理和实现 ; 3 掌握 OSPF 的基本原理和实现 二 实验学时 2 学时 三 实验类型 综合性 四 实验需求 1 硬件每人配备计算机 1 台 2

Microsoft Word - chp3静态路由.doc

TCP/IP TCP/IP OSI IP TCP IP IP TCP/IP TCP/IP

版权声明

Microsoft Word - CCNA2_Exploration_instructor_40_CoverSheet.DOC

ebook140-8

F5270

12.pdf

User ID 150 Password - User ID 150 Password Mon- Cam-- Invalid Terminal Mode No User Terminal Mode No User Mon- Cam-- 2

Microsoft Word - vlsm and ip unnumbered.doc

CCNA 講義

工程师培训

计算机网络概论

09.实验九:内部网关协议RIP与OSPF

ebook140-9

<4D F736F F D C2B7D3C9C6F7BBF9B1BEC5E4D6C32E646F63>

IS-IS路由协议中文教程v1

財金資訊-80期.indd

ebook20-7

R3105+ ADSL

目录 目录... I BOSON NETSIM 入门进阶 实战 BOSON NETSIM 基本实验 路由器基本实验 - 静态路由 缺省路由配置 交换机基本实验 -VLAN VTP TRUNK 远程访问基本实验 -PPP CHAP...11

Symantec™ Sygate Enterprise Protection 防护代理安装使用指南

Procedural Lab Template, Student Version, Required Components

指定静态路由的下一跳IP地址

一.NETGEAR VPN防火墙产品介绍

一、选择题

ARP ICMP

Chapter #

IP Access Lists IP Access Lists IP Access Lists

ebook20-8

ebook140-11

Bus Hound 5

SL2511 SR Plus 操作手冊_單面.doc

动态路由选择协议、RIP

ebook71-13

P4i45GL_GV-R50-CN.p65

第3章

Microsoft Word - CCNA Lab Exercise Guide.doc

untitled

Windows RTEMS 1 Danilliu MMI TCP/IP QEMU i386 QEMU ARM POWERPC i386 IPC PC104 uc/os-ii uc/os MMI TCP/IP i386 PORT Linux ecos Linux ecos ecos eco

1 1 2 OSPF RIP 2

(UTM???U_935_938_955_958_959 V )

AL-MX200 Series

目录 简介... 3 BGP 重发布进 OSPF 环境拓扑图... 3 BGP 重发布进 OSPF 路由过滤... 4 FGT200B 关键配置... 4 接口 IP 配置... 4 Route-Map... 4 BGP 的配置... 5 FGT100E 关键配置... 5 接口 IP 及 BGP

IC-900W Wireless Pan & Tilt Wireless Pan & Tilt Remote Control / Night Vision FCC ID:RUJ-LR802UWG


NSC-161

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

Chapter 2

Serial ATA ( Silicon Image SiI3114)...2 (1) SATA... 2 (2) B I O S S A T A... 3 (3) RAID BIOS RAID... 5 (4) S A T A... 8 (5) S A T A... 10

飞鱼星多WAN防火墙路由器用户手册

Microsoft PowerPoint - Aqua-Sim.pptx

EK-STM32F

課程大綱

基于点到点链路的 OSPF 的初始配置

DOS下常用的网络命令.PDF

PTS7_Manual.PDF

Microsoft Word - chp22.doc

第 1 章 实验拓扑 终端服务器配置 访问 Cisco 路由器的方法 通过 Console 口访问路由器 通过 Telnet 访问路由器 终端访问服务器 本书实验拓扑 实验 1: 通过 Console 口访问路由


Cadence SPB 15.2 VOICE Cadence SPB 15.2 PC Cadence 3 (1) CD1 1of 2 (2) CD2 2of 2 (3) CD3 Concept HDL 1of 1

Microsoft Word - chp11NAT.doc

GPRS IP MODEM快速安装说明

SAPIDO GR-1733 無線寬頻分享器

FortiGate-v5.2-PPPOE 拨号协商时的 AC-name 和 Service-name 版本 1.0 时间 2015 年 3 月 支持的版本 FortiOS v5.2.x 作者 黄豪赫 状态 已审核 反馈

自由軟體教學平台

QL1880new2.PDF

局域网技术课程设计报告.doc

RAID RAID 0 RAID 1 RAID 5 RAID * ( -1)* ( /2)* No Yes Yes Yes A. B. BIOS SATA C. RAID BIOS RAID ( ) D. SATA RAID/AHCI ( ) SATA M.2 SSD ( )

计算机网络 实验指导书 / 实验三 : 使用路由器组网 实验三 : 使用路由器组网 一 实验目的 1 理解路由器的基本工作原理; 2 掌握路由器的基本管理和配置方法; 3 理解路由组网的方法和静态路由的具体使用; 4 理解基于路由器的园区网的结构, 并进一步体会园区网的设计思路 二 实验学时 2 学

自由軟體教學平台

中国计算机软件专业技术资格和水平考试

Olav Lundström MicroSCADA Pro Marketing & Sales 2005 ABB - 1-1MRS755673

动态路由选择协议、RIP

管理CISCO IOS

地址分配表 设备 接口 IP 地址 子网掩码 默认网关 WEST G0/ N/A S0/0/0 (DCE) N/A Tunnel N/A I

Microsoft Word - chp19IS-IS.doc

《计算机网络》实验指导书

ChinaITLab 网校名师原创作品系列 版权所有, 盗版必究 目录 目录... I BOSON NETSIM 入门进阶 实战 BOSON NETSIM 基本实验 路由器基本实验 - 静态路由 缺省路由配置 交换机基本实验 -VLAN VTP TRUNK

第2章 路由器基本配置

KillTest 质量更高 服务更好 学习资料 半年免费更新服务

2 2 3 DLight CPU I/O DLight Oracle Solaris (DTrace) C/C++ Solaris DLight DTrace DLight DLight DLight C C++ Fortran CPU I/O DLight AM

Transcription:

Packet Tracer 1 实验集 Packet Tracer 实验集 姚俊编著

目 录 目 录 第一部分路由器实验... 1 实验 1-1. 路由器的 console 口访问配置... 1 实验 1-2. 路由器的 telnet 访问配置... 5 实验 1-3. CLI 的使用与 IOS 基本命令...8 实验 1-4. 配置文件的管理和 IOS 的管理... 15 实验 1-5. 密码恢复和 IOS 的恢复... 18 实验 1-6. CDP 配置...21 实验 1-7. 带下一跳地址的静态路由... 24 实验 1-8. 带送出接口的静态路由... 28 实验 1-9. 浮动静态路由... 32 实验 1-10. RIPv1 基本配置...35 实验 1-11. 不连续网络配置及其解决方案... 40 实验 1-12. 被动接口与单播更新... 45 实验 1-13. RIPv2 基本配置...47 实验 1-14. 向 RIP 网络中注入默认路由... 51 实验 1-15. EIGRP 基本配置...55 实验 1-16. EIGRP 负载均衡...62 实验 1-17. 向 EIGRP 网络中注入默认路由... 66 实验 1-18. 点到点链路上的 OSPF...70 实验 1-19. 基于区域的 OSPF 简单口令认证... 76 实验 1-20. 基于区域的 OSPF MD5 认证... 79 实验 1-21. default-information originate... 82 I

目 录 实验 1-22. 多区域 OSPF 基本配置... 85 实验 1-23. OSPF 末节区域和完全末节区域...92 实验 1-24. OSPF NSSA 区域... 97 第二部分交换机实验... 103 实验 2-1. 交换机基本配置... 103 实验 2-2. 交换机端口安全... 109 实验 2-3. 划分 VLAN...112 实验 2-4. Trunk 配置...117 实验 2-5. Voice VLAN 配置...121 实验 2-6. DTP 的配置...125 实验 2-7. EtherChannel 配置...127 实验 2-8. VTP 配置...131 实验 2-9. VLAN 信息覆盖...139 实验 2-10. STP PVST 配置...143 实验 2-11. RSTP... 149 实验 2-12. STP 保护...151 实验 2-13. 单臂路由实现 VLAN 间路由... 153 实验 2-14. 三层交换机实现 VLAN 间路由... 155 实验 2-15. HDLC 和 PPP 封装...157 实验 2-16. PAP 验证...159 实验 2-17. CHAP 验证...160 实验 2-18. 帧中继基本配置... 161 实验 2-19. 帧中继多点子接口配置 OSPF...166 实验 2-20. 帧中继点到点子接口下配置 OSPF...169 实验 2-21. 路由器的访问安全... 173 II

目 录 实验 2-22. 路由器日志... 177 实验 2-23. 标准 ACL...179 实验 2-24. 扩展 ACL...184 实验 2-25. 通过 ADSL 连接到 Internet( 使用 ADSL Modem)... 187 实验 2-26. GRE Tunnel... 189 实验 2-27. DHCP 配置...193 实验 2-28. 静态 NAT 配置... 196 实验 2-29. 动态 NAT 配置... 198 实验 2-30. NAT 过载配置...200 第三部分无线网实验... 203 实验 3-1. WRT300N 无线路由器配置...203 实验 3-2. IPv6 静态路由配置...209 实验 3-3. IPv6 的 RIPng 配置...212 第四部分扩展性实验... 215 实验 4-1. Easy VPN 实验指南...215 实验 4-2. 最真实的模拟 VPN 综合实验... 219 实验 4-3. 交换机和路由器的维护实验... 225 实验 4-4. SNMP 实验指南...230 实验 4-5. 基于 AAA 的 Easy VPN 实验... 234 实验 4-6. GRE 实验 ( 一 )...239 第五部分综合性实验... 245 实验 5-1. 综合实验 1...245 实验 5-2. CCNA 大综合实验...253 III

第一部分 路由器实验 第一部分 路由器实验 实验 1-1. 路由器的 console 口访问配置 一 实验目的 ( 一 ) 计算机的串口和路由器 console 口的连接方法 ; ( 二 ) 使用 windows 系统自带的超级终端软件配置路由器 ; ( 三 ) 路由器的开机过程 二 实验拓扑 三 实验步骤 (1) 准备工作用 Roll Over 线连接好计算机 COM1 口和路由器的 Console 口, 路由器开机 (2) 打开超级终端在 windows 中的 开始 程序 附件 通信 菜单下打开 超级终端, 根据一系列提示后, 出现图 1-1 超级终端窗口 在 名称 对话框中输入一个名称, 例如 :Router; 单 1

第一部分 路由器实验 击 确定 按钮. 出现 1-2 窗口时, 在 连接时使用 下拉菜单 中选择计算机的 COM1 口, 单击 确定 按钮 图 1-1 超级终端窗口图 1-2 选择 COM 口 (3) 设置通信参数 通信参数设置如图所示 : 图 1-3 设置通信参数 (4) 观察路由器开机过程 关闭路由器电源, 稍后重新打开电源, 开机过程, 如下 : System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1) // 显示 Boot Rom 的版本 Copyright (c) 2000 by cisco Systems, Inc. 2

第一部分 路由器实验 cisco 2811 (MPC860) processor (revision 0x200) with 60416K/5120K bytes of memory // 显示路由器内存大小 Self decompressing the image : ##################################################################### ##### [OK] Restricted Rights Legend // 以上是 IOS 解压过程 Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013. cisco Systems, Inc. 170 West Tasman Drive San Jose, California 95134-1706 Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2) you unable // 以上是 IOS 的版本信息 Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2007 by Cisco Systems, Inc. Compiled Wed 18-Jul-07 06:21 by pt_rel_team Image text-base: 0x400A925C, data-base: 0x4372CE20 This product contains cryptographic features and is subject to United States and local country laws governing import, export, transfer and use. Delivery of Cisco cryptographic products does not imply third-party authority to import, export, distribute or use encryption. Importers, exporters, distributors and users are responsible for compliance with U.S. and local country laws. By using this product agree to comply with applicable laws and regulations. If you are to comply with U.S. and local laws, return this product immediately. A summary of U.S. laws governing Cisco cryptographic products may be found at: http://www.cisco.com/wwl/export/crypto/tool/stqrg.html If you require further assistance please contact us by sending email to export@cisco.com. cisco 2811 (MPC860) processor (revision 0x200) with 60416K/5120K bytes of memory // 显示路由器的内存大小 3

第一部分 路由器实验 Processor board ID JAD05190MTZ (4292891495) // 处理器板的编号 M860 processor: part number 0, mask 49 2 FastEthernet/IEEE 802.3 interface(s) // 该路由器有 2 个快速以太网接口 239K bytes of non-volatile configuration memory. // 该路由器有 239kB 的 nvram 62720K bytes of // 该路由器有 64MB 的 flash 卡 ATA CompactFlash (Read/Write) --- System Configuration Dialog --- Continue with configuration dialog? [yes/no]: // 提示是否进入配置对话模式? 我们回答 n 介绍命令行模式 4

第一部分 路由器实验 实验 1-2. 路由器的 telnet 访问配置 一 实验目的 ( 一 ) 路由器的用户模式和特权模式的使用 ; ( 二 ) 配置路由器以太网接口的 IP 地址, 并打开接口 ; ( 三 ) 配置路由器的 enable 秘密密码和 vty 密码 ; ( 四 )Telnet 程序的使用 二 实验拓扑 三 实验步骤 (1) 配置路由器以太网接口 IP 地址 --- System Configuration Dialog --- Continue with configuration dialog? [yes/no]: no Press RETURN to get started! Router>enable // 进入路由器的特权模式 Router#configure terminal // 进入路由器的全局配置模式 Enter configuration commands, one per line. Router(config)#interface fastethernet 0/0 End with CNTL/Z. // 进入路由器的以太网口 fastethernet0/0 接口,fastethernet 表示快速以太网,0/0 表示是第 0 个插槽中的第 0 个接口,Serial0/0/0 则表示为第 0 个插槽中的第 0 个模块上的第 0 个串行接口 址 Router(config-if)#ip address 172.16.0.1 255.255.255.0 // 配置接口的 IP 地 Router(config-if)#no shut // 打开接口, 默认时, 路由器的所有接口是关闭的, 交换机的所有接口是打开的 5

第一部分 路由器实验 %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up Router(config-if)#end Router# (2) 配置路由器密码 Router#configure terminal Enter configuration commands, one per line. // 退到全局配置模式, 回到特权模式下 End with CNTL/Z. Router(config)#line vty 0 4 // 进入路由器的 VTY 虚拟终端, vty 0 4 表示 vty 0~vty 4, 共 5 个虚拟终端 Router(config-line)#password CISCO Router(config-line)#login Router(config-line)#exit Router(config)#enable password CISCO Router(config)#end (3) 通过 Telnet 访问路由器 // 配置 vty 的密码, 即 Telnet 密码 // 回到上一级模式下 // 配置特权密码 如图 2-1, 在计算机上配置 IP 地址为 172.16.0.100/24, 并 打开 DOS 命令行窗口测试计算机和路由器的连通性, 及 Telnet 远程登录 单击 : PC Desktop IP configuration, 在弹出 的对话框中, 设置 IP address : 172.16.0.100, subnet mask:255.255.255.0 loss), PC>ping 172.16.0.1 Pinging 172.16.0.1 with 32 bytes of data: Reply from 172.16.0.1: bytes=32 time=157ms TTL=255 Reply from 172.16.0.1: bytes=32 time=63ms TTL=255 Reply from 172.16.0.1: bytes=32 time=63ms TTL=255 Reply from 172.16.0.1: bytes=32 time=62ms TTL=255 Ping statistics for 172.16.0.1: Packets: Sent = 4, Received = 4, Lost = 0 (0% Approximate round trip times in milli-seconds: Minimum = 62ms, Maximum = 157ms, Average = 86ms PC>telnet 172.16.0.1 Trying 172.16.0.1...Open User Access Verification 6

第一部分 路由器实验 Password: Router>e nable Password: Router# // 输入 vty 的密码 CISCO, 输入 enable 密码 CISCO, 能正常进入路由器的特权模式 密码处于隐藏模式, 是看不见的 图 2-1 设置 IP 地址和子网掩码 7

第一部分 路由器实验 实验 1-3.CLI 的使用与 IOS 基本命令 一 实验目的 ( 一 ) 路由器 CLI 的各种模式 ( 二 ) 路由器 CLI 各种编辑命令 ( 三 ) 路由器密码的配置 ( 四 ) 路由器的 IOS 基本命令 ( 五 ) 查看路由器的有关信息二 实验拓扑 三 实验步骤 ( 一 ) 用户模式和特权模式的切换 Router>enable Router#disable Router> // Router 是路由器的名字, 而 > 代表在用户模式 enable 命令可以使路由器从用户模式进入到特权模式, disable 命令则相反, 在特区模式下提示符为 # ( 二 )? 和 Tab 键的使用 Router>enable Router#clok Translating "clok"...domain server (0.0.0.0) % Unknown command or computer name, or unable to find computer address // 以上表明输入了错误的命令 Router#cl? clear clock // 列出了以 cl 开头的所有命令 8

第一部分 路由器实验 格式 Router#clock % Incomplete command. // 提示命令输入不完整 Router#clock? set Set the time and date Router#clock set? hh:mm:ss Current Time Router#clock set 11:36:00 % Incomplete command. Router#clock set 11:36:00? <1-31> Day of the month MONTH Month of the year Router#clock set 11:36:00 2? MONTH Month of the year // 使用了? 帮助命令, 获得 clock 命令的 Router#clock set 11:36:00 2 1 ^ % Invalid input detected at '^' marker. // 提示输入了无效的参数, 并用 ^ 指示错误的所在 Router#clock set 11:36:00 2 jan % Incomplete command. Router#clock set 11:36:00 2 jan 2009 Router#show clock *11:36:4.297 UTC????? 2 2009 Router#disable Router>en Router#dis % Ambiguous command: "dis" Router#dis? // 命令是可以缩写的, 以上 en 等同于 enable disable disconnect // 以 dis 开头的有两个无法区分出来 Router>en Tab Router>enable Router#conf Tab Router#configure t Tab Router#configure terminal ( 三 )IOS 编辑命令与历史命令缓存大小 Router#show history // 显示历史命令 Router#terminal history size 50 // 把缓存的历史命令数改为 50 ( 四 ) 基本 IOS 命令 配置路由器 R1: Router>ena Router#conf t Enter configuration commands, one per line. End with CNTL/Z. 9

第一部分 路由器实验 太网口 Router(config)#hostname R1 R1(config)#interface fastethernet 0/0 // 配置路由器的主机名为 R1, 设置立即生效 // 进入到接口配置模式, 这里是百兆以 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 // 配置 IP 地址 172.16.1.1, 子网掩码 255.255.255.0 R1(config-if)#speed 100 ( 做该实验时, 记得在 pc 上更改其双工模式 ) R1(config-if)#duplex full // 配置以太网口的速率和全双工状态, 默认时都是自适应的 R1(config-if)#no shut // 开启以太网口 R1(config-if)#exit // 返回到上一级模式 R1(config)#interface serial0/0/0 // 进入到串行接口配置模式 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#end R1#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] R1#show ip interface brief // 串行接口配置 IP 地址 // 介绍配置直接回到特权模式下 Interface IP-Address OK? Method Status Protocol FastEthernet0/0 172.16.1.1 YES manual up up FastEthernet0/1 unassigned YES manual administratively down down Serial0/0/0 172.16.12.1 YES manual down down Serial0/0/1 unassigned YES manual administratively down down Vlan1 unassigned YES manual administratively down down // 显示各个接口上的 IP 地址, 简要状态 配置路由器 R2: Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#hostname R2 R2(config)#enable password cisco R2(config)#int f0/0 R2(config-if)#ip addr 172.16.2.2 255.255.255.0 R2(config-if)#no shut R2(config-if)#exit R2(config)#inter s0/0/0 R2(config-if)#no shut R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#description Connect to R1 // 标注一些信息, 方便阅读配置文件, 不影响接口的功能 R2(config-if)#end End with CNTL/Z. 10

第一部分 路由器实验 R2#copy r s Destination filename [startup-config]? Building configuration... [OK] R2#ping 172.16.12.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.12.1, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 31/37/62 ms // 可以 ping 通 R1 的串行接口 ( 五 ) 各种 show 命令 R2#show version Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2) //IOS 版本信息 Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2007 by Cisco Systems, Inc. Compiled Wed 18-Jul-07 06:21 by pt_rel_team ROM: System Bootstrap, Version 12.1(3r)T2, RELEASE SOFTWARE (fc1) //ROM 版本信息 Copyright (c) 2000 by cisco Systems, Inc. System returned to ROM by power-on // 显示路由器是如何启动的 System image file is "c2800nm-advipservicesk9-mz.124-15.t1.bin" // 当前正在使用的 IOS 文件名 cisco 2811 (MPC860) processor (revision 0x200) with 60416K/5120K bytes of memory // 路由型号和 RAM 大小 Processor board ID JAD05190MTZ (4292891495) // 处理器版系列号 M860 processor: part number 0, mask 49 2 FastEthernet/IEEE 802.3 interface(s) 2 Low-speed serial(sync/async) network interface(s) // 路由器的接口的类型和数量 239K bytes of NVRAM. 62720K bytes of processor board System flash (Read/Write) Configuration register is 0x2102 // 配置寄存器的值 R2#show running-config Building configuration... Current configuration : 675 bytes version 12.4 no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption 11

第一部分 路由器实验 hostname R2 enable password cisco! interface FastEthernet0/0 ip address 172.16.2.2 255.255.255.0 duplex auto speed auto interface Serial0/0/0! description Connect to R1 ip address 172.16.12.2 255.255.255.0 clock rate 128000 // 显示路由器正在使用的配置文件 R2#show startup-config Using 675 bytes version 12.4 no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption hostname R2 enable password cisco // 显示路由 NVRAM 中的配置文件 R2#show interface s0/0/0 Serial0/0/0 is up, line protocol is up (connected) // 接口的状态 Hardware is HD64570 Description: Connect to R1 Internet address is 172.16.12.2/24 // 接口的 IP 地址 MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, reliability 255/255, txload 1/255, rxload 1/255 // 以上是该接口的 MTU 带宽 延时 可靠性及负载大小 Encapsulation HDLC, loopback not set, keepalive set (10 sec) // 封装 HDLC 类型协议 R2#show ip interface FastEthernet0/0 is up, line protocol is up (connected) Internet address is 172.16.2.2/24 Broadcast address is 255.255.255.255 Address determined by setup command MTU is 1500 // 显示接口上的 IPv4 详细信息 12

第一部分 路由器实验 R2#show flash System flash directory: File Length Name/status 3 50938004 c2800nm-advipservicesk9-mz.124-15.t1.bin 2 28282 sigdef-category.xml 1 227537 sigdef-default.xml [51193823 bytes used, 12822561 available, 64016384 total] 63488K bytes of processor board System flash (Read/Write) // 以上显示了 Flash 中存放的 IOS 文件名 文件大小 Flash 的总大小及可用空间 R2#show controllers s0/0/0 Interface Serial0/0/0 Hardware is PowerQUICC MPC860 DCE V.35, clock rate 128000 idb at 0x81081AC4, driver data structure at 0x81084AC0 // 显示 s0/0/0 接口为 V.35 接口且为 DCE, 配置时钟为 128000bps R2#show ip arp Protocol Address Age (min) Hardware Addr Type Interface Internet 172.16.2.2-0030.F2EB.B501 ARPA FastEthernet0/0 R2#show arp Protocol Address Age (min) Hardware Addr Type Interface Internet 172.16.2.2-0030.F2EB.B501 ARPA FastEthernet0/0 // 显示路由器缓存的 ARP 表 ( 六 ) 密码的配置和标语的配置 R1(config)#enable password cisco R1(config)#enable secret 12345 码生效 ) R1#show r Building configuration...!! enable secret 5 $1$mERr$/Q/mbs3O9oHsKR7rNG4e81 enable password cisco! R1(config)#service password-encryption R1(config)#enable password cisco R1(config)#do show r Building configuration...! // 设置了从用户模式进入特权模式的明文密码 // 设置了从用户模式进入特权模式的密文密码 ( 此密 // 打开密码加密服务 13

第一部分 路由器实验 enable secret 5 $1$mERr$/Q/mbs3O9oHsKR7rNG4e81 enable password 7 0822455D0A16!! R1(config)#line vty 0 4 R1(config-line)#password cisco R1(config-line)#login R1(config-line)#exit R1(config)#banner motd # Enter TEXT message. End with the character '#'. --------------------------------------- Without authorization, shall not be visited --------------------------------------- # // 以上配置标语信息, 提醒用户不得非法访问, 该信息在用户登录前就会提示 R2#telnet 172.16.12.1 Trying 172.16.12.1...Open --------------------------------------- Without authorization, shall not be visited --------------------------------------- // 提示的标语信息 User Access Verification Password: cisco R1>enable Password: 12345 R1# ( 七 ) 测试连通性 略 14

第一部分 路由器实验 实验 1-4. 配置文件的管理和 IOS 的管理 一 实验目的 ( 一 )TFTP 服务器的使用 ; ( 二 ) 如何备份路由器的配置文件 ; ( 三 ) 如何备份路由器的 IOS; ( 四 ) 如何恢复配置文件 ; 二 实验拓扑 三 实验步骤 ( 一 ) 路由器和计算机间的 IP 可达 Router>ena Router#conf t Router(config)#int f0/0 Router(config-if)#ip addr 172.16.0.1 255.255.255.0 Router(config-if)#no shut Router(config-if)#end Router#ping 172.16.0.100 Type escape sequence to abort. // 配置 IP 地址 // 启用接口 Sending 5, 100-byte ICMP Echos to 172.16.0.100, timeout is 2 seconds:.!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 62/62/63 ms ( 二 ) 备份配置文件到 TFTP 服务器 Router#copy running-config tftp: 15

第一部分 路由器实验 // 把文件中的配置文件备份到 TFTP 服务器上 Address or name of remote host []? 172.16.0.100 // 回答 TFTP 服务器的 IP 地址 Destination filename [Router-confg]?!! [OK - 462 bytes] // 默认时 路由器名 -config 462 bytes copied in 0.125 secs (3000 bytes/sec) ( 三 ) 采用 复制 粘贴 备份配置文件 先在终端窗口中, 执行 show running-config 显示当前的配置, 在终端窗口中复制全 部配置, 粘贴到文本文件中 ( 四 ) 备份配置 IOS 到 TFTP 服务器 Router#show flash: System flash directory: File Length Name/status 3 50938004 c2800nm-advipservicesk9-mz.124-15.t1.bin 2 28282 sigdef-category.xml 1 227537 sigdef-default.xml [51193823 bytes used, 12822561 available, 64016384 total] 63488K bytes of processor board System flash (Read/Write) Router#copy flash: tftp // 把 IOS 备份到 TFTP 服务器上 Source filename []? c2800nm-advipservicesk9-mz.124-15.t1.bin Address or name of remote host []? 172.16.0.100 Destination filename [c2800nm-advipservicesk9-mz.124-15.t1.bin]?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 省略 [OK - 50938004 bytes] 50938004 bytes copied in 58.281 secs (874000 bytes/sec) ( 五 ) 恢复配置文件到路由器方法一 在 config 模式下, 把原有的配置文件粘贴进来, 并手动打开接口 ( 六 ) 恢复配置文件到路由器方法二 Router#copy tftp: flash: Address or name of remote host []? 172.16.0.100 Source filename []? c2800nm-advipservicesk9-mz.124-15.t1.bin //TFTP 服务器的 IP 地址 Destination filename [c2800nm-advipservicesk9-mz.124-15.t1.bin]? %Warning:There is a file already existing with this name Do you want to over write? [confirm] //IOS 文件名 // 警告 : 要覆盖 flash 上的原有的 IOS Accessing tftp://172.16.0.100/c2800nm-advipservicesk9-mz.124-15.t1.bin... Erase flash: before copying? [confirm] // 警告 : 要删除 Flash 上的数据 16

第一部分 路由器实验 Erasing the flash filesystem will remove all files! Continue? [confirm] Erasing device... eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee...erased Erase of flash: complete // 删除了 Flash 上的数据 Accessing tftp://172.16.0.100/c2800nm-advipservicesk9-mz.124-15.t1.bin... Loading c2800nm-advipservicesk9-mz.124-15.t1.bin from 172.16.0.100:!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 省略 // 检验完毕 [OK - 50938004 bytes] // 文件下载完毕 50938004 bytes copied in 57.703 secs (64006 bytes/sec) 17

第一部分 路由器实验 实验 1-5. 密码恢复和 IOS 的恢复 一 实验目的 ( 一 ) 路由器的密码恢复步骤 ( 二 ) 路由器的 IOS 恢复步骤二 实验拓扑 三 实验步骤 ( 一 ) 在路由器上配置密码 Router> Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#hostname R1 R1(config)#enable password 309nasfdndf12 // 故意配置一个复杂的密码 R1#copy running-config startup-config End with CNTL/Z. ( 二 ) 路由器密码恢复 关闭路由器电源并重新加电, 当控制台出现路由器的启动过程, 按 ctrl+break 中断启动, 进入 rommon 模式 R1(config)#System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1) Cisco 1841 (revision 5.0) with 114688K/16384K bytes of memory. Self decompressing the image : ############# monitor: command "boot" aborted due to user interrupt rommon 1 >? boot confreg boot up an external process configuration register utility 18

第一部分 路由器实验 dir list files in file system help monitor builtin command help reset system reset set display the monitor variables tftpdnld tftp image download unset unset a monitor variable rommon 2 > confreg 0x2142 // 改变配置寄存器的值为 0x2142 rommon 3 > reset // 重启路由器 Router>ena Router#copy startup-config running-config Destination filename [running-config]? 501 bytes copied in 0.416 secs (1204 bytes/sec) // 把配置文件从 NVRAM 中复制到 RAM 中, 在此基础上修改密码, 这样原有的配置还在 R1#conf t Enter configuration commands, one per line. R1(config)#enable secret cisco R1(config)#config-register 0x2102 R1#copy r s Destination filename [startup-config]? Building configuration... [OK] End with CNTL/Z. // 把密码修改为自己的密码 // 保持配置, 重启路由器, 检查路由器是否正常 需手动开启各个接口 ( 三 ) 故意删除 flash 中的 IOS R1#show flash: System flash directory: File Length Name/status // 把寄存器的值改为正常的 0x2102 // 显示 Flash 中的文件 (IOS) 3 33591768 c1841-advipservicesk9-mz.124-15.t1.bin 2 28282 sigdef-category.xml 1 227537 sigdef-default.xml [33847587 bytes used, 30168797 available, 64016384 total] 63488K bytes of processor board System flash (Read/Write) R1#delete flash:c1841-advipservicesk9-mz.124-15.t1.bin Delete filename [c1841-advipservicesk9-mz.124-15.t1.bin]? Delete flash:/c1841-advipservicesk9-mz.124-15.t1.bin? [confirm] // 以上删除模拟 flash 中 IOS 的丢失或者升级失败 ( 四 ) 恢复 IOS rommon 1 >? boot confreg dir boot up an external process configuration register utility list files in file system 19

第一部分 路由器实验 help reset set tftpdnld monitor builtin command help system reset display the monitor variables tftp image download unset unset a monitor variable rommon 2 > ip_address=172.16.0.1 rommon 3 > ip_subnet_mask=255.255.255.0 rommon 4 > default_gateway=172.16.0.100 rommon 5 > tftp_server=172.16.0.100 rommon 6 > tftp_file=c1841-advipservicesk9-mz.124-15.t1.bin rommon 7 > tftpdnld 20

第一部分 路由器实验 实验 1-6.CDP 配置 一 实验目的 ( 一 )CDP 的配置 ( 二 ) 如何使用 CDP 协议发现网络拓扑二 实验拓扑 三 实验步骤 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1(config)#int f0/0 R1(config-if)#no shut R1(config-if)#int s0/0/0 R1 R1(config-if)#no shutdown End with CNTL/Z. Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int f0/0 R2(config-if)#no shut R2(config-if)#int s0/0/0 R2(config-if)#no shut R2(config-if)#clock rate 128000 End with CNTL/Z. // 默认时交换机 S1 的所有接口都是打开的,CDP 协议是二层协议, 故路由器接口即使没有 IP 地址,CDP 协议也是正常的 21

第一部分 路由器实验 四 实验调试 (1)show cdp R1#show cdp Global CDP information: Sending CDP packets every 60 seconds Sending a holdtime value of 180 seconds Sending CDPv2 advertisements is enabled // 每 60s 从接口发送 CDP 消息, 保存信息 180s, 当前使用的 CDP 版本 2 (2)show cdp interface 显示 CDP 在各接口的运行情况 R1#show cdp interface Vlan1 is administratively down, line protocol is down Sending CDP packets every 60 seconds Holdtime is 180 seconds FastEthernet0/0 is up, line protocol is up Sending CDP packets every 60 seconds Holdtime is 180 seconds FastEthernet0/1 is administratively down, line protocol is down Sending CDP packets every 60 seconds Holdtime is 180 seconds Serial0/0/0 is up, line protocol is up Sending CDP packets every 60 seconds Holdtime is 180 seconds Serial0/0/1 is administratively down, line protocol is down Sending CDP packets every 60 seconds Holdtime is 180 seconds (3)show cdp neighbors 显示 CDP 邻居的信息 R1#show cdp neighbors Capability Codes: R - Router, T - Trans Bridge, B - Source Route Bridge S - Switch, H - Host, I - IGMP, r - Repeater, P - Phone Device ID Local Intrfce Holdtme Capability Platform Port ID R2 Ser 0/0/0 145 R C2800 Ser 0/0/0 S1 Fas 0/0 168 3560 Fas 0/1 相邻设备 R1 上的接口 CDP 消息的邻居的对方的接口 的主机名有效时间硬件型号 (4)show cdp entry R2 显示 CDP 的详细信息 22

第一部分 路由器实验 R1#show cdp entry R2 Device ID: R2 Entry address(es): Platform: cisco C2800, Capabilities: Router Interface: Serial0/0/0, Port ID (outgoing port): Serial0/0/0 Holdtime: 122 Version : Cisco IOS Software, 2800 Software (C2800NM-ADVIPSERVICESK9-M), Version 12.4(15)T1, RELEASE SOFTWARE (fc2) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2007 by Cisco Systems, Inc. Compiled Wed 18-Jul-07 06:21 by pt_rel_team advertisement version: 2 Duplex: full (5) 关闭与开启 CDP 以及 CDP 参数调整 R1(config)#int f0/0 R1(config-if)#no cdp enable R1(config-if)#exit R1(config)#no cdp run R1(config)#cdp run // 该接口上关闭 CDP // 在整个路由器上关闭 CDP // 在整个路由器上打开 CDP 23

第一部分 路由器实验 实验 1-7. 带下一跳地址的静态路由 一 实验目的 ( 一 ) 带下一跳地址的静态路由配置 ( 二 ) 路由表的含义 ( 三 ) 扩展 ping 命令的使用二 实验拓扑 三 实验步骤 Router>ena ( 一 ) 配置路由器 R1 Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int loop0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#exit R1(config)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit End with CNTL/Z. // 配置环回接口 R1(config)#ip route 172.16.23.0 255.255.255.0 172.16.12.2 R1(config)#ip route 172.16.34.0 255.255.255.0 172.16.12.2 R1(config)#ip route 172.16.4.0 255.255.255.0 172.16.12.2 ( 二 ) 配置路由器 R2 // 配置 IP 地址 // 配置静态路由 Router>ena Router#conf t Enter configuration commands, one per line. End with CNTL/Z. 24

第一部分 路由器实验 Router(config)#host R2 R2(config)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#ip route 172.16.1.0 255.255.255.0 172.16.12.1 R2(config)#ip route 172.16.34.0 255.255.255.0 172.16.23.3 R2(config)#ip route 172.16.4.0 255.255.255.0 172.16.23.3 Router>ena ( 三 ) 配置路由器 R3 Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/0 R3(config-if)#ip addr 172.16.34.3 255.255.255.0 R3(config-if)#clock rate 128000 R3(config-if)#no shut R3(config-if)#exit End with CNTL/Z. R3(config)#ip route 172.16.1.0 255.255.255.0 172.16.23.2 R3(config)#ip route 172.16.12.0 255.255.255.0 172.16.23.2 R3(config)#ip route 172.16.4.0 255.255.255.0 172.16.34.4 Router>ena ( 四 ) 配置路由器 R4 Router#conf t Enter configuration commands, one per line. Router(config)#hos R4 R4(config)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config-if)#int s0/0/0 R4(config-if)#ip addr 172.16.34.4 255.255.255.0 R4(config-if)#no shut R4(config-if)#exit End with CNTL/Z. R4(config)#ip route 172.16.1.0 255.255.255.0 172.16.34.3 R4(config)#ip route 172.16.12.0 255.255.255.0 172.16.34.3 25

第一部分 路由器实验 R4(config)#ip route 172.16.23.0 255.255.255.0 172.16.34.3 四 实验调试 ( 一 )show ip route // 查看路由表 R1#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP // 路由代码区 D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 172.16.0.0/24 is subnetted, 5 subnets C 172.16.1.0 is directly connected, Loopback0 S 172.16.4.0 [1/0] via 172.16.12.2 C 172.16.12.0 is directly connected, Serial0/0/0 S 172.16.23.0 [1/0] via 172.16.12.2 S 172.16.34.0 [1/0] via 172.16.12.2 R2#show ip route 172.16.0.0/24 is subnetted, 5 subnets S 172.16.1.0[1/0] via 172.16.12.1 S 172.16.4.0[1/0] via 172.16.23.3 C 172.16.12.0 is directly connected, Serial0/0/0 C 172.16.23.0 is directly connected, Serial0/0/1 S 172.16.34.0[1/0] via 172.16.23.3 R3#show ip route 172.16.0.0/24 is subnetted, 5 subnets S 172.16.1.0 [1/0] via 172.16.23.2 S 172.16.4.0 [1/0] via 172.16.34.4 S 172.16.12.0 [1/0] via 172.16.23.2 C 172.16.23.0 is directly connected, Serial0/0/1 C 172.16.34.0 is directly connected, Serial0/0/0 R4#show ip route 172.16.0.0/24 is subnetted, 5 subnets S 172.16.1.0 [1/0] via 172.16.34.3 26

第一部分 路由器实验 C 172.16.4.0 is directly connected, Loopback0 S 172.16.12.0 [1/0] via 172.16.34.3 S 172.16.23.0 [1/0] via 172.16.34.3 C 172.16.34.0 is directly connected, Serial0/0/0 ( 二 )debug ip routing // 动态查看路由表的添加和删除过程 R1#debug ip routing IP routing debugging is on R1#undebug all All possible debugging has been turned off R1#ping ( 三 ) 扩展 ping Protocol [ip]: Target IP address: 172.16.4.4 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 172.16.1.1 // 协议 // 目标 IP 地址 //ping 重复的次数 //ping 包的大小 // 超时时间 // 是否进一步使用扩展命令 // 源 IP 地址 Type of service [0]: // 服务类型, 与 Qos 有关 Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. // 设置 DF 位确认是否分段 // 验证应答数据 // 数据的格式 Sending 5, 100-byte ICMP Echos to 172.16.4.4, timeout is 2 seconds: Packet sent with a source address of 172.16.1.1!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 79/94/109 ms 27

第一部分 路由器实验 实验 1-8. 带送出接口的静态路由 一 实验目的 ( 一 ) 带送出接口的静态路由配置 ( 二 ) 带送出接口和带下一跳地址配置静态路由的不同 ( 三 ) 静态路由总结配置 ( 四 ) 静态默认路由配置二 实验拓扑 三 实验步骤 Router>ena ( 一 ) 配置路由器 R1 Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int loop0 R1(config-if)#ip addr 172.16.0.1 255.255.255.0 R1(config-if)#int lo1 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int lo2 R1(config-if)#ip addr 172.16.2.1 255.255.255.0 R1(config-if)#int lo3 R1(config-if)#ip addr 172.16.3.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 End with CNTL/Z. 28

第一部分 路由器实验 R1(config-if)#no shu R1(config)#ip route 172.16.4.0 255.255.255.0 s0/0/0 R1(config)#ip route 172.16.23.0 255.255.255.0 s0/0/0 R1(config)#ip route 172.16.34.0 255.255.255.0 s0/0/0 Router>ena ( 二 ) 配置路由器 R2 Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#ip route 172.16.0.0 255.255.255.0 s0/0/0 R2(config)#ip route 172.16.1.0 255.255.255.0 s0/0/0 R2(config)#ip route 172.16.2.0 255.255.255.0 s0/0/0 R2(config)#ip route 172.16.3.0 255.255.255.0 s0/0/0 R2(config)#ip route 172.16.4.0 255.255.255.0 s0/0/1 R2(config)#ip route 172.16.34.0 255.255.255.0 s0/0/1 Router>ena ( 三 ) 配置路由器 R3 Router#conf t Enter configuration commands, one per line. Router(config)#hos R3 R3(config)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int f0/0 R3(config-if)#ip addr 172.16.34.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#ip route 172.16.0.0 255.255.255.0 s0/0/1 R3(config)#ip route 172.16.1.0 255.255.255.0 s0/0/1 R3(config)#ip route 172.16.2.0 255.255.255.0 s0/0/1 R3(config)#ip route 172.16.3.0 255.255.255.0 s0/0/1 R3(config)#ip route 172.16.12.0 255.255.255.0 s0/0/1 R3(config)#ip route 172.16.4.0 255.255.255.0 f0/0 End with CNTL/Z. End with CNTL/Z. 29

第一部分 路由器实验 ( 四 ) 配置路由器 R4 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R4 R4(config)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config-if)#int f0/0 R4(config-if)#ip addr 172.16.34.4 255.255.255.0 R4(config-if)#no shut R4(config-if)#exit R4(config)#ip route 172.16.0.0 255.255.255.0 f0/0 R4(config)#ip route 172.16.1.0 255.255.255.0 f0/0 R4(config)#ip route 172.16.2.0 255.255.255.0 f0/0 R4(config)#ip route 172.16.3.0 255.255.255.0 f0/0 R4(config)#ip route 172.16.12.0 255.255.255.0 f0/0 R4(config)#ip route 172.16.23.0 255.255.255.0 f0/0 四 实验调试 R3#show ip route End with CNTL/Z. S S S S S S C C 172.16.0.0/24 is subnetted, 8 subnets 172.16.0.0 is directly connected, Serial0/0/1 172.16.1.0 is directly connected, Serial0/0/1 172.16.2.0 is directly connected, Serial0/0/1 172.16.3.0 is directly connected, Serial0/0/1 172.16.4.0 is directly connected, FastEthernet0/0 172.16.12.0 is directly connected, Serial0/0/1 172.16.23.0 is directly connected, Serial0/0/1 172.16.34.0 is directly connected, FastEthernet0/0 R3#show ip route 172.16.3.0 Routing entry for 172.16.3.0/24 Known via "static", distance 1, metric 0 (connected) Routing Descriptor Blocks: * directly connected, via Serial0/0/1 Route metric is 0, traffic share count is 1 // 注意 : 带送出接口的静态路由显示的是直连 ( directly connected), 而带下一跳地址的静态路由显示的是 1/0, 但是它们的管理距离默认值都是 1 带送出接口的静态路由查找路由表的速率高 (1) Ping R4#ping 172.16.1.1 30

第一部分 路由器实验 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.1.1, timeout is 2 seconds:.!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 93/93/94 ms (2) 配置静态路由总结 R2(config)#no ip route 172.16.0.0 255.255.255.0 s0/0/0 R2(config)#no ip route 172.16.1.0 255.255.255.0 s0/0/0 R2(config)#no ip route 172.16.2.0 255.255.255.0 s0/0/0 R2(config)#no ip route 172.16.3.0 255.255.255.0 s0/0/0 R2(config)#ip route 172.16.0.0 255.255.252.0 s0/0/0 //R3 和 R4 做同样的配置 (3) 配置静态默认路由 R1(config)#ip route 0.0.0.0 0.0.0.0 s0/0/0 R4(config)#ip route 0.0.0.0 0.0.0.0 f0/0 R4(config)#ip route 0.0.0.0 0.0.0.0 172.16.34.3 // 一条路由代替四条 31

第一部分 路由器实验 实验 1-9. 浮动静态路由 一 实验目的 ( 一 ) 浮动静态路由的配置 ( 二 ) 备份路由的工作原理二 实验拓扑 三 实验步骤 本实验在路由器 R1 和 R2 之间有两条链路, 分别为串行链路和以太 网链路, 我们通过提高串行链路静态路由的管理距离, 使得路由器在选路 时优先选择以太链路, 但当以太链路出现故障时, 选用串行链路, 而在以 太链路恢复后, 再优选以太链路 Router>ena ( 一 ) 配置路由器 R1 Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int f0/0 R1(config-if)#ip addr 172.16.21.1 255.255.255.0 R1(config-if)#no shut End with CNTL/Z. 32

第一部分 路由器实验 R1(config-if)#exit R1(config)#ip route 172.16.2.0 255.255.255.0 172.16.12.2 100 R1(config)#ip route 172.16.2.0 255.255.255.0 172.16.21.2 Router>ena ( 二 ) 配置路由器 R2 Router#conf t Enter configuration commands, one per line. Router(config)#hos R2 R2(config)#int lo0 R2(config-if)#ip addr 172.16.2.2 255.255.255.0 R2(config-if)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int f0/0 R2(config-if)#ip addr 172.16.21.2 255.255.255.0 R2(config-if)#no shut R2(config-if)#exit End with CNTL/Z. R2(config)#ip route 172.16.1.0 255.255.255.0 172.16.12.1 100 R2(config)#ip route 172.16.1.0 255.255.255.0 172.16.21.1 // 浮动静态路由是一条路由的备份路由, 它可以是动态路由, 也可以是静态路由 四 实验调试 ( 一 ) 分别在路由器 R1 和 R2 上查看路由表 R1#show ip route 172.16.0.0/24 is subnetted, 4 subnets C 172.16.1.0 is directly connected, Loopback0 S 172.16.2.0 [1/0] via 172.16.21.2 C 172.16.12.0 is directly connected, Serial0/0/0 C 172.16.21.0 is directly connected, FastEthernet0/0 R2#show ip route 172.16.0.0/24 is subnetted, 4 subnets S 172.16.1.0 [1/0] via 172.16.21.1 C 172.16.2.0 is directly connected, Loopback0 C 172.16.12.0 is directly connected, Serial0/0/0 C 172.16.21.0 is directly connected, FastEthernet0/0 ( 二 ) 在 R1 上 f0/0 接口 shutdown 后, 查看路由表 R1(config)#int f0/0 R1(config-if)#shutdown 33

第一部分 路由器实验 R1(config-if)#end R1#show ip route C 172.16.0.0/24 is subnetted, 3 subnets 172.16.1.0 is directly connected, Loopback0 S 172.16.2.0 [100/0] via 172.16.12.2 C 172.16.12.0 is directly connected, Serial0/0/0 ( 三 ) 在 R1 上 f0/0 接口启动后, 查看路由表 R1(config)#int f0/0 R1(config-if)#no shut R1(config-if)#end R1#show ip route C 172.16.0.0/24 is subnetted, 4 subnets 172.16.1.0 is directly connected, Loopback0 S 172.16.2.0 [1/0] via 172.16.21.2 C 172.16.12.0 is directly connected, Serial0/0/0 C 172.16.21.0 is directly connected, FastEthernet0/0 34

第一部分 路由器实验 实验 1-10.RIPv1 基本配置 一 实验目的 ( 一 ) 在路由器上启动 RIPv1 路由进程 ( 二 ) 激活参与路由协议的接口, 使之可发送和接收 RIPv1 更新 ( 三 ) 理解 RIP 路由表的含义 ( 四 ) 查看和调试 RIPv1 路由协议相关信息二 实验拓扑 三 实验步骤 Router>ena ( 一 ) 配置路由器 R1 Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.31.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.31.12.1 255.255.255.0 R1(config-if)#no shut End with CNTL/Z. 35

第一部分 路由器实验 R1(config-if)#exit R1(config)#router rip // 启动 RIP 进程 R1(config-router)#version 1 // 配置 RIP 版本 1 R1(config-router)#network 172.31.0.0 Router>ena ( 二 ) 配置路由器 R2 Router#conf t Enter configuration commands, one per line. Router(config)#hos R2 R2(config)#int s0/0/0 R2(config-if)#ip addr 172.31.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/1/0 R2(config-if)#ip addr 172.16.24.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router rip R2(config-router)#version 1 R2(config-router)#network 172.31.0.0 R2(config-router)#network 172.16.0.0 ( 三 ) 配置路由器 R3 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int lo0 R3(config-if)#ip addr 172.16.3.3 255.255.255.0 R3(config-if)#int s0/0/0 R3(config-if)#ip addr 172.16.34.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router rip R3(config-router)#version 1 End with CNTL/Z. End with CNTL/Z. 36

第一部分 路由器实验 R3(config-router)#network 172.16.0.0 Router>ena ( 四 ) 配置路由器 R4 Router#conf t Enter configuration commands, one per line. Router(config)#int lo0 Router(config-if)#ip addr 172.16.4.4 255.255.255.0 Router(config-if)#int s0/0/0 Router(config-if)#ip addr 172.16.34.4 255.255.255.0 Router(config-if)#clock rate 128000 Router(config-if)#no shut Router(config-if)#int s0/0/1 Router(config-if)#ip addr 172.16.24.4 255.255.255.0 Router(config-if)#no shut Router(config-if)#exit Router(config)#router rip Router(config-router)#version 1 Router(config-router)#network 172.16.0.0 四 实验调试 ( 一 )show ip route End with CNTL/Z. // 查看从 RIP 邻居处接收的路由是否已添加到路由表中 R1#show ip route R 172.16.0.0/16 [120/1] via 172.31.12.2, 00:00:28, Serial0/0/0 C C 172.31.0.0/24 is subnetted, 2 subnets 172.31.1.0 is directly connected, Loopback0 172.31.12.0 is directly connected, Serial0/0/0 a) R------- 路由条目是通过 RIP 路由协议学习来的 b) 172.16.0.0/16 --------- 目的网络及网络掩码长度 c) 120-----------RIP 路由协议的默认管理距离 d) 1 ------------- 度量值 e) 172.31.12.2------------ 通过路由器的下一跳 IP 地址 f) 00:00:28 ------------- 自上次更新的时间 g) Serial0/0/0------------- 接收该路由条目的本路由器的接口 R R C C R2#show ip route 172.16.0.0/24 is subnetted, 5 subnets 172.16.3.0 [120/1] via 172.16.23.3, 00:00:16, Serial0/0/1 172.16.4.0 [120/1] via 172.16.24.4, 00:00:08, Serial0/1/0 172.16.23.0 is directly connected, Serial0/0/1 172.16.24.0 is directly connected, Serial0/1/0 37

第一部分 路由器实验 R R 172.16.34.0 [120/1] via 172.16.23.3, 00:00:16, Serial0/0/1 172.31.0.0/24 is subnetted, 2 subnets [120/1] via 172.16.24.4, 00:00:08, Serial0/1/0 172.31.1.0 [120/1] via 172.31.12.1, 00:00:04, Serial0/0/0 C 172.31.12.0 is directly connected, Serial0/0/0 //RIPv1 路由更新可以携带子网信息, 但必须同时满足两个条件 : a. 整个网络所有地址属于同一个主要网络 b. 子网掩码长度必须相同 RIPv1 发生路由更新的原则 : 不同主类发送主类路由, 相同主类且网络掩码长度相同, 则发 送明细路由 RIPv1 接收路由更新的原则 : 如果收到路由更新及其属于相同的主类网络, 则以接收接口的 子网掩码作为路由条目的掩码 ; 如果收到路由更新及其属于不同的主类网络, 则以该网络的主类 网络掩码作为路由条目的掩码 R3#show ip route 172.16.0.0/24 is subnetted, 5 subnets C R C R C R 172.16.3.0 is directly connected, Loopback0 172.16.4.0 [120/1] via 172.16.34.4, 00:00:01, Serial0/0/0 172.16.23.0 is directly connected, Serial0/0/1 172.16.24.0 [120/1] via 172.16.23.2, 00:00:16, Serial0/0/1 [120/1] via 172.16.34.4, 00:00:01, Serial0/0/0 // 两条等价路径 172.16.34.0 is directly connected, Serial0/0/0 172.31.0.0/16 [120/1] via 172.16.23.2, 00:00:16, Serial0/0/1 ( 二 )show ip protocols // 查看 IP 路由协议配置和统计信息 R1#show ip protocols Routing Protocol is "rip" // 路由器上运行的路由协议是 RIP Sending updates every 30 seconds, next due in 21 seconds // 更新周期 30s, 距离下次更新还有 21s Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set // 在出方向和入方向没有配置分布列表 Redistributing: rip // 只运行 RIP 协议, 没有其他的协议重分布进来 Default version control: send version 1, receive 1 Interface Send Recv Triggered RIP Key-chain Loopback0 1 1 Serial0/0/0 1 1 Automatic network summarization is in effect // 默认开启自动汇总功能 38

第一部分 路由器实验 Maximum path: 4 Routing for Networks: // 路由协议默认支持 4 条等价路径 172.31.0.0 // 该路由模式下配置的有类网络地址 Passive Interface(s): Routing Information Sources: Gateway Distance Last Update 172.31.12.2 120 00:00:14 // 表明从哪些 RIP 邻居接收路由更新 Gateway: 学习路由信息的路由器的接口地址, 也就是下一跳地址 Distance: 对邻居所发送的更新使用的 AD Last Update: 更新发生在多长时间以前 Distance: (default is 120) ( 三 )debug ip rip R1#debug ip rip R1#clear ip route * //RIP 路由协议默认管理距离 R1#RIP: received v1 update from 172.31.12.2 on Serial0/0/0 172.16.0.0 in 1 hops RIP: sending v1 update to 255.255.255.255 via Loopback0 (172.31.1.1) RIP: build update entries network 172.16.0.0 metric 2 network 172.31.12.0 metric 1 RIP: sending v1 update to 255.255.255.255 via Serial0/0/0 (172.31.12.1) RIP: build update entries network 172.31.1.0 metric 1 39

第一部分 路由器实验 实验 1-11. 不连续网络配置及其解决方案 实验拓扑 : 实验配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int s0/0/0 R1(config-if)#ip addr 12.1.1.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int f0/0 R1(config-if)#ip addr 172.16.10.1 255.255.255.0 R1(config-if)#no shut End with CNTL/Z. Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int s0/0/0 R2(config-if)#ip addr 12.1.1.2 255.255.255.0 R2(config-if)#clock rate 64000 R2(config-if)#no shut R2(config-if)#int f0/0 R2(config-if)#ip addr 172.16.20.1 255.255.255.0 R2(config-if)#no shut End with CNTL/Z. 配置 RIPv1: 40

第一部分 路由器实验 R1(config)#router rip R1(config-router)#net 12.0.0.0 R1(config-router)#net 172.16.10.0 R2(config)#router rip R2(config-router)#net 12.0.0.0 R2(config-router)#net 172.16.20.0 测试 : R1#ping 172.16.20.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.20.1, timeout is 2 seconds:... Success rate is 0 percent (0/5) R1#show ip route Codes: C - connected, S - static, I - IGRP,R - RIP, M - mobile, B - BGP D - EIGRP,EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set C C 12.0.0.0/24 is subnetted, 1 subnets 12.1.1.0 is directly connected, Serial0/0/0 172.16.0.0/24 is subnetted, 1 subnets 172.16.10.0 is directly connected, FastEthernet0/0 R2#show ip route Codes: C - connected, S - static, I - IGRP,R - RIP, M - mobile, B - BGP D - EIGRP,EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 12.0.0.0/24 is subnetted, 1 subnets 41

第一部分 路由器实验 C C 12.1.1.0 is directly connected, Serial0/0/0 172.16.0.0/24 is subnetted, 1 subnets 172.16.20.0 is directly connected, FastEthernet0/0 R2#show ip protocols Routing Protocol is "rip" Sending updates every 30 seconds, next due in 1 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 1, receive any version Interface Send Recv Triggered RIP Key-chain FastEthernet0/0 1 2 1 Serial0/0/0 1 2 1 Automatic network summarization is in effect Maximum path: 4 Routing for Networks: 12.0.0.0 172.16.0.0 Passive Interface(s): Routing Information Sources: Gateway Distance Last Update Distance: (default is 120) 这就是不连续网络造成的, 下来我们用不同方法来解决, 让它可以 ping 通 方法 1: 配置 RIPv2 借助 ripv2 的特性支持不连续网络, 支持可变长子网 R1(config)#router rip R1(config-router)#version 2 R2(config)#router rip R2(config-router)#version 2 R1#show ip protocols Routing Protocol is "rip" Sending updates every 30 seconds, next due in 10 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 2, receive 2 Interface Send Recv Triggered RIP Key-chain 42

第一部分 路由器实验 FastEthernet0/0 2 2 Serial0/0/0 2 2 Automatic network summarization is in effect Maximum path: 4 Routing for Networks: 12.0.0.0 172.16.0.0 Passive Interface(s): Routing Information Sources: Gateway Distance Last Update 12.1.1.2 120 00:00:17 Distance: (default is 120) R2#show ip protocols Routing Protocol is "rip" Sending updates every 30 seconds, next due in 10 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 2, receive 2 Interface Send Recv Triggered RIP Key-chain FastEthernet0/0 2 2 Serial0/0/0 2 2 Automatic network summarization is in effect Maximum path: 4 Routing for Networks: 12.0.0.0 172.16.0.0 Passive Interface(s): Routing Information Sources: Gateway Distance Last Update 12.1.1.1 120 00:00:14 Distance: (default is 120) 测试网络 : R1#ping 172.16.20.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.20.1, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 17/28/32 ms 相互之间都可以 ping 通 43

第一部分 路由器实验 方法 2: 配置静态路由 R1(config)#ip route 172.16.20.0 255.255.255.0 12.1.1.2 R2(config)#ip route 172.16.10.0 255.255.255.0 12.1.1.1 R1#show ip route Codes: C - connected, S - static, I - IGRP,R - RIP, M - mobile, B - BGP D - EIGRP,EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is not set 12.0.0.0/24 is subnetted, 1 subnets C C 12.1.1.0 is directly connected, Serial0/0/0 172.16.0.0/24 is subnetted, 2 subnets 172.16.10.0 is directly connected, FastEthernet0/0 S 172.16.20.0 [1/0] via 12.1.1.2 方法三 : 在每个接口上通告发送数据用 RIPV2 方法四 : 在同一接口上配置双 IP 来解决 44

第一部分 路由器实验 实验 1-12. 被动接口与单播更新 一 实验目的 ( 一 ) 被动接口的含义 配置和应用场合 ( 二 ) 单播更新的应用场合和配置二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#ip addr 172.31.0.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int f0/1 R1(config-if)#ip addr 172.31.1.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.31.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#router rip R1(config-router)#version 1 End with CNTL/Z. 45

第一部分 R1(config-router)#network 172.31.0.0 R1(config-router)#passive-interface f0/0 R1(config-router)#passive-interface f0/1 路由器实验 // 配置被动接口 Router>ena ( 二 ) 配置路由器 R2 Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int lo0 R2(config-if)#ip addr 172.31.2.2 255.255.255.0 R2(config-if)#int s0/0/0 R2(config-if)#ip addr 172.31.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router rip R2(config-router)#version 1 R2(config-router)#network 172.31.0.0 四 实验调试 R1#debug ip rip RIP protocol debugging is on R1#clear ip route * End with CNTL/Z. R1#RIP: sending v1 update to 255.255.255.255 via Serial0/0/0 (172.31.12.1) RIP: build update entries network 172.31.0.0 metric 1 network 172.31.1.0 metric 1 RIP: received v1 update from 172.31.12.2 on Serial0/0/0 172.31.2.0 in 1 hops RIP: sending v1 update to 255.255.255.255 via Serial0/0/0 (172.31.12.1) RIP: build update entries network 172.31.0.0 metric 1 network 172.31.1.0 metric 1 RIP: received v1 update from 172.31.12.2 on Serial0/0/0 172.31.2.0 in 1 hops 46

第一部分 路由器实验 实验 1-13.RIPv2 基本配置 一 实验目的 ( 一 )RIPv1 和 RIPv2 的区别 ( 二 ) 在路由器上启动 RIPv2 路由进程 ( 三 ) 激活参与路由协议的接口, 使之可发生和接收 RIPv2 更新 ( 四 )auto-summary 的开启和关闭 ( 五 ) 查看和调试 RIPv2 路由协议相关信息二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 Router>ena Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.31.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.31.12.1 255.255.255.0 47

第一部分 路由器实验 R1(config-if)#no shut R1(config-if)#exit R1(config)#router rip // 启动 RIP 进程 R1(config-router)#version 2 // 配置 RIP 版本 2 R1(config-router)#no auto-summary R1(config-router)#network 172.31.0.0 Router>ena ( 二 ) 配置路由器 R2 Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int s0/0/0 R2(config-if)#ip addr 172.31.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/1/0 R2(config-if)#ip addr 172.16.24.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router rip R2(config-router)#version 2 R2(config-router)#no au R2(config-router)#network 172.31.0.0 R2(config-router)#network 172.16.0.0 Router>ena ( 三 ) 配置路由器 R3 Router#conf t Enter configuration commands, one per line. Router(config)#int lo0 // 关闭自动汇总 Router(config-if)#ip addr 172.16.3.3 255.255.255.0 Router(config-if)#int s0/0/1 Router(config-if)#ip addr 172.16.23.3 255.255.255.0 Router(config-if)#no shut Router(config-if)#int s0/0/0 Router(config-if)#ip addr 172.16.34.3 255.255.255.0 Router(config-if)#no shut Router(config-if)#exit End with CNTL/Z. End with CNTL/Z. 48

第一部分 路由器实验 Router(config)#router rip Router(config-router)#version 2 Router(config-router)#no au Router(config-router)#network 172.16.0.0 Router>ena ( 四 ) 配置路由器 R4 Router#conf t Enter configuration commands, one per line. Router(config)#host R4 R4(config)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config-if)#int s0/0/0 R4(config-if)#ip addr 172.16.34.4 255.255.255.0 R4(config-if)#clock rate 128000 R4(config-if)#no shut R4(config-if)#int s0/0/1 R4(config-if)#ip addr 172.16.24.4 255.255.255.0 R4(config-if)#no shut R4(config-if)#exit R4(config)#router rip R4(config-router)#ver 2 R4(config-router)#no au R4(config-router)#net 172.16.0.0 四 实验调试 ( 一 )show ip route R1#show ip route R R R R R C C End with CNTL/Z. 172.16.0.0/24 is subnetted, 5 subnets 172.16.3.0 [120/2] via 172.31.12.2, 00:00:20, Serial0/0/0 172.16.4.0 [120/2] via 172.31.12.2, 00:00:20, Serial0/0/0 172.16.23.0 [120/1] via 172.31.12.2, 00:00:20, Serial0/0/0 172.16.24.0 [120/1] via 172.31.12.2, 00:00:20, Serial0/0/0 172.16.34.0 [120/2] via 172.31.12.2, 00:00:20, Serial0/0/0 172.31.0.0/24 is subnetted, 2 subnets 172.31.1.0 is directly connected, Loopback0 172.31.12.0 is directly connected, Serial0/0/0 ( 二 )show ip protocols R1#show ip protocols Routing Protocol is "rip" Sending updates every 30 seconds, next due in 23 seconds Invalid after 180 seconds, hold down 180, flushed after 240 49

第一部分 路由器实验 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 2, receive 2 Interface Send Recv Triggered RIP Key-chain Loopback0 2 2 Serial0/0/0 2 2 // 默认情况下只接收和发送版本 2 的路由更新 Automatic network summarization is not in effect Maximum path: 4 Routing for Networks: 172.31.0.0 Passive Interface(s): Routing Information Sources: Gateway Distance Last Update 172.31.12.2 120 00:00:13 Distance: (default is 120) ( 三 )debug ip rip R1#debug ip rip RIP protocol debugging is on R1#clear ip route * R1#RIP: received v2 update from 172.31.12.2 on Serial0/0/0 172.16.3.0/24 via 0.0.0.0 in 2 hops 172.16.4.0/24 via 0.0.0.0 in 2 hops 172.16.23.0/24 via 0.0.0.0 in 1 hops 172.16.24.0/24 via 0.0.0.0 in 1 hops 172.16.34.0/24 via 0.0.0.0 in 2 hops RIP: sending v2 update to 224.0.0.9 via Loopback0 (172.31.1.1) RIP: build update entries 172.16.3.0/24 via 0.0.0.0, metric 3, tag 0 172.16.4.0/24 via 0.0.0.0, metric 3, tag 0 172.16.23.0/24 via 0.0.0.0, metric 2, tag 0 172.16.24.0/24 via 0.0.0.0, metric 2, tag 0 172.16.34.0/24 via 0.0.0.0, metric 3, tag 0 172.31.12.0/24 via 0.0.0.0, metric 1, tag 0 RIP: sending v2 update to 224.0.0.9 via Serial0/0/0 (172.31.12.1) RIP: build update entries 172.31.1.0/24 via 0.0.0.0, metric 1, tag 0 RIP: received v2 update from 172.31.12.2 on Serial0/0/0 172.16.3.0/24 via 0.0.0.0 in 2 hops 172.16.4.0/24 via 0.0.0.0 in 2 hops 172.16.23.0/24 via 0.0.0.0 in 1 hops 172.16.24.0/24 via 0.0.0.0 in 1 hops 172.16.34.0/24 via 0.0.0.0 in 2 hops 50

第一部分 路由器实验 实验 1-14. 向 RIP 网络中注入默认路由 一 实验目的 ( 一 ) (1) 向 RIP 网络中注入默认路由的方法 ( 二 ) (2) IP default-network 命令特征 ( 三 ) (3) 重分布静态默认路由到 RIP 网络 ( 四 ) (4) default-information originate 命令特征 二 实验拓扑 三 实验步骤 在路由器 R1 路由器 R2 和路由器 R3 之间运行 RIP, 在路由器 R3 和路由器 R4 之间配置静态路由, 路由器 R4 模拟 ISP, 通过对边界路由器 R3 的配置, 使得路由器 R1 和路由器 R2 学习到一条 RIP 的默认路由 Router>ena ( 一 ) 配置路由器 R1 Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#router rip R1(config-router)#version 2 End with CNTL/Z. 51

第一部分 路由器实验 R1(config-router)#no au R1(config-router)#network 172.16.0.0 ( 二 ) 配置路由器 R2 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#int s0/0/0 Router(config-if)#ip addr 172.16.12.2 255.255.255.0 Router(config-if)#clock rate 128000 Router(config-if)#no shut Router(config-if)#int s0/0/1 Router(config-if)#ip addr 172.16.23.2 255.255.255.0 Router(config-if)#clock rate 128000 Router(config-if)#no shut Router(config-if)#exit Router(config)#router rip Router(config-router)#version 2 Router(config-router)#no au Router(config-router)#network 172.16.0.0 Router>ena ( 三 ) 配置路由器 R3 Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/0 R3(config-if)#ip addr 192.168.34.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router rip R3(config-router)#ver 2 R3(config-router)#no au R3(config-router)#network 172.16.0.0 R3(config-router)#exit R3(config)#ip route 0.0.0.0 0.0.0.0 s0/0/0 ( 四 ) 配置路由器 R4 End with CNTL/Z. End with CNTL/Z. Router>ena Router#conf t Enter configuration commands, one per line. End with CNTL/Z. 52

第一部分 路由器实验 Router(config)#host R4 R4(config)#int lo0 R4(config-if)#ip addr 192.168.4.4 255.255.255.0 R4(config-if)#int s0/0/0 R4(config-if)#ip addr 192.168.34.4 255.255.255.0 R4(config-if)#clock rate 128000 R4(config-if)#no shut R4(config-if)#exit R4(config)#ip route 172.16.0.0 255.255.255.0 s0/0/0 四 实验调试 ( 一 ) 通过 IP default-network 向 RIP 网络注入默认路由 R3(config)#ip default-network 192.168.34.0 R1#show ip route rip 172.16.0.0/24 is subnetted, 3 subnets R 172.16.23.0 [120/1] via 172.16.12.2, 00:00:14, Serial0/0/0 R* 0.0.0.0/0 [120/2] via 172.16.12.2, 00:00:14, Serial0/0/0 Router#sho ip route rip 172.16.0.0/24 is subnetted, 3 subnets R 172.16.1.0 [120/1] via 172.16.12.1, 00:00:04, Serial0/0/0 R* 0.0.0.0/0 [120/1] via 172.16.23.3, 00:00:18, Serial0/0/1 R3#show ip route 172.16.0.0/24 is subnetted, 3 subnets R 172.16.1.0 [120/2] via 172.16.23.2, 00:00:12, Serial0/0/1 R 172.16.12.0 [120/1] via 172.16.23.2, 00:00:12, Serial0/0/1 C 172.16.23.0 is directly connected, Serial0/0/1 C* 192.168.34.0/24 is directly connected, Serial0/0/0 // ip default-network 命令在本地路由器产生一条直连 * 的路由 S* 0.0.0.0/0 is directly connected, Serial0/0/0 ( 二 ) 通过重分布向 RIP 网络注入默认路由 R3(config-router)#redistribute static R1#show ip route rip 172.16.0.0/24 is subnetted, 3 subnets R 172.16.23.0 [120/1] via 172.16.12.2, 00:00:18, Serial0/0/0 R* 0.0.0.0/0 [120/1] via 172.16.12.2, 00:00:18, Serial0/0/0 Router#sho ip route rip 53

第一部分 路由器实验 172.16.0.0/24 is subnetted, 3 subnets R 172.16.1.0 [120/1] via 172.16.12.1, 00:00:27, Serial0/0/0 R* 0.0.0.0/0 [120/1] via 172.16.23.3, 00:01:11, Serial0/0/1 ( 三 ) 通过 default-information originate 向 RIP 网络注入默认路由 R3(config-router)#default-information originate R1#show ip route rip 172.16.0.0/24 is subnetted, 3 subnets R 172.16.23.0 [120/1] via 172.16.12.2, 00:00:19, Serial0/0/0 R* 0.0.0.0/0 [120/2] via 172.16.12.2, 00:00:19, Serial0/0/0 Router#sho ip route rip 172.16.0.0/24 is subnetted, 3 subnets R 172.16.1.0 [120/1] via 172.16.12.1, 00:00:08, Serial0/0/0 R* 0.0.0.0/0 [120/1] via 172.16.23.3, 00:00:12, Serial0/0/1 ( 四 ) 在路由器 R1 上 ping 192.168.34.4 54

第一部分 路由器实验 实验 1-15.EIGRP 基本配置 一 实验目的 ( 一 ) 在路由器上启动 EIGRP 路由进程 ( 二 ) 激活参与路由协议的接口, 使之可发生和接受 EIGRP 更新 ( 三 )EIGRP 度量值的计算方法 ( 四 ) 可行距离 (FD) 通告距离 (RD) 以及可行性条件 (FC) ( 五 ) 邻居表 拓扑表和路由表的含义 ( 六 ) 查看和测试 EIGRP 路由协议相关信息二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#ip addr 172.31.1.1 255.255.255.0 End with CNTL/Z. 55

第一部分 路由器实验 R1(config-if)#no shut R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.31.12.1 255.255.255.252 R1(config-if)#no shut R1(config-if)#exit R1(config)#router eigrp 1 // 启动 EIGRP 进程, 进程号为 1 R1(config-router)#auto-summary //EIGRP 默认开启有类网络边界本地路由自动汇总, 对于穿越本路由器的路由条目,EIGRP 是不能自动汇总的 R1(config-router)#network 172.31.0.0 Router>ena ( 二 ) 配置路由器 R2 Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int s0/0/0 R2(config-if)#ip addr 172.31.12.2 255.255.255.252 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.1 255.255.255.252 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/1/0 R2(config-if)#ip addr 172.16.24.1 255.255.255.252 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router eigrp 1 R2(config-router)#auto-summary R2(config-router)#network 172.31.0.0 R2(config-router)#network 172.16.0.0 Router>ena ( 三 ) 配置路由器 R3 Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int f0/0 R3(config-if)#ip addr 172.16.3.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/1 R3(config-if)#ip addr 172.16.23.2 255.255.255.252 End with CNTL/Z. End with CNTL/Z. 56

第一部分 路由器实验 R3(config-if)#no shut R3(config-if)#int s0/0/0 R3(config-if)#ip addr 172.16.34.1 255.255.255.252 R3(config-if)#no shut R3(config-if)#exit R3(config)#router eigrp 1 R3(config-router)#auto-summary R3(config-router)#network 172.16.0.0 Router>ena ( 四 ) 配置路由器 R4 Router#conf t Enter configuration commands, one per line. Router(config)#host R4 R4(config)#int f0/0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config-if)#no shut R4(config-if)#int s0/0/0 R4(config-if)#ip addr 172.16.34.2 255.255.255.252 R4(config-if)#clock rate 128000 R4(config-if)#no shut R4(config-if)#int s0/0/1 R4(config-if)#ip addr 172.16.24.2 255.255.255.252 R4(config-if)#no shut R4(config-if)#exit R4(config)#router eigrp 1 R4(config-router)#auto-summary R4(config-router)#network 172.16.0.0 四 实验调试 ( 一 )show ip route R1#show ip route End with CNTL/Z. D C C 172.16.0.0/16 [90/21024000] via 172.31.12.2, 00:12:52, Serial0/0/0 172.31.0.0/16 is variably subnetted, 2 subnets, 2 masks 172.31.1.0/24 is directly connected, FastEthernet0/0 172.31.12.0/30 is directly connected, Serial0/0/0 R2#show ip route 172.16.0.0/16 is variably subnetted, 6 subnets, 3 masks D 172.16.0.0/16 is a summary, 00:14:01, Null0 D 172.16.3.0/24 [90/2172416 90/2172416] via 172.16.23.2, 00:13:19, Serial0/0/1 D 172.16.4.0/24 [90/2172416 90/2172416] via 172.16.24.2, 00:10:20, Serial0/1/0 57

第一部分 路由器实验 C C D 172.16.23.0/30 is directly connected, Serial0/0/1 172.16.24.0/30 is directly connected, Serial0/1/0 172.16.34.0/30 [90/2681856] via 172.16.23.2, 00:11:02, Serial0/0/1 [90/2681856] via 172.16.24.2, 00:10:20, Serial0/1/0 172.31.0.0/16 is variably subnetted, 3 subnets, 3 masks D 172.31.0.0/16 is a summary, 00:14:01, Null0 D C 技术要点 172.31.1.0/24 [90/2172416] via 172.31.12.1, 00:15:48, Serial0/0/0 172.31.12.0/30 is directly connected, Serial0/0/0 EIGRP 向路由表中自动加入一条 Null0 总结路由的条件必须同时满足下面 3 点 : a. 至少有两个不同主类的网络在 EIGRP 进程中通告 b. 每个主要网络通过 EIGRP 至少发现了一个网络 c.eigrp 进程中启用了自动总结, 如果关闭了自动总结, 则 Null0 总结路由将被删除, 除非 接口下执行手工路由总结 R3#show ip route 172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks C 172.16.3.0/24 is directly connected, FastEthernet0/0 D 172.16.4.0/24 [90/2172416] via 172.16.34.2, 00:19:33, Serial0/0/0 C D C D 172.16.23.0/30 is directly connected, Serial0/0/1 172.16.24.0/30 [90/2681856] via 172.16.23.1, 00:19:58, Serial0/0/1 [90/2681856] via 172.16.34.2, 00:19:33, Serial0/0/0 172.16.34.0/30 is directly connected, Serial0/0/0 172.31.0.0/16 [90/2681856] via 172.16.23.1, 00:22:32, Serial0/0/1 注 EIGRP 度量值的计算公式 = [K1xBandwidth+(K2xBandwidth)/(256-Load)+K3xDelay]x[K5/(Reliability+K4)]x256 默认情况下 :K1=K3=1 K1=K3=1,K2=K4=K5=0 K2=K4=K5=0 Bandwidth=[10 7 / 传递路由条目所经由链路中入口带宽 (kbps kbps) 的最小值 ]x256 Delay=[ 传递路由条目所经由链路中入口的延迟之和 (us us)/10]x256 相关术语 :1 级路由 ( 默认路由 超网路由 网络路由 ) 最终路由 1 级父路由 2 级路由 R4#show ip route 172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks // 一级父路由 D C D C C 172.16.3.0/24 [90/2172416] via 172.16.34.1, 00:38:38, Serial0/0/0 172.16.4.0/24 is directly connected, FastEthernet0/0 172.16.23.0/30 [90/2681856] via 172.16.24.1, 00:38:38, Serial0/0/1 [90/2681856] via 172.16.34.1, 00:38:38, Serial0/0/0 172.16.24.0/30 is directly connected, Serial0/0/1 172.16.34.0/30 is directly connected, Serial0/0/0 // 以上五条路由是 2 级路由, 也是最终路由 D 172.31.0.0/16 [90/2681856] via 172.16.24.1, 00:38:38, Serial0/0/1 // 该路由是一级路由, 也是最终路由 58

第一部分 路由器实验 发送出去 发送出去 ( 二 )show ip protocols R2#show ip protocols Routing Protocol is "eigrp 1 " //AS 号码为 1 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set // 以上两行表明入方向和出方向都没有配置分布列表 Default networks flagged in outgoing updates // 允许出方向发生默认路由信息, 通过路由模式下的 default-information out 命令配置 Default networks accepted from incoming updates // 允许入方向接收默认路由信息, 通过路由模式下的 default-information in 命令配置 EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0 // 显示计算度量值所用的 K 值 EIGRP maximum hopcount 100 // 支持的跳数, 默认为 100, 最大为 255 EIGRP maximum metric variance 1 Redistributing: eigrp 1 // 没有其他协议重分布进来 Automatic network summarization is in effect // 显示自动汇总总结已经开启, 默认是开启的 Automatic address summarization: // 自动地址总结 172.31.0.0/16 for Serial0/0/1, Serial0/1/0 Summarizing with metric 2169856 // 以上两行表明自动总结成 172.31.0.0/16 网络, 并从接口 s0/0/1,s0/0/0 以初始度量值 2169856 172.16.0.0/16 for Serial0/0/0 Summarizing with metric 2169856 // 以上两行表明自动总结成 172.16.0.0/16 网络, 并从接口 s0/0/1,s0/0/0 以初始度量值 2169856 Maximum path: 4 Routing for Networks: 172.31.0.0 172.16.0.0 Routing Information Sources: // 默认支持负载均衡路由的条数, 最大 16 条 //EIGRP 进程中的 network 命令后的网络 // 路由信息源 Gateway Distance Last Update 172.31.12.1 90 493170 172.16.23.2 90 642249 172.16.24.2 90 820766 Distance: internal 90 external 170 // 管理距离, 内部 90, 外部 170 ( 三 )show ip eigrp neighbors R2#show ip eigrp neighbors IP-EIGRP neighbors for process 1 H Address Interface Hold Uptime SRTT RTO Q Seq 59

第一部分 路由器实验 (sec) (ms) Cnt Num 0 172.31.12.1 Se0/0/0 13 01:08:47 40 1000 0 3 1 172.16.23.2 Se0/0/1 13 01:06:18 40 1000 0 11 2 172.16.24.2 Se0/1/0 11 01:03:20 40 1000 0 9 各自段的含义 : H----- 与邻居建立会话的顺序 Address-------- 邻居路由器的接口地址 Interface--------- 本路由器到邻居路由器的接口 Hold----------- 认为邻居路由器不存在所能等待的最长时间 Uptime--------- 从邻居关系建立到目前的时间 SRTT----------- 向邻居路由器发送一个数据包以及本路由器到确认包的时间 RTO----------- 路由器在重新传输包之前等待 ACK 的时间 Q Cnt----------- 等待发送到队列 Seq------------ 从邻居收到的 EIGRP 数据包的序号 ( 四 )show ip eigrp topology R2#show ip eigrp topology IP-EIGRP Topology Table foras 1 Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply, r - Reply status P 172.31.12.0/30, 1 successors, FD is 2169856 via Connected, Serial0/0/0 P 172.31.1.0/24, 1 successors, FD is 2172416 via 172.31.12.1 (2172416/28160), Serial0/0/0 P 172.16.23.0/30, 1 successors, FD is 2169856 via Connected, Serial0/0/1 P 172.31.0.0/16, 1 successors, FD is 2169856 via Summary (2169856/0), Null0 P 172.16.0.0/16, 1 successors, FD is 2169856 via Summary (2169856/0), Null0 P 172.16.3.0/24, 1 successors, FD is 2172416 via 172.16.23.2 (2172416/28160), Serial0/0/1 P 172.16.34.0/30, 2 successors, FD is 2681856 via 172.16.23.2 (2681856/2169856), Serial0/0/1 via 172.16.24.2 (2681856/2169856), Serial0/1/0 P 172.16.24.0/30, 1 successors, FD is 2169856 via Connected, Serial0/1/0 P 172.16.4.0/24, 1 successors, FD is 2172416 via 172.16.24.2 (2172416/28160), Serial0/1/0 // 路由条目 172.16.4.0/24 处于被动状态,1 个后继路由器, 可行距离为 20514560, 通告距离为 28160, 下一跳地址 172.16.24.2, 本地出口 S0/0/0 五个状态代码的含义 :P--------A-------U--------Q----------SIA 60

第一部分 路由器实验 ( 五 )show ip eigrp interfaces R2#show ip eigrp interfaces IP-EIGRP interfaces for process 1 Xmit Queue Mean Pacing Time Multicast Pending Interface Peers Un/Reliable SRTT Un/Reliable Flow Timer Routes Se0/0/0 1 0/0 1236 0/10 0 0 Se0/0/1 1 0/0 1236 0/10 0 0 Se0/1/0 1 0/0 1236 0/10 0 0 // 各自段的含义 Interface------- 运行 EIGRP 协议的接口 Peers---------- 接口的邻居的个数 Xmit Queue Un/Reliable----------- 在不可靠 / 可靠队列中存留的数据包的数量 Mean SRTT-------- 平均的往返时间 ( 六 )show ip eigrp traffic R2#show ip eigrp traffic IP-EIGRP Traffic Statistics for process 1 Hellos sent/received: 3150/3137 // 发送和接收到 Hello 数据包 Updates sent/received: 16/13 Queries sent/received: 0/0 // 发送和接收到 update 数据包 // 发送和接收到 Query 数据包 Replies sent/received: 0/0 // 发送和接收到 Reply 数据包 Acks sent/received: 12/11 // 发送和接收到 Ack 数据包 Input queue high water mark 1, 0 drops SIA-Queries sent/received: 0/0 SIA-Replies sent/received: 0/0 ( 七 )debug eigrp packets EIGRP 的五种类型的数据包 : // 发送和接收到 SIA 数据包 // 发送和接收到 SIA Relay 数据包 Hello------- 以组播的方式定期发送, 用于建立和维持邻居关系 更新 ------- 当路由器收到某个邻居路由器的第一个 Hello 包时, 以单播传送方式回送一个包含 它所知道的路由信息的更新包 ; 当路由信息发生变化时, 以组播的方式发送只包含变化路由信息 的更新包查询 ------- 当一条链路失败, 路由器重新进行路由计算, 但在拓扑表中没有可行的后继路由 时, 路由器就以组播的方式向它的邻居发送一个查询包, 以询问它们是否有一条道目的地的后继 路由 答复 ------- 以单播的方式回传给查询方, 对查询数据包进行应答 确认 ------- 以单播的方式传送, 用来确认更新 查询和答复数据包 61

第一部分 路由器实验 实验 1-16.EIGRP 负载均衡 一 实验目的 ( 一 ) EIGRP 等价负载均衡的实现方法 ( 二 ) EIGRP 非等价负载的实现方法 ( 三 ) 修改 EIGRP 度量值的方法 ( 四 ) 可行距离 通告距离以及可行性条件的深层含义二 实验拓扑 三 实验步骤 Router>ena ( 一 ) 配置路由器 R1 Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#ip addr 172.16.14.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#router eigrp 1 End with CNTL/Z. 62

第一部分 路由器实验 R1(config-router)#network 172.16.12.0 0.0.0.255 R1(config-router)#network 172.16.14.0 0.0.0.255 R1(config-router)#no auto-summary Router>ena ( 二 ) 配置路由器 R2 Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int lo0 R2(config-if)#ip addr 172.16.2.2 255.255.255.0 R2(config-if)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router eigrp 1 R2(config-router)#network 172.16.2.0 0.0.0.255 R2(config-router)#network 172.16.12.0 0.0.0.255 R2(config-router)#network 172.16.23.0 0.0.0.255 R2(config-router)#no au Router>ena ( 三 ) 配置路由器 R3 Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int s0/0/0 R3(config-if)#ip addr 172.16.34.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router eigrp 1 R3(config-router)#network 172.16.23.0 0.0.0.255 R3(config-router)#network 172.16.34.0 0.0.0.255 R3(config-router)#no au ( 四 ) 配置路由器 R4 End with CNTL/Z. End with CNTL/Z. 63

第一部分 路由器实验 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int s0/0/0 R3(config-if)#ip addr 172.16.34.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router eigrp 1 R3(config-router)#network 172.16.23.0 0.0.0.255 R3(config-router)#network 172.16.34.0 0.0.0.255 R3(config-router)#no au 四 实验调试 ( 一 ) 查看路由表 R4#show ip route eigrp 172.16.0.0/24 is subnetted, 6 subnets End with CNTL/Z. D 172.16.2.0[90/2300416] via 172.16.14.1, 00:01:26, FastEthernet0/0 D D 172.16.12.0 [90/2172416] via 172.16.14.1, 00:01:26, FastEthernet0/0 172.16.23.0 [90/2681856] via 172.16.34.3, 00:01:26, Serial0/0/0 // 虽然路由器 R4 到达路由器 R2 有两条路径, 但是路由器会将 FD 最小的放入路由表, 选择走 F0/0 接口 R4#show ip eigrp topology IP-EIGRP Topology Table foras 1 P 172.16.4.0/24, 1 successors, FD is 128256 via Connected, Loopback0 P 172.16.14.0/24, 1 successors, FD is 28160 via Connected, FastEthernet0/0 P 172.16.34.0/24, 1 successors, FD is 2169856 via Connected, Serial0/0/0 P 172.16.12.0/24, 1 successors, FD is 2172416 via 172.16.14.1 (2172416/2169856), FastEthernet0/0 P 172.16.2.0/24, 1 successors, FD is 2300416 via 172.16.14.1 (2300416/2297856), FastEthernet0/0 via 172.16.34.3 (2809856/2297856), Serial0/0/0 P 172.16.23.0/24, 1 successors, FD is 2681856 via 172.16.34.3 (2681856/2169856), Serial0/0/0 ( 二 ) 等价负载 64

第一部分 路由器实验 EIGRP 即支持等价负载均衡, 又支持非等价负载均衡 R4(config)#router eigrp 1 R4(config-router)#variance 2 ( 三 ) 实习等价负载均衡 R4(config)#int f0/0 R4(config-if)#delay 2000 R4(config-if)#end R4#show ip route eigrp 172.16.0.0/24 is subnetted, 6 subnets D 172.16.2.0[90/2809856] via 172.16.34.3, 00:02:52, Serial0/0/0 [90/2809856] via 172.16.14.1, 00:00:08, FastEthernet0/0 D 172.16.12.0 [90/2681856] via 172.16.14.1, 00:00:08, FastEthernet0/0 D 172.16.23.0 [90/2681856] via 172.16.34.3, 00:02:52, Serial0/0/0 65

第一部分 路由器实验 实验 1-17. 向 EIGRP 网络中注入默认路由 一 实验目的 ( 一 ) 向 EIGRP 网络中注入默认路由的方法 ( 二 ) ip default-network 命令使用 ( 三 ) 重分布静态路由到 EIGRP 网络二 实验拓扑 三 实验步骤 在路由器 R1 路由器 R2 和路由器 R3 之间运行 EIGRP, 在路由器 R3 和路由器 R4 之间配置静态路由, 路由器 R4 模拟 ISP, 通过对边界路由器 R3 的配置, 使得路由器 R1 和路由器 R2 学习到一条 EIGRP 的默认路由 Router>ena ( 一 ) 配置路由器 R1 Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#router eigrp 1 R1(config-router)#network 172.16.1.0 0.0.0.255 R1(config-router)#network 172.16.12.0 0.0.0.255 R1(config-router)#no auto Router>ena ( 二 ) 配置路由器 R2 End with CNTL/Z. 66

第一部分 路由器实验 Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router eigrp 1 R2(config-router)#network 172.16.12.0 0.0.0.255 R2(config-router)#network 172.16.23.0 0.0.0.255 R2(config-router)#no au Router>ena ( 三 ) 配置路由器 R3 Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/0 R3(config-if)#ip addr 192.168.34.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router eigrp 1 R3(config-router)#network 172.16.23.0 0.0.0.255 R3(config-router)#network 192.168.34.0 R3(config-router)#no au R3(config-router)#exit R3(config)#ip route 0.0.0.0 0.0.0.0 s0/0/0 Router>ena ( 四 ) 配置路由器 R4 Router#conf t Enter configuration commands, one per line. Router(config)#host R4 R4(config)#int lo0 R4(config-if)#ip addr 192.168.4.4 255.255.255.0 R4(config-if)#int s0/0/0 End with CNTL/Z. End with CNTL/Z. End with CNTL/Z. 67

第一部分 路由器实验 R4(config-if)#ip addr 192.168.34.4 255.255.255.0 R4(config-if)#clock rate 128000 R4(config-if)#no shut R4(config-if)#exit R4(config)#ip route 172.16.0.0 255.255.0.0 s0/0/0 四 实验调试 ( 一 ) 通过 ip default-network 命令向 EIGRP 网络注入默认路由 R3(config)#ip default-network 192.168.34.0 R3(config)#router eigrp 1 R3(config-router)#network 192.168.34.0 R1#show ip route eigrp 172.16.0.0/24 is subnetted, 3 subnets D 172.16.23.0 [90/2681856] via 172.16.12.2, 00:09:38, Serial0/0/0 D* 192.168.34.0/24 [90/3193856] via 172.16.12.2, 00:00:50, Serial0/0/0 R2#show ip route eigrp 172.16.0.0/24 is subnetted, 3 subnets D 172.16.1.0 [90/2297856] via 172.16.12.1, 00:11:15, Serial0/0/0 D* 192.168.34.0/24 [90/2681856] via 172.16.23.3, 00:01:22, Serial0/0/1 R3#show ip route D D C 172.16.0.0/24 is subnetted, 3 subnets 172.16.1.0 [90/2809856] via 172.16.23.2, 00:09:47, Serial0/0/1 172.16.12.0 [90/2681856] via 172.16.23.2, 00:09:47, Serial0/0/1 172.16.23.0 is directly connected, Serial0/0/1 C* 192.168.34.0/24 is directly connected, Serial0/0/0 S* 0.0.0.0/0 is directly connected, Serial0/0/0 ( 二 ) 通过重分布静态默认路由向 EIGRP 网络注入默认路由 R3(config-router)#no ip default-network 192.168.34.0 R3(config)#router eigrp 1 R3(config-router)#no network 192.168.34.0 R3(config-router)#redistribute static R3(config-router)#exit R1#show ip route eigrp 172.16.0.0/24 is subnetted, 3 subnets D D 172.16.23.0 [90/2681856] via 172.16.12.2, 00:16:12, Serial0/0/0 192.168.34.0/24 [90/3193856] via 172.16.12.2, 00:02:12, Serial0/0/0 D*EX 0.0.0.0/0 [170/7801856] via 172.16.12.2, 00:01:29, Serial0/0/0 68

第一部分 路由器实验 R2#show ip route eigrp 172.16.0.0/24 is subnetted, 3 subnets D 172.16.1.0 [90/2297856] via 172.16.12.1, 00:16:46, Serial0/0/0 D 192.168.34.0/24 [90/2681856] via 172.16.23.3, 00:01:40, Serial0/0/1 D*EX 0.0.0.0/0 [170/7289856] via 172.16.23.3, 00:00:57, Serial0/0/1 69

第一部分 路由器实验 实验 1-18. 点到点链路上的 OSPF 一 实验目的 ( 一 ) 在路由器上启动 OSPF 路由进程 ( 二 ) 启用参与路由协议的接口, 使之可发送和接收 OSPF 更新 ( 三 )OSPF 度量值 (cost) 的计算 ( 四 )Hello 相关参数的配置 ( 五 ) 点到点链路上的 OSPF 的特征 ( 六 ) 查看和调试 OSPF 路由协议相关信息二 实验拓扑 三 实验步骤 (1) 配置路由器 R1 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int lo0 End with CNTL/Z. R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit 70

第一部分 路由器实验 R1(config)#router ospf 1 R1(config-router)#router-id? A.B.C.D // 启动 OSPF 进程 OSPF router-id in IP address format R1(config-router)#router-id 1.1.1.1 技术要点 OSPF 确定 Router ID 遵循如下顺序 : // 配置路由器 ID (1) 最优先的是在 OSPF 进程中用命令 router-id 指定了 Router ID (2) 若没有指定, 那么选择 IP 地址最大的环回接口的 IP 地址为 Router ID (3) 若没有环回接口, 就选择最大的活动的物理接口的 IP 地址为 Router ID R1(config-router)#network 172.16.1.0 0.0.0.255 area 0 R1(config-router)#network 172.16.12.0 0.0.0.255 area 0 (2) 配置路由器 R2 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int lo0 R2(config-if)#ip addr 172.16.2.2 255.255.255.0 R2(config-if)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 R2(config-router)#network 172.16.2.0 0.0.0.255 area 0 End with CNTL/Z. R2(config-router)#network 172.16.12.0 0.0.0.255 area 0 R2(config-router)#network 172.16.23.0 0.0.0.255 area 0 (3) 配置路由器 R3 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int lo0 R3(config-if)#ip addr 172.16.3.3 255.255.255.0 R3(config-if)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut End with CNTL/Z. 71

第一部分 路由器实验 R3(config-if)#int s0/0/0 R3(config-if)#ip addr 172.16.34.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router ospf 1 R3(config-router)#router-id 3.3.3.3 R3(config-router)#network 172.16.3.0 0.0.0.255 area 0 R3(config-router)#network 172.16.23.0 0.0.0.255 area 0 R3(config-router)#network 172.16.34.0 0.0.0.255 area 0 (4) 配置路由器 R4 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R4 R4(config)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config-if)#int s0/0/0 R4(config-if)#ip addr 172.16.34.4 255.255.255.0 R4(config-if)#clock rate 128000 R4(config-if)#no shut R4(config-if)#exit R4(config)#router ospf 1 R4(config-router)#rou R4(config-router)#router-id 4.4.4.4 R4(config-router)#network 172.16.4.0 0.0.0.255 area 0 End with CNTL/Z. R4(config-router)#network 172.16.34.0 0.0.0.255 area 0 四 实验调试 ( 一 )show ip route R1#show ip route ospf 172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks // 父路由 O 172.16.2.2 [110/65] via 172.16.12.2, 00:08:56, Serial0/0/0 // 子路由 O O O O 172.16.3.3 [110/129] via 172.16.12.2, 00:06:01, Serial0/0/0 172.16.4.4 [110/193] via 172.16.12.2, 00:02:31, Serial0/0/0 172.16.23.0 [110/128] via 172.16.12.2, 00:08:56, Serial0/0/0 172.16.34.0 [110/192] via 172.16.12.2, 00:03:16, Serial0/0/0 R2#show ip route ospf O O O O 172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks 172.16.1.1 [110/65] via 172.16.12.1, 00:09:59, Serial0/0/0 172.16.3.3 [110/65] via 172.16.23.3, 00:07:09, Serial0/0/1 172.16.4.4 [110/129] via 172.16.23.3, 00:03:34, Serial0/0/1 172.16.34.0 [110/128] via 172.16.23.3, 00:04:19, Serial0/0/1 72

第一部分 路由器实验 R3#show ip route ospf O O O O 172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks R4#show ip route 172.16.1.1 [110/129] via 172.16.23.2, 00:07:45, Serial0/0/1 172.16.2.2 [110/65] via 172.16.23.2, 00:07:45, Serial0/0/1 172.16.4.4 [110/65] via 172.16.34.4, 00:04:15, Serial0/0/0 172.16.12.0 [110/128] via 172.16.23.2, 00:07:45, Serial0/0/1 172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks O 172.16.1.1/32 [110/193] via 172.16.34.4, 00:05:24, Serial0/0/0 O O C O O 172.16.2.2/32 [110/129] via 172.16.34.4, 00:05:24, Serial0/0/0 172.16.3.3/32 [110/65] via 172.16.34.4, 00:05:24, Serial0/0/0 172.16.4.0/24 is directly connected, Loopback0 172.16.12.0/24 [110/192] via 172.16.34.4, 00:05:24, Serial0/0/0 172.16.23.0/24 [110/128] via 172.16.34.4, 00:05:24, Serial0/0/0 C 172.16.34.0/24 is directly connected, Serial0/0/0 // 环回接口所在网络的 OSPF 路由条目的掩码长度都是 32 位 ( 二 )show ip protocols R2#show ip protocols Routing Protocol is "ospf 1" // 当前路由器运行的 OSPF 进程 ID Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 2.2.2.2 // 本地路由器 ID Number of areas in this router is 1. 1 normal 0 stub 0 nssa Maximum path: 4 Routing for Networks: 172.16.2.0 0.0.0.255 area 0 172.16.12.0 0.0.0.255 area 0 172.16.23.0 0.0.0.255 area 0 Routing Information Sources: Gateway Distance Last Update 172.16.12.1 110 00:14:20 172.16.23.3 110 00:14:23 Distance: (default is 110) ( 三 )show ip ospf R2#show ip ospf Routing Process "ospf 1" with ID 2.2.2.2 // 区域数量和区域类型 // 路由进程 ID 和路由器 ID Supports only single TOS(TOS0) routes // 提供支持的服务类型号, 只为 0 Supports opaque LSA SPF schedule delay 5 secs, Hold time between two SPFs 10 secs Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs Number of external LSA 0. Checksum Sum 0x000000 Number of opaque AS LSA 0. Checksum Sum 0x000000 73

第一部分 路由器实验 Number of DCbitless external and opaque AS LSA 0 Number of DoNotAge external and opaque AS LSA 0 Number of areas in this router is 1. 1 normal 0 stub 0 nssa External flood list length 0 Area BACKBONE(0) Number of interfaces in this area is 3 Area has no authentication SPF algorithm executed 5 times Area ranges are // 主干区域 Number of LSA 4. Checksum Sum 0x01bb3f Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 ( 四 )show ip ospf interface R2#show ip ospf interface Loopback0 is up, line protocol is up Internet address is 172.16.2.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network Type LOOPBACK, Cost: 1 Loopback interface is treated as a stub Host Serial0/0/0 is up, line protocol is up Internet address is 172.16.12.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network TypePOINT-TO-POINT, Cost: 64 Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0 No designated router on this network No backup designated router on this network Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:06 Index 2/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 1.1.1.1 Suppress hello for 0 neighbor(s) Serial0/0/1 is up, line protocol is up Internet address is 172.16.23.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network TypePOINT-TO-POINT, Cost: 64 Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0 No designated router on this network No backup designated router on this network Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 74

第一部分 路由器实验 Hello due in 00:00:00 Index 3/3, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 3.3.3.3 Suppress hello for 0 neighbor(s) ( 五 )show ip ospf neighbor R2# show ip ospf neighbor Neighbor ID Pri State Dead Time Address Interface 1.1.1.1 0 FULL/ - 00:00:38 172.16.12.1 Serial0/0/0 3.3.3.3 0 FULL/ - 00:00:39 172.16.23.3 Serial0/0/1 技术要点 OSPF 邻居关系不能建立的常见原因 : (1)Hello 间隔和 Dead 间隔不同 (2) 区域 ID 不一样 (3) 特殊区域区域类型不匹配 (4) 验证类型或密码不一致 (5) 路由器 ID 相同 (6)Hello 包被 ACL 拒绝 (7) 链路上的 MTU 不匹配 (8) 接口下 OSPF 网络类型不匹配 ( 六 )show ip ospf database R2#show ip ospf database OSPF Router with ID (2.2.2.2) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 2.2.2.2 2.2.2.2 1750 0x80000005 0x007480 5 3.3.3.3 3.3.3.3 1542 0x80000005 0x00d1e1 5 4.4.4.4 4.4.4.4 1542 0x80000003 0x0035cb 3 1.1.1.1 1.1.1.1 116 0x80000004 0x00feff 3 75

第一部分 路由器实验 实验 1-19. 基于区域的 OSPF 简单口令认证 一 实验目的 ( 一 )OSPF 验证的类型和意义 ( 二 ) 基于区域的 OSPF 简单口令验证的配置和测试二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#router-id 1.1.1.1 End with CNTL/Z. R1(config-router)#network 172.16.1.0 0.0.0.255 area 0 R1(config-router)#network 172.16.12.0 0.0.0.255 area 0 R1(config-router)#area 0 authentication R1(config-router)#int s0/0/0 R1(config-if)#ip ospf? authentication authentication-key cost dead-interval hello-interval message-digest-key Enable authentication Authentication password (key) Interface cost // 区域 0 启用简单口令认证 Interval after which a neighbor is declared dead Time between HELLO packets Message digest authentication password (key) 76

第一部分 network Network type priority Router priority R1(config-if)#ip ospf authentication-key cisco 路由器实验 // 配置验证密码 ( 二 ) 配置路由器 R2 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int lo0 R2(config-if)#ip addr 172.16.2.2 255.255.255.0 R2(config-if)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shu R2(config-if)#exit R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 R2(config-router)#network 172.16.2.0 0.0.0.255 area 0 End with CNTL/Z. R2(config-router)#network 172.16.12.0 0.0.0.255 area 0 R2(config-router)#area 0 authentication R2(config-router)#int s0/0/0 R2(config-if)#ip ospf authentication-key cisco 四 实验调试 ( 一 )show ip ospf interface R2#show ip ospf interface Loopback0 is up, line protocol is up Internet address is 172.16.2.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network TypeLOOPBACK, Cost: 1 Loopback interface is treated as a stub Host Serial0/0/0 is up, line protocol is up Internet address is 172.16.12.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network TypePOINT-TO-POINT, Cost: 781 Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0 No designated router on this network No backup designated router on this network Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:09 Index 2/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec 77

第一部分 路由器实验 Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 1.1.1.1 Suppress hello for 0 neighbor(s) Simple password authentication enabled // 该信息表明了该接口启用了简单口令认证 ( 二 )show ip ospf R1#show ip ospf Routing Process "ospf 1" with ID 1.1.1.1 Supports only single TOS(TOS0) routes Supports opaque LSA SPF schedule delay 5 secs, Hold time between two SPFs 10 secs Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs Number of external LSA 0. Checksum Sum 0x000000 Number of opaque AS LSA 0. Checksum Sum 0x000000 Number of DCbitless external and opaque AS LSA 0 Number of DoNotAge external and opaque AS LSA 0 Number of areas in this router is 1. 1 normal 0 stub 0 nssa External flood list length 0 Area BACKBONE(0) Number of interfaces in this area is 2 Area has simple password authentication SPF algorithm executed 3 times Area ranges are Number of LSA 2. Checksum Sum 0x00e578 Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 78

第一部分 路由器实验 实验 1-20. 基于区域的 OSPF MD5 认证 一 实验目的 ( 一 )OSPF 验证的类型和意义 ( 二 ) 基于区域的 OSPF MD5 验证的配置和测试二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#router-id 1.1.1.1 R1(config-router)#network 172.16.1.0 0.0.0.255 area 0 End with CNTL/Z. R1(config-router)#network 172.16.12.0 0.0.0.255 area 0 R1(config-router)#area 0 authentication message-digest R1(config-router)#int s0/0/0 R1(config-if)#ip ospf message-digest-key? <1-255> Key ID R1(config-if)#ip ospf message-digest-key 1? md5 Use MD5 algorithm R1(config-if)#ip ospf message-digest-key 1 md5? LINE The OSPF password (key) (maximum 16 characters) // 区域 0 启用 MD5 验证 79

第一部分 路由器实验 R1(config-if)#ip ospf message-digest-key 1 md5 cisco // 配置验证 KEY ID 及密钥 ( 二 ) 配置路由器 R2 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int lo0 R2(config-if)#ip addr 172.16.2.2 255.255.255.0 R2(config-if)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 R2(config-router)#network 172.16.2.0 0.0.0.255 area 0 End with CNTL/Z. R2(config-router)#network 172.16.12.0 0.0.0.255 area 0 R2(config-router)#area 0 authentication message-digest R2(config-router)#int s0/0/0 R2(config-if)#ip ospf message-digest-key 1 md5 cisco 四 实验调试 ( 一 )show ip ospf interface R2#show ip ospf interface Loopback0 is up, line protocol is up Internet address is 172.16.2.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network TypeLOOPBACK, Cost: 1 Loopback interface is treated as a stub Host Serial0/0/0 is up, line protocol is up Internet address is 172.16.12.2/24, Area 0 Process ID 1, Router ID 2.2.2.2, Network TypePOINT-TO-POINT, Cost: 781 Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0 No designated router on this network No backup designated router on this network Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 Hello due in 00:00:08 Index 2/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 1, Adjacent neighbor count is 1 Adjacent with neighbor 1.1.1.1 80

第一部分 路由器实验 Suppress hello for 0 neighbor(s) Message digest authentication enabled Youngest key id is 1 ( 二 )show ip ospf R1#show ip ospf Routing Process "ospf 1" with ID 1.1.1.1 Supports only single TOS(TOS0) routes Supports opaque LSA SPF schedule delay 5 secs, Hold time between two SPFs 10 secs Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs Number of external LSA 0. Checksum Sum 0x000000 Number of opaque AS LSA 0. Checksum Sum 0x000000 Number of DCbitless external and opaque AS LSA 0 Number of DoNotAge external and opaque AS LSA 0 Number of areas in this router is 1. 1 normal 0 stub 0 nssa External flood list length 0 Area BACKBONE(0) Number of interfaces in this area is 2 Area has message digest authentication SPF algorithm executed 3 times Area ranges are Number of LSA 2. Checksum Sum 0x00e578 Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 ( 三 )debug ip ospf events R2#debug ip ospf events OSPF events debugging is on R2# 02:25:26: OSPF: Rcv hello from 1.1.1.1 area 0 from Serial0/0/0 172.16.12.1 02:25:26: OSPF: End of hello processing 02:25:27: OSPF: Send with youngest Key 1 81

第一部分 路由器实验 实验 1-21.default-information originate 一 实验目的 通过命令 default-information originate 向 OSPF 网络注入一条默认命 令 二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int s0/0/1 R1(config-if)#no shut R1(config-if)#int lo1 R1(config-if)#ip addr 202.96.1.1 255.255.255.0 R1(config-if)#ip route 0.0.0.0 0.0.0.0 lo1 R1(config)#router ospf 1 End with CNTL/Z. R1(config-router)#network 172.16.1.0 0.0.0.255 area 0 R1(config-router)#network 172.16.12.0 0.0.0.255 area 0 R1(config-router)#default-information originate ( 二 ) 配置路由器 R2 Router>ena Router#conf t 82

第一部分 路由器实验 Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int lo0 R2(config-if)#ip addr 172.16.2.2 255.255.255.0 R2(config-if)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router ospf 1 End with CNTL/Z. R2(config-router)#router-id 2.2.2.2 R2(config-router)#network 172.16.2.0 0.0.0.255 area 0 R2(config-router)#network 172.16.12.0 0.0.0.255 area 0 R2(config-router)#network 172.16.23.0 0.0.0.255 area 0 ( 三 ) 配置路由器 R3 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int lo0 R3(config-if)#ip addr 172.16.3.3 255.255.255.0 R3(config-if)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/0 R3(config-if)#ip addr 172.16.34.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router ospf 1 End with CNTL/Z. R3(config-router)#router-id 3.3.3.3 R3(config-router)#network 172.16.3.0 0.0.0.255 area 0 R3(config-router)#network 172.16.23.0 0.0.0.255 area 0 R3(config-router)#network 172.16.34.0 0.0.0.255 area 0 ( 四 ) 配置路由器 R4 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R4 End with CNTL/Z. 83

第一部分 路由器实验 R4(config)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config-if)#int s0/0/0 R4(config-if)#ip addr 172.16.34.4 255.255.255.0 R4(config-if)#clock rate 128000 R4(config-if)#no shut R4(config-if)#exit R4(config)#router ospf 1 R4(config-router)#router-id 4.4.4.4 R4(config-router)#network 172.16.4.0 0.0.0.255 area 0 R4(config-router)#network 172.16.34.0 0.0.0.255 area 0 四 实验调试 ( 一 )show ip route R4#show ip route Gateway of last resort is 172.16.34.3 to network 0.0.0.0 O O O C O O 172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks 172.16.1.1/32 [110/193] via 172.16.34.3, 00:10:52, Serial0/0/0 172.16.2.2/32 [110/129] via 172.16.34.3, 00:22:25, Serial0/0/0 172.16.3.3/32 [110/65] via 172.16.34.3, 00:22:25, Serial0/0/0 172.16.4.0/24 is directly connected, Loopback0 172.16.12.0/24 [110/192] via 172.16.34.3, 00:22:25, Serial0/0/0 172.16.23.0/24 [110/128] via 172.16.34.3, 00:22:25, Serial0/0/0 C 172.16.34.0/24 is directly connected, Serial0/0/0 O*E2 0.0.0.0/0 [110/1] via 172.16.34.3, 00:10:52, Serial0/0/0 ( 二 )show ip ospf database R4#show ip ospf database OSPF Router with ID (4.4.4.4) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 4.4.4.4 4.4.4.4 1687 0x80000003 0x0035cb 3 3.3.3.3 3.3.3.3 1687 0x80000005 0x009f15 5 2.2.2.2 2.2.2.2 1007 0x80000005 0x00e1e9 5 202.96.1.1 202.96.1.1 1006 0x80000004 0x007884 3 Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 0.0.0.0 202.96.1.1 1006 0x80000001 0x00ebb9 1 84

第一部分 路由器实验 实验 1-22. 多区域 OSPF 基本配置 一 实验目的 ( 一 ) 在路由器上启动 OSPF 路由进程 ( 二 ) 启用参与路由协议的接口, 使之发送和接收 OSPF 路由更新 ( 三 )LSA 的类型和特征 ( 四 ) 不同路由器类型的功能 ( 五 )OSPF 拓扑结构数据库的特征和含义 ( 六 )E1 路由和 E2 路由的区别 ( 七 ) 查看和调试 OSPF 路由协议相关信息二 实验拓扑 三 实验步骤配置时采用环回接口尽量靠近区域 0 的原则, 路由器 R4 的环回接口不再 OSPF 进程中通告, 通过重分布的方法进入 OSPF 网络 ( 一 ) 配置路由器 R1 Router>ena Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 85

第一部分 路由器实验 R1(config-if)#no shut R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#router-id 1.1.1.1 R1(config-router)#network 172.16.1.0 0.0.0.255 area 1 R1(config-router)#network 172.16.12.0 0.0.0.255 area 1 ( 二 ) 配置路由器 R2 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int lo0 End with CNTL/Z. %LINK-5-CHANGED: Interface Loopback0, changed state to up R2(config-if)# %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up R2(config-if)#ip addr 172.16.2.2 255.255.255.0 R2(config-if)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 R2(config-router)#network 172.16.12.0 0.0.0.255 area 1 00:24:22: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on Serial0/0/0 from LOADING to FULL, Loading Done R2(config-router)#network 172.16.23.0 0.0.0.255 area 0 R2(config-router)#network 172.16.2.0 0.0.0.255 area 0 ( 三 ) 配置路由器 R3 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int lo0 R3(config-if)#ip addr 172.16.3.3 255.255.255.0 R3(config-if)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut End with CNTL/Z. 86

第一部分 路由器实验 R3(config-if)#int s0/0/0 R3(config-if)#ip addr 172.16.34.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router ospf 1 R3(config-router)#router-id 3.3.3.3 R3(config-router)#network 172.16.23.0 0.0.0.255 area 0 R3(config-router)#network 172.16.3.0 0.0.0.255 area 0 R3(config-router)#network 172.16.34.0 0.0.0.255 area 2 ( 四 ) 配置路由器 R4 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R4 R4(config)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config-if)#int s0/0/0 R4(config-if)#ip addr 172.16.34.4 255.255.255.0 R4(config-if)#clock rate 128000 R4(config-if)#no shut R4(config-if)#exit R4(config)#router ospf 1 R4(config-router)#router-id 4.4.4.4 End with CNTL/Z. R4(config-router)#network 172.16.34.0 0.0.0.255 area 2 R4(config-router)#redistribute connected subnets // 将直连路由重分布到 OSPF 网络 四 实验调试 ( 一 )show ip route ospf R2#show ip route ospf O O O E2 O IA 172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks 172.16.1.1 [110/65] via 172.16.12.1, 00:13:49, Serial0/0/0 172.16.3.3 [110/65] via 172.16.23.3, 00:10:53, Serial0/0/1 172.16.4.0 [110/20] via 172.16.23.3, 00:07:42, Serial0/0/1 172.16.34.0 [110/128] via 172.16.23.3, 00:08:21, Serial0/0/1 R3#show ip route ospf 172.16.0.0/16 is variably subnetted, 7 subnets, 2 masks O IA 172.16.1.1 [110/129] via 172.16.23.2, 00:13:37, Serial0/0/1 O 172.16.2.2 [110/65] via 172.16.23.2, 00:13:37, Serial0/0/1 O E2 172.16.4.0 [110/20] via 172.16.34.4, 00:10:26, Serial0/0/0 O IA 172.16.12.0 [110/128] via 172.16.23.2, 00:13:37, Serial0/0/1 O 的路由是区域内的路由 87

第一部分 路由器实验 O IA 的路由是区域间的路由 O E2 的路由是外部自治系统被重分布到 OSPF 中的路由 ( 二 )show ip ospf database R1#show ip ospf database OSPF Router with ID (1.1.1.1) (Process ID 1) Router Link States (Area 1) // 区域 1 类型 1 的 LSA Link ID ADV Router Age Seq# Checksum Link count 1.1.1.1 1.1.1.1 1189 0x80000003 0x003f13 3 2.2.2.2 2.2.2.2 1178 0x80000003 0x00c259 2 Summary Net Link States (Area 1) // 区域 1 类型 3 的 LSA Link ID ADV Router Age Seq# Checksum 172.16.2.2 2.2.2.2 1164 0x80000001 0x00a7ed 172.16.23.0 2.2.2.2 1069 0x80000002 0x004af7 172.16.3.3 2.2.2.2 1010 0x80000003 0x001140 172.16.34.0 2.2.2.2 860 0x80000004 0x004fa5 Type-5 AS External Link States // 区域 1 类型 5 的 LSA Link ID ADV Router Age Seq# Checksum Tag 172.16.4.0 172.16.4.4 503 0x80000002 0x004fea 0 R2#show ip ospf database OSPF Router with ID (2.2.2.2) (Process ID 1) Router Link States (Area 0) // 区域 0 类型 1 的 LSA Link ID ADV Router Age Seq# Checksum Link count 2.2.2.2 2.2.2.2 1260 0x80000003 0x00f536 3 3.3.3.3 3.3.3.3 1246 0x80000004 0x008e95 3 Summary Net Link States (Area 0) // 区域 0 类型 3 的 LSA Link ID ADV Router Age Seq# Checksum 172.16.12.0 2.2.2.2 1408 0x80000001 0x00c588 172.16.1.1 2.2.2.2 1408 0x80000002 0x003d19 172.16.34.0 3.3.3.3 1100 0x80000001 0x00b47f Summary ASB Link States (Area 0) // 区域 0 类型 4 的 LSA Link ID ADV Router Age Seq# Checksum 172.16.4.4 3.3.3.3 1066 0x80000002 0x00c784 Router Link States (Area 1) // 区域 1 类型 1 的 LSA 88

第一部分 路由器实验 Link ID ADV Router Age Seq# Checksum Link count 1.1.1.1 1.1.1.1 1423 0x80000003 0x003f13 3 2.2.2.2 2.2.2.2 1412 0x80000003 0x00c259 2 Summary Net Link States (Area 1) // 区域 1 类型 3 的 LSA Link ID ADV Router Age Seq# Checksum 172.16.2.2 2.2.2.2 1399 0x80000001 0x00a7ed 172.16.23.0 2.2.2.2 1304 0x80000002 0x004af7 172.16.3.3 2.2.2.2 1244 0x80000003 0x001140 172.16.34.0 2.2.2.2 1094 0x80000004 0x004fa5 Type-5 AS External Link States // 区域 1 类型 5 的 LSA Link ID ADV Router Age Seq# Checksum Tag 172.16.4.0 172.16.4.4 738 0x80000002 0x004fea 0 R3#show ip ospf database OSPF Router with ID (3.3.3.3) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 2.2.2.2 2.2.2.2 1437 0x80000003 0x00f536 3 3.3.3.3 3.3.3.3 1423 0x80000004 0x008e95 3 Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 172.16.12.0 2.2.2.2 1585 0x80000001 0x00c588 172.16.1.1 2.2.2.2 1585 0x80000002 0x003d19 172.16.34.0 3.3.3.3 1277 0x80000001 0x00b47f Summary ASB Link States (Area 0) Link ID ADV Router Age Seq# Checksum 172.16.4.4 3.3.3.3 1243 0x80000002 0x00c784 Router Link States (Area 2) Link ID ADV Router Age Seq# Checksum Link count 3.3.3.3 3.3.3.3 1252 0x80000002 0x00d84e 2 172.16.4.4 172.16.4.4 1247 0x80000003 0x000d5e 2 Summary Net Link States (Area 2) 89

第一部分 路由器实验 Link ID ADV Router Age Seq# Checksum 172.16.23.0 3.3.3.3 1421 0x80000001 0x002e11 172.16.3.3 3.3.3.3 1421 0x80000002 0x00721c 172.16.2.2 3.3.3.3 1421 0x80000003 0x000847 172.16.12.0 3.3.3.3 1421 0x80000004 0x0024e2 172.16.1.1 3.3.3.3 1421 0x80000005 0x009b73 Type-5 AS External Link States // 区域 2 类型 5 的 LSA Link ID ADV Router Age Seq# Checksum Tag 172.16.4.0 172.16.4.4 915 0x80000002 0x004fea 0 R4#show ip ospf database OSPF Router with ID (172.16.4.4) (Process ID 1) Router Link States (Area 2) // 区域 2 类型 1 的 LSA Link ID ADV Router Age Seq# Checksum Link count 3.3.3.3 3.3.3.3 1365 0x80000002 0x00d84e 2 172.16.4.4 172.16.4.4 1361 0x80000003 0x000d5e 2 Summary Net Link States (Area 2) Link ID ADV Router Age Seq# Checksum 172.16.23.0 3.3.3.3 1534 0x80000001 0x002e11 172.16.3.3 3.3.3.3 1534 0x80000002 0x00721c 172.16.2.2 3.3.3.3 1534 0x80000003 0x000847 172.16.12.0 3.3.3.3 1534 0x80000004 0x0024e2 172.16.1.1 3.3.3.3 1534 0x80000005 0x009b73 Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 172.16.4.0 172.16.4.4 1028 0x80000002 0x004fea 0 ( 三 )show ip ospf R4#show ip ospf 1 Routing Process "ospf 1" with ID 172.16.4.4 Supports only single TOS(TOS0) routes Supports opaque LSA SPF schedule delay 5 secs, Hold time between two SPFs 10 secs Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs Number of external LSA 2. Checksum Sum 0x009fd4 Number of opaque AS LSA 0. Checksum Sum 0x000000 Number of DCbitless external and opaque AS LSA 0 Number of DoNotAge external and opaque AS LSA 0 90

第一部分 路由器实验 Number of areas in this router is 1. 1 normal 0 stub 0 nssa External flood list length 0 Area 2 Number of interfaces in this area is 1 Area has no authentication SPF algorithm executed 3 times Area ranges are Number of LSA 7. Checksum Sum 0x024e75 Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 91

第一部分 路由器实验 实验 1-23.OSPF 末节区域和完全末节区域 一 实验目的 ( 一 ) 末节区域的条件 ( 二 ) 末节区域的特征 ( 三 ) 完全末节区域的特征 ( 四 ) 末节区域的配置 ( 五 ) 完全末节区域的配置二 实验拓扑 三 实验步骤 在路由器 R2 上将环回接口 0 以重分布的方式注入 OSPF 区域, 用来构 造 5 类的 LSA, 故路由器 R2 既是 ABR, 又是 ASBR, 将区域 1 配置成末节区 域, 将区域 2 配置成完全末节区域 ( 一 ) 配置路由器 R1 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 End with CNTL/Z. 92

第一部分 路由器实验 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#router ospf 1 R1(config-router)#router-id 1.1.1.1 R1(config-router)#network 172.16.1.0 255.255.255.0 area 1 R1(config-router)#network 172.16.12.0 255.255.255.0 area 1 R1(config-router)#area 1 stub ( 二 ) 配置路由器 R2 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R2 // 区域 1 配置成末节区域 R2(config)#int lo0 R2(config-if)#ip addr 172.16.2.2 255.255.255.0 R2(config-if)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 End with CNTL/Z. R2(config-router)#network 172.16.12.0 255.255.255.0 area 1 R2(config-router)#network 172.16.23.0 255.255.255.0 area 0 R2(config-router)#redistribute connected subnets R2(config-router)#area 1 stub ( 三 ) 配置路由器 R3 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R3 R3(config)#int lo0 R3(config-if)#ip addr 172.16.3.3 255.255.255.0 R3(config-if)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/0 R3(config-if)#ip addr 172.16.34.3 255.255.255.0 // 将直连路由重分布到 OSPF 区域 End with CNTL/Z. 93

第一部分 路由器实验 R3(config-if)#no shut R3(config-if)#exit R3(config)#router ospf 1 R3(config-router)#router-id 3.3.3.3 R3(config-router)#network 172.16.3.0 255.255.255.0 area 0 R3(config-router)#network 172.16.23.0 255.255.255.0 area 0 R3(config-router)#network 172.16.34.0 255.255.255.0 area 2 R3(config-router)#area 2 stub no-summary ( 四 ) 配置路由器 R4 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R4 R4(config)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config-if)#int s0/0/0 R4(config-if)#ip addr 172.16.34.4 255.255.255.0 R4(config-if)#clock rate 128000 R4(config-if)#no shut // 将区域 2 配置成完全末节区域 End with CNTL/Z. R4(config-if)#exit R4(config)#router ospf 1 R4(config-router)#router-id 4.4.4.4 R4(config-router)#network 172.16.4.0 0.0.0.255 area 2 R4(config-router)#network 172.16.34.0 0.0.0.255 area 2 R4(config-router)#area 2 stub 技术要点 末节和完全末节区域需要满足的条件 : 区域只有一个出口 区域不需要作为虚链路的过渡区 区域内没有 ASBR 区域不是主干区域 四 实验调试 ( 一 )show ip route ospf R1#show ip route ospf 172.16.0.0/16 is variably subnetted, 6 subnets, 2 masks O IA O IA O IA 172.16.3.3 [110/129] via 172.16.12.2, 00:06:49, Serial0/0/0 172.16.4.4 [110/193] via 172.16.12.2, 00:02:29, Serial0/0/0 172.16.23.0 [110/128] via 172.16.12.2, 00:08:49, Serial0/0/0 94

第一部分 路由器实验 O IA 172.16.34.0 [110/192] via 172.16.12.2, 00:03:49, Serial0/0/0 O*IA 0.0.0.0/0 [110/65] via 172.16.12.2, 00:11:30, Serial0/0/0 // 末节区域可以接收区域间路由, 不接收外部自治系统的路由 R4#show ip route ospf O*IA 0.0.0.0/0 [110/65] via 172.16.34.3, 00:04:55, Serial0/0/0 // 完全末节区域不接收外部路由和区域间路由 ( 二 )show ip ospf R1#show ip ospf 1 [ 略 ] Area 1 Number of interfaces in this area is 2 It is a stub area Area has no authentication SPF algorithm executed 8 times Area ranges are Number of LSA 7. Checksum Sum 0x0283d1 Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 R3#show ip ospf 1 Routing Process "ospf 1" with ID 3.3.3.3 Supports only single TOS(TOS0) routes Supports opaque LSA It is an area border router SPF schedule delay 5 secs, Hold time between two SPFs 10 secs Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs Number of external LSA 1. Checksum Sum 0x00f207 Number of opaque AS LSA 0. Checksum Sum 0x000000 Number of DCbitless external and opaque AS LSA 0 Number of DoNotAge external and opaque AS LSA 0 Number of areas in this router is 2. 1 normal 1 stub 0 nssa External flood list length 0 Area BACKBONE(0) Number of interfaces in this area is 2 Area has no authentication SPF algorithm executed 5 times Area ranges are Number of LSA 6. Checksum Sum 0x039ea3 Number of opaque link LSA 0. Checksum Sum 0x000000 95

第一部分 路由器实验 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 Area 2 Number of interfaces in this area is 1 It is a stub area generates stub default route with cost 1 Area has no authentication SPF algorithm executed 4 times Area ranges are Number of LSA 3. Checksum Sum 0x0142e7 Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 96

第一部分 路由器实验 实验 1-24.OSPF NSSA 区域 一 实验目的 ( 一 )NSSA 区域的特征 ( 二 )NSSA 区域的配置 ( 三 )NSSA 产生默认路由的方法二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 R1(config)#router ospf 1 R1(config-router)#router-id 1.1.1.1 R1(config-router)#network 172.16.12.0 0.0.0.255 area 1 R1(config-router)#redistribute connected subnets R1(config-router)#area 1 nssa // 将区域 1 配置成 NSSA 区域 ( 二 ) 配置路由器 R2 R2(config)#router ospf 1 R2(config-router)#router-id 2.2.2.2 R2(config-router)#network 172.16.2.0 0.0.0.255 area 0 R2(config-router)#network 172.16.12.0 0.0.0.255 area 1 R2(config-router)#network 172.16.23.0 0.0.0.255 area 0 R2(config-router)#area 1 nssa ( 三 ) 配置路由器 R3 R3(config)#router ospf 1 R3(config-router)#router-id 3.3.3.3 R3(config-router)#network 172.16.23.0 0.0.0.255 area 0 97

第一部分 路由器实验 R3(config-router)#redistribute eigrp 1 subnets R3(config-router)#router eigrp 1 R3(config-router)#redistribute ospf 1 metric? <1-4294967295> Bandwidth metric in Kbits per second R3(config-router)#redistribute ospf 1 metric 1000 R3(config-router)#redistribute ospf 1 metric 1000? <0-4294967295> EIGRP delay metric, in 10 microsecond units R3(config-router)#redistribute ospf 1 metric 1000 100? <0-255> EIGRP reliability metric where 255 is 100% reliable // 将 EIGRP 路由重分布到 OSPF 区域 R3(config-router)#redistribute ospf 1 metric 1000 100 255? <1-255> EIGRP Effective bandwidth metric (Loading) where 255 is 100% loaded R3(config-router)#redistribute ospf 1 metric 1000 100 255 1? <1-65535> EIGRP MTU of the path R3(config-router)#redistribute ospf 1 metric 1000 100 255 1 1500 // 将 OSPF 路由 重分布到 EIGRP 中 R3(config-router)#network 192.168.34.0 R3(config-router)#no auto-summary ( 四 ) 配置路由器 R4 R4(config)#router eigrp 1 R4(config-router)#network 192.168.4.0 R4(config-router)#network 192.168.34.0 R4(config-router)#no auto-summary 四 实验调试 ( 一 ) 查看 R1 路由表 R1#show ip route ospf O IA O IA 172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks 172.16.2.2 [110/65] via 172.16.12.2, 00:10:17, Serial0/0/0 172.16.23.0 [110/128] via 172.16.12.2, 00:10:17, Serial0/0/0 //LSA 类型为 5 的外部路由不能在 NSSA 区域中传播,ABR 也没有能力把类型 5 的 LSA 转变成 类型 7 的 LSA 再 R2 添加一条路由 :R2(config-router)#area 1 nssa no-summary 则 :R1#show ip route ospf O*IA 0.0.0.0/0 [110/65] via 172.16.12.2, 00:00:00, Serial0/0/0 ( 二 ) 查看 R2 路由表 R2#show ip route ospf 172.16.0.0/24 is subnetted, 4 subnets O N2 172.16.1.0 [110/20] via 172.16.12.1, 00:00:59, Serial0/0/0 ( 三 ) 查看 R3 路由表 R3#show ip route ospf 98

第一部分 路由器实验 O E2 O O IA 172.16.0.0/16 is variably subnetted, 6 subnets, 2 masks 172.16.1.0 [110/20] via 172.16.23.2, 00:04:02, Serial0/0/1 172.16.2.2 [110/65] via 172.16.23.2, 00:22:56, Serial0/0/1 172.16.12.0 [110/128] via 172.16.23.2, 00:22:56, Serial0/0/1 ( 四 ) 查看 R2 拓扑表 R2#show ip ospf database OSPF Router with ID (2.2.2.2) (Process ID 1) Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 2.2.2.2 2.2.2.2 1452 0x80000004 0x00f92f 3 3.3.3.3 3.3.3.3 1452 0x80000002 0x001ddd 2 Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 172.16.12.0 2.2.2.2 1514 0x80000001 0x00c588 Summary ASB Link States (Area 0) Link ID ADV Router Age Seq# Checksum 1.1.1.1 2.2.2.2 306 0x8000000d 0x00c170 Router Link States (Area 1) Link ID ADV Router Age Seq# Checksum Link count 2.2.2.2 2.2.2.2 316 0x80000004 0x00c652 2 1.1.1.1 1.1.1.1 316 0x80000005 0x0022fb 2 Summary Net Link States (Area 1) Link ID ADV Router Age Seq# Checksum 172.16.2.2 2.2.2.2 343 0x80000004 0x00a1f0 172.16.23.0 2.2.2.2 343 0x80000005 0x0044fa Type-7 AS External Link States (Area 1) Link ID ADV Router Age Seq# Checksum Tag 172.16.1.0 1.1.1.1 1608 0x80000002 0x002ff9 0 Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 172.16.1.0 2.2.2.2 316 0x80000002 0x00c36d 0 R2# R2#show ip ospf database OSPF Router with ID (2.2.2.2) (Process ID 1) 99

第一部分 路由器实验 Router Link States (Area 0) Link ID ADV Router Age Seq# Checksum Link count 2.2.2.2 2.2.2.2 82 0x80000005 0x00feff 3 3.3.3.3 3.3.3.3 18 0x80000004 0x001fd7 2 Summary Net Link States (Area 0) Link ID ADV Router Age Seq# Checksum 172.16.12.0 2.2.2.2 144 0x80000010 0x00e20e Summary ASB Link States (Area 0) Link ID ADV Router Age Seq# Checksum 1.1.1.1 2.2.2.2 8 0x80000016 0x00af79 Router Link States (Area 1) Link ID ADV Router Age Seq# Checksum Link count 2.2.2.2 2.2.2.2 748 0x80000004 0x00c652 2 1.1.1.1 1.1.1.1 748 0x80000005 0x0022fb 2 Summary Net Link States (Area 1) Link ID ADV Router Age Seq# Checksum 172.16.2.2 2.2.2.2 775 0x80000004 0x00a1f0 172.16.23.0 2.2.2.2 775 0x80000005 0x0044fa Type-7 AS External Link States (Area 1) Link ID ADV Router Age Seq# Checksum Tag 172.16.1.0 1.1.1.1 239 0x80000003 0x00feff 0 Type-5 AS External Link States Link ID ADV Router Age Seq# Checksum Tag 192.168.34.0 3.3.3.3 18 0x80000001 0x0046e2 0 192.168.4.0 3.3.3.3 18 0x80000002 0x008fb6 0 172.16.1.0 2.2.2.2 748 0x80000002 0x00c36d 0 ( 五 )show ip ospf R2#show ip ospf 1 [ 略 ] Area BACKBONE(0) Number of interfaces in this area is 2 Area has no authentication SPF algorithm executed 9 times Area ranges are 100

第一部分 路由器实验 Area 1 Number of LSA 4. Checksum Sum 0x02b05d Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 Number of interfaces in this area is 1 It is a NSSA area Perform type-7/type-5 LSA translation Area has no authentication SPF algorithm executed 9 times Area ranges are Number of LSA 5. Checksum Sum 0x02cf36 Number of opaque link LSA 0. Checksum Sum 0x000000 Number of DCbitless LSA 0 Number of indication LSA 0 Number of DoNotAge LSA 0 Flood list length 0 // 执行类型 7 到类型 5 的转换 101

第二部分 交换机实验 第二部分 交换机实验 实验 2-1. 交换机基本配置 一 实验目的 ( 一 ) 交换机的基本配置 ( 二 ) 交换机的启动过程二 实验拓扑 三 实验步骤 ( 一 ) 配置主机名 Switch>enable Switch#conf t Enter configuration commands, one per line. Switch(config)#hostname S1 End with CNTL/Z. ( 二 ) 配置基本安全措施 S1(config)#enable secret cisco S1(config)#service password-encryption S1(config)#line vty 0 4 S1(config-line)#password cisco S1(config-line)#login S1(config)#line console 0 S1(config-line)#password cisco S1(config-line)#login ( 三 ) 接口基本配置 S1(config)#int f0/16 103

第二部分 交换机实验 S1(config-if)#duplex? auto Enable AUTO duplex configuration // 自动检测 full Force full duplex operation // 全双工模式 half Force half-duplex operation // 半双工模式 S1(config-if)#duplex full S1(config-if)#speed? 10 Force 10 Mbps operation // 100 Force 100 Mbps operation auto Enable AUTO speed configuration S1(config-if)#speed 100 ( 四 ) 配置管理地址 S1(config)#interface vlan 1 S1(config-if)#ip addr 172.16.0.1 255.255.255.0 S1(config-if)#no shut S1(config-if)#exit S1(config)#ip default-gateway 172.16.0.254 // 管理 IP 地址 四 实验调试 ( 一 )show ip interface brief S1#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/1 unassigned YES manual down down [ 略 ] FastEthernet0/24 unassigned YES manual down down Vlan1 172.16.0.1 YES manual up up ( 二 )telnet PC>telnet 172.16.0.1 Trying 172.16.0.1...Open User Access Verification Password: S1>en Password: S1# // 密码 cisco 不可见 ( 三 )show running-config S1#show running-config Building configuration... Current configuration : 1116 bytes 104

第二部分 交换机实验! version 12.1 no service timestamps log datetime msec no service timestamps debug datetime msec service password-encryption! hostname S1! enable secret 5 $1$mERr$hx5rVt7rPNoS4wqbXKX7m0! interface FastEthernet0/1! [ 略 ] interface FastEthernet0/16 duplex full! speed 100 [ 略 ] interface FastEthernet0/24! interface Vlan1! ip address 172.16.0.1 255.255.255.0 ip default-gateway 172.16.0.254!! line con 0 password 7 0822455D0A16 login! line vty 0 4 password 7 0822455D0A16 login line vty 5 15 login!! End // 以上是查看运行的配置文件 S1#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] // 把运行文件保存为启动配置文件 105

第二部分 交换机实验 [confirm] ( 四 )show flash: ( 五 ) 清空交换机全部配置 重启观察启动过程 S1#erase startup-config Erasing the nvram filesystem will remove all configuration files! Continue? [OK] Erase of nvram: complete %SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram S1#delete flash: Delete filename []??File name not specified %Error parsing flash: (No such file or directory) S1#reload Proceed with reload? [confirm] %SYS-5-RELOAD: Reload requested by console. Reload Reason: Reload Command. C2950 Boot Loader (C2950-HBOOT-M) Version 12.1(11r)EA1, RELEASE SOFTWARE (fc1) Compiled Mon 22-Jul-02 18:57 by miwang Cisco WS-C2950-24 (RC32300) processor (revision C0) with 21039K bytes of memory. 2950-24 starting... Base ethernet MAC Address: 0001.6460.C88D Xmodem file system is available. Initializing Flash... flashfs[0]: 1 files, 0 directories flashfs[0]: 0 orphaned files, 0 orphaned directories flashfs[0]: Total bytes: 64016384 flashfs[0]: Bytes used: 3058048 flashfs[0]: Bytes available: 60958336 flashfs[0]: flashfs fsck took 1 seconds....done Initializing Flash. Boot Sector Filesystem (bs:) installed, fsid: 3 Parameter Block Filesystem (pb:) installed, fsid: 4 Loading "flash:/c2950-i6q4l2-mz.121-22.ea4.bin"... ########################################################################## [OK] Restricted Rights Legend Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) of the Commercial Computer Software - Restricted Rights clause at FAR sec. 52.227-19 and subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at DFARS sec. 252.227-7013. 106

第二部分 交换机实验 cisco Systems, Inc. 170 West Tasman Drive San Jose, California 95134-1706 Cisco Internetwork Operating System Software IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE(fc1) Copyright (c) 1986-2005 by cisco Systems, Inc. Compiled Wed 18-May-05 22:31 by jharirba Cisco WS-C2950-24 (RC32300) processor (revision C0) with 21039K bytes of memory. Processor board ID FHK0610Z0WC Running Standard Image 24 FastEthernet/IEEE 802.3 interface(s) 63488K bytes of flash-simulated non-volatile configuration memory. Base ethernet MAC Address: 0001.6460.C88D Motherboard assembly number: 73-5781-09 Power supply part number: 34-0965-01 Motherboard serial number: FOC061004SZ Power supply serial number: DAB0609127D Model revision number: C0 Motherboard revision number: A0 Model number: WS-C2950-24 System serial number: FHK0610Z0WC Cisco Internetwork Operating System Software IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE(fc1) Copyright (c) 1986-2005 by cisco Systems, Inc. Compiled Wed 18-May-05 22:31 by jharirba Press RETURN to get started! ( 六 )show version Switch#show version Cisco Internetwork Operating System Software IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE(fc1) Copyright (c) 1986-2005 by cisco Systems, Inc. Compiled Wed 18-May-05 22:31 by jharirba 107

第二部分 交换机实验 Image text-base: 0x80010000, data-base: 0x80562000 ROM: Bootstrap program is is C2950 boot loader Switch uptime is 3 minutes, 14 seconds System returned to ROM by power-on Cisco WS-C2950-24 (RC32300) processor (revision C0) with 21039K bytes of memory. Processor board ID FHK0610Z0WC Last reset from system-reset Running Standard Image 24 FastEthernet/IEEE 802.3 interface(s) 63488K bytes of flash-simulated non-volatile configuration memory. Base ethernet MAC Address: 0001.6460.C88D Motherboard assembly number: 73-5781-09 Power supply part number: 34-0965-01 Motherboard serial number: FOC061004SZ Power supply serial number: DAB0609127D Model revision number: C0 Motherboard revision number: A0 Model number: WS-C2950-24 System serial number: FHK0610Z0WC Configuration register is 0xF 108

第二部分 交换机实验 实验 2-2. 交换机端口安全 一 实验目的 ( 一 ) 管理交换机的 MAC 表 ( 二 ) 配置交换机的端口安全功能二 实验拓扑 三 实验步骤 ( 一 ) 交换机上的 MAC 地址表 Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#no shut R1(config-if)#ip addr 172.16.0.201 255.255.255.0 Router(config)#host R2 R2(config)#int f0/0 R2(config-if)#no shut R2(config-if)#ip addr 172.16.0.202 255.255.255.0 S1(config)#int vlan 1 S1(config-if)#ip addr 172.16.0.1 255.255.255.0 S1(config-if)#no shut R1#show int f0/0 FastEthernet0/0 is up, line protocol is up (connected) Hardware is Lance, address is 00d0.ffe2.1701 (bia 00d0.ffe2.1701) // 路由器 R1 的 f0/0 接口的 MAC 地址 Internet address is 172.16.0.201/24 MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, 109

第二部分 交换机实验 R2#show int f0/0 FastEthernet0/0 is up, line protocol is up (connected) Hardware is Lance, address is 0030.a3c7.4901 (bia 0030.a3c7.4901) Internet address is 172.16.0.202/24 MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec, S1#show mac-address-table Mac Address Table ------------------------------------------- Vlan Mac Address Type Ports ---- ----------- -------- ----- 1 0030.a3c7.4901 DYNAMIC Fa0/2 // 路由器 R2 的 MAC 地址 1 00d0.ffe2.1701 DYNAMIC Fa0/1 // 路由器 R1 的 MAC 地址 ( 二 ) 配置交换机端口安全之静态安全 MAC 地址 S1(config)#int f0/1 S1(config-if)#shutdown S1(config-if)#switchport mode access // 把端口改换为访问模式 S1(config-if)#switchport port-security // 打开交换机的端口安全功能 S1(config-if)#switchport port-security maximum 1 S1(config-if)#switchport port-security violation? protect Security violation protect mode // 当新的计算机接入时, 如果该接口的 MAC 条目超过最大数量, 则这个新的计算机将无法 接入, 而原有的计算机不受影响, 交换机不发送警告信息 restrict Security violation restrict mode // 当新的计算机接入时, 如果该接口的 MAC 条目超过最大数量, 则这个新的计算机将无法 接入, 并且交换机将发送警告信息 shutdown Security violation shutdown mode // 当新的计算机接入时, 如果该接口的 MAC 条目超过最大数量, 则该接口将会被关闭, 这个新的计算机和原有的计算机都无法接入, 需要管理员使用 no shutdown 重新打开 S1(config-if)#switchport port-security violation shutdown S1(config-if)#switchport port-security mac-address 00d0.ffe2.1701 // 允许路由器 R1 从 f0/1 接口接入 S1(config-if)#no shut S1(config-if)#end S1#sho mac-address-table Mac Address Table ------------------------------------------- 110

第二部分 交换机实验 Vlan Mac Address Type Ports ---- ----------- -------- ----- 1 0030.a3c7.4901 DYNAMIC Fa0/2 1 00d0.ffe2.1701 STATIC Fa0/1 ( 三 ) 模拟非法接入 R1(config)#int f0/0 R1(config-if)#shutdown R1(config-if)#mac-address 12.12.12 R1(config-if)#no shut S1#show interface f0/1 FastEthernet0/1 is down, line protocol is down (err-disabled) Hardware is Lance, address is 00e0.f90b.2201 (bia 00e0.f90b.2201) BW 100000 Kbit, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255 ( 四 ) 配置交换机端口安全之动态安全 MAC 地址 S1(config)#int f0/1 S1(config-if)#shutdown S1(config-if)#switchport mode access S1(config-if)#switchport port-security S1(config-if)#switchport port-security maximum 1 S1(config-if)#switchport port-security violation shutdown 111

第二部分 交换机实验 实验 2-3. 划分 VLAN 一 实验目的 ( 一 )VLAN 的创建 ( 二 ) 把交换机接口划分到特定 VLAN 二 实验拓扑 三 实验步骤 ( 一 ) 路由器基本配置, 使其之间能够相互通信 Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut End with CNTL/Z. Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int f0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#no shut ( 二 ) 在交换机 S1 上创建 VLAN Switch>ena Switch#conf t End with CNTL/Z. 112

第二部分 交换机实验 Enter configuration commands, one per line. Switch(config)#vlan 2 Switch(config-vlan)#name VLAN2 Switch(config-vlan)#vlan 3 Switch(config-vlan)#name VLAN3 End with CNTL/Z. ( 三 ) 端口划分到 VLAN 中 Switch(config)#int f0/1 Switch(config-if)#switchport mode access // 把交换机端口的模式改为 access 模式 Switch(config-if)#switchport access vlan 2 Switch(config-if)#int f0/2 Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 3 四 实验调试 ( 一 )show vlan Switch#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6 Fa0/7, Fa0/8, Fa0/9, Fa0/10 Fa0/11, Fa0/12, Fa0/13, Fa0/14 Fa0/15, Fa0/16, Fa0/17, Fa0/18 Fa0/19, Fa0/20, Fa0/21, Fa0/22 Fa0/23, Fa0/24, Gig1/1, Gig1/2 2 VLAN2 active Fa0/1 3 VLAN3 active Fa0/2 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------ 1 enet 100001 1500 - - - - - 0 0 2 enet 100002 1500 - - - - - 0 0 3 enet 100003 1500 - - - - - 0 0 1002 fddi 101002 1500 - - - - - 0 0 1003 tr 101003 1500 - - - - - 0 0 113

第二部分 交换机实验 1004 fdnet 101004 1500 - - - ieee - 0 0 1005 trnet 101005 1500 - - - ibm - 0 0 Remote SPAN VLANs ------------------------------------------------------------------------------ Primary Secondary Type Ports ------- --------- ----------------- ------------------------------------------ ( 二 )show vlan brief Switch#show vlan brief VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6 2 VLAN2 active Fa0/1 3 VLAN3 active Fa0/2 1002 fddi-default active 1003 token-ring-default active 1004 fddinet-default active 1005 trnet-default active ( 三 )show interface f0/1 switchport Switch#show interface f0/1 switchport Name: Fa0/1 // 接口的名字 Switchport: Enabled Administrative Mode: static access Operational Mode: static access // 接口是交换接口 Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: native Negotiation of Trunking: Off Access Mode VLAN: 2 (VLAN2) // 接口属于 VLAN2 Trunking Native Mode VLAN: 1 (default) // 本征 VLAN 为 1 Fa0/7, Fa0/8, Fa0/9, Fa0/10 Fa0/11, Fa0/12, Fa0/13, Fa0/14 Fa0/15, Fa0/16, Fa0/17, Fa0/18 Fa0/19, Fa0/20, Fa0/21, Fa0/22 Fa0/23, Fa0/24, Gig1/1, Gig1/2 // 管理员已配置接口为 access 模式 Voice VLAN: none // 没有设置 Voice VLAN Administrative private-vlan host-association: none Administrative private-vlan mapping: none Administrative private-vlan trunk native VLAN: none Administrative private-vlan trunk encapsulation: dot1q 114

第二部分 交换机实验 Administrative private-vlan trunk normal VLANs: none Administrative private-vlan trunk private VLANs: none Operational private-vlan: none Trunking VLANs Enabled: ALL Pruning VLANs Enabled: 2-1001 Capture Mode Disabled Capture VLANs Allowed: ALL Protected: false Appliance trust: none ( 四 )VLAN 间的通信 相互之间不能 ping 通 115

第二部分 交换机实验 实验 2-4.Trunk 配置 一 实验目的 ( 一 ) 配置交换机接口的 Trunk ( 二 )Native VLAN 的含义和配置 二 实验拓扑 三 实验步骤 路由器自配 ( 一 ) 在 S1 和 S2 上创建 VLAN, 并把接口划分到相应的 VLAN 中 Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host S1 S1(config)#vlan 2 S1(config-vlan)#name VLAN2 S1(config-vlan)#vlan 3 S1(config-vlan)#name VLAN3 S1(config-vlan)#int f0/1 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 2 S1(config-if)#int f0/2 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 3 End with CNTL/Z. Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host S2 End with CNTL/Z. 117

第二部分 交换机实验 S2(config)#vlan 2 S2(config-vlan)#name VLAN2 S2(config-vlan)#vlan 3 S2(config-vlan)#name VLAN3 S2(config-vlan)#int f0/3 S2(config-if)#switchport mode access S2(config-if)#switchport access vlan 2 S2(config-if)#int f0/4 S2(config-if)#switchport mode access S2(config-if)#switchport access vlan 3 ( 二 ) 配置 Trunk S1(config)#int f0/13 S1(config-if)#switchport mode trunk // 把端口模式配置为 Trunk S2(config)#int f0/13 S2(config-if)#switchport mode trunk ( 三 ) 检查 Trunk 链路的状态, 测试跨交换机的同一 VLAN 主机间的通信路由器 R1 和路由器 R3 在同一个 VLAN, 所以路由器 R1 应该能 ping 通路由器 R3; 同样, 路 由器 R2 应该能 ping 通路由器 R4 R1#ping 172.16.12.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.12.3, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 62/83/93 ms R2#ping 172.16.12.4 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.12.4, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 78/87/94 ms S1#show int f0/13 switchport Name: Fa0/13 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk // 接口模式为 Trunk 模式 Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) // 封装 802.1q 协议 Trunking Native Mode VLAN: 1 (default) //Trunk 链路的本地 VLAN 为 1 Voice VLAN: none Administrative private-vlan host-association: none 118

第二部分 交换机实验 Administrative private-vlan mapping: none Administrative private-vlan trunk native VLAN: none Administrative private-vlan trunk encapsulation: dot1q Administrative private-vlan trunk normal VLANs: none Administrative private-vlan trunk private VLANs: none ( 四 ) 配置 Trunk allowed S1(config)#int f0/13 S1(config-if)#switchport trunk allowed vlan 2,200 // 配置交换机 S1 的 Trunk 链路只能通过 VLAN2 和 VLAN200 数据通过, 这样路由器 R1 可以 ping 通路由器 R3, 路由器 R2 不能 ping 通路由器 R4: R1#ping 172.16.12.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.12.3, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 78/90/94 ms R2#ping 172.16.12.4 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.12.4, timeout is 2 seconds:... Success rate is 0 percent (0/5) ( 五 ) 配置 Native VLAN S1(config)#int f0/13 S1(config-if)#switchport trunk native vlan 2 // 配置 Native vlan 为 VLAN2, 默认为 VLAN1. S2(config)#int f0/13 S2(config-if)#switchport trunk native vlan 2 S1#show interface f0/13 switchport Name: Fa0/13 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 2 (VLAN2) //Trunk 链路的本地 VLAN 改为 2 Voice VLAN: none 119

第二部分 交换机实验 四 实验调试 在交换机上配置不同的 Native, 如下 : S1(config)#int f0/13 S1(config-if)#switchport trunk native vlan 2 S2(config)#int f0/13 S2(config-if)#switchport trunk native vlan 3 在两个交换机上每隔一分钟就会出现出错提示, 如下 : %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/13 (2), with S2 FastEthernet0/13 (3). %CDP-4-NATIVE_VLAN_MISMATCH: Native VLAN mismatch discovered on FastEthernet0/13 (3), with S1 FastEthernet0/13 (2). 交换机默认是运行 CDP 协议的, 每分钟发送一次数据包, 可以使用 no cdp run 关闭以上信息 R1#ping 172.16.12.4 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.12.4, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 62/87/94 ms 路由器 R1 和路由器 R4 是在不同 VLAN 上, 但竟然 ping 通了,ping 通的原因是 : 由于交换 机 S1 的 f0/13 接口的 Native VLAN 是 VLAN2, 来自 VLAN2 的数据原封不动地从 f0/13 接口发送出 去, 到达交换机 S2; 交换机 S2 的 F0/13 接口的 Native VLAN 是 VLAN3, 交换机 S2 收到了一个没有经过重新封装的数据帧后认为这个帧应该是 VLAN3 的数据帧, 发送给了路由器 R4; 从路由器 R4 返回到路由器 R1 的数据也是类似的 120

第二部分 交换机实验 实验 2-5.Voice VLAN 配置 一 实验目的 ( 一 ) Voice VLAN 的含义 ( 二 ) Voice VLAN 的配置二 实验拓扑 三 实验步骤 用路由器 R2 模拟 IP Phone, 可以发出 Voice VLAN 和 Data VLAN 的数据 ( 一 ) 在交换机上创建 VLAN, 并把接口划分到各自的 VLAN 中 Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host S1 S1(config)#vlan 20 S1(config-vlan)#name Data-VLAN S1(config-vlan)#vlan 150 S1(config-vlan)#name Voice-VLAN S1(config-vlan)#int f0/1 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 150 S1(config-if)#int f0/3 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 20 S1(config-if)#int f0/2 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 20 End with CNTL/Z. ( 二 ) 路由器上配置 IP 地址 Router>ena 121

第二部分 交换机实验 Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#no shut R1(config-if)#ip addr 172.16.150.1 255.255.255.0 End with CNTL/Z. Router(config)#host R3 R3(config)#int f0/0 R3(config-if)#ip addr 172.16.20.3 255.255.255.0 R3(config-if)#no shut 以下用 R2 路由器模拟 IP Phone Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#int f0/0 R2(config-if)#no shut R2(config-if)#int f0/0.20 R2(config-subif)#encapsulation dot1q 20 native R2(config-subif)#ip addr 172.16.20.2 255.255.255.0 R2(config-subif)#int f0/0.150 R2(config-subif)#encapsulation dot1q 150 R2(config-subif)#ip addr 172.16.150.2 255.255.255.0 ( 三 ) 在交换机上配置 Voice VLAN S1(config)#int f0/2 S1(config-if)#switchport voice vlan 150 // 以上配置 f0/2 的 Voice VLAN 为 VLAN 150 ( 四 ) 保证 Voice VLAN 的流量优先 S1(config)#mls qos S1(config)#int f0/2 S1(config-if)#mls qos trust cos 四 实验调试 ( 一 )show vlan S1#show vlan End with CNTL/Z. VLAN Name Status Ports ---- -------------------------------- --------- ------------------------------- 1 default active Fa0/4, Fa0/5, Fa0/6, Fa0/7 Fa0/8, Fa0/9, Fa0/10, Fa0/11 Fa0/12, Fa0/13, Fa0/14, Fa0/15 Fa0/16, Fa0/17, Fa0/18, Fa0/19 Fa0/20, Fa0/21, Fa0/22, Fa0/23 122

第二部分 交换机实验 Fa0/24, Gig1/1, Gig1/2 20 Data-VLAN active Fa0/2, Fa0/3 150 Voice-VLAN active Fa0/1 ( 二 )show int f0/2 switchport S1#show int f0/2 switchport Name: Fa0/2 Switchport: Enabled Administrative Mode: static access Operational Mode: static access Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: native Negotiation of Trunking: Off Access Mode VLAN: 20 (Data-VLAN) // 该接口属于 VLAN 20 Trunking Native Mode VLAN: 1 (default) Voice VLAN: 150 //Voice VLAN 为 VLAN 150 (3)ping 命令 R2#ping 172.16.20.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.20.3, timeout is 2 seconds:.!!!! Success rate is 80 percent (4/5), round-trip min/avg/max = 47/58/63 ms 123

第二部分 交换机实验 实验 2-6. DTP 的配置 一 实验目的 ( 一 ) DTP 的协商规律 ( 二 ) 配置 DTP 二 实验拓扑 三 实验步骤 ( 一 ) 把交换机 S1 的 f0/13 接口的 Trunk 配置为 desirable, 把交换机 S2 的 f0/13 接口的 Trunk 配置为 auto 模式 Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host S1 S1(config)#int f0/13 S1(config-if)#shutdown S1(config-if)#switchport mode dynamic desirable S1(config-if)#no shut End with CNTL/Z. Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host S2 S2(config)#int f0/13 S2(config-if)#shutdown S2(config-if)#switchport mode dynamic auto S2(config-if)#no shut End with CNTL/Z. S1#show interfaces f0/13 switchport Name: Fa0/13 Switchport: Enabled Administrative Mode: dynamic desirable Operational Mode: trunk Administrative Trunking Encapsulation: dot1q 125

第二部分 交换机实验 Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Voice VLAN: none S2#show Name: Fa0/13 int f0/13 switchport Switchport: Enabled Administrative Mode: dynamic auto Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: On Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Voice VLAN: none ( 二 ) 把交换机 S1 的 f0/13 接口的 Trunk 配置不变, 把交换机 S2 的 f0/13 接口的 Trunk 配置为 nonegotiate 模式 S2#show int f0/13 switchport Name: Fa0/13 Switchport: Enabled Administrative Mode: trunk Operational Mode: trunk Administrative Trunking Encapsulation: dot1q Operational Trunking Encapsulation: dot1q Negotiation of Trunking: Off Access Mode VLAN: 1 (default) Trunking Native Mode VLAN: 1 (default) Voice VLAN: none 126

第二部分 交换机实验 实验 2-7.EtherChannel 配置 一 实验目的 ( 一 )Etherchannel 的工作原理 ( 二 )Etherchannel 的配置二 实验拓扑 三 实验步骤 构成 Etherchannel 的端口必须具有相同的特性 配置 Etherchannel 有 手动配置和自动配置 (PAGP 或者 LAGP) 两种方法 ( 一 ) 手动配置 Etherchannel Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host S1 S1(config)#int port-channel 1 End with CNTL/Z. // 创建以太通道, 要指定一个唯一的通道组号, 组号的范围是 1~6 的正整数 S1(config-if)#int range f0/13-14 S1(config-if-range)#channel-group 1 mode on S1(config-if-range)#switchport mode trunk S1(config-if-range)#exit S1(config)#port-channel load-balance dst-ip // 将物理接口指定到已创建的通道中 // 配置通道中的物理接口属性 // 配置 Etherchannel 的负载平衡方式 Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host S2 S2(config)#int port-channel 2 S2(config-if)#int range f0/13-14 S2(config-if-range)#channel-group 2 mode on S2(config-if-range)#switchport mode trunk S2(config-if-range)#exit End with CNTL/Z. // 链路两端的 channel-group 编号可以不一样的 127

第二部分 交换机实验 S2(config)#port-channel load-balance dst-ip ( 二 ) 查看 Etherchannel 信息 S1#show etherchannel summary Flags: D - down P - in port-channel I - stand-alone s - suspended H - Hot-standby (LACP only) R - Layer3 U - in use S - Layer2 u - unsuitable for bundling w - waiting to be aggregated d - default port Number of channel-groups in use: 1 Number of aggregators: 1 f - failed to allocate aggregator Group Port-channel Protocol Ports ------+-------------+-----------+---------------------------------------------- 1 Po1(SU) PAgP Fa0/13(P) Fa0/14(P) S1#show etherchannel load-balance EtherChannel Load-Balancing Operational State (dst-ip): Non-IP: Destination MAC address IPv4: Destination IP address IPv6: Destination IP address // 显示 Etherchannel 负载平衡方式,IPv4 和 IPv6 数据包均基于目的 IP 进行负载平衡, 而对于非 IP 包则基于目的 MAC 进行负载平衡 ( 三 ) 配置 PAGP 或者 LAGP S1(config-if-range)#channel-protocol? lacp Prepare interface for LACP protocol pagp Prepare interface for PAgP protocol S1(config-if-range)#channel-group 1 mode? active auto desirable on passive 四 实验调试 Enable LACP unconditionally Enable PAgP only if a PAgP device is detected Enable PAgP unconditionally Enable Etherchannel only Enable LACP only if a LACP device is detected ( 一 )show etherchannel summary 查看 Etherchannel 的简要信息 S1#show etherchannel summary Flags: D - down P - in port-channel I - stand-alone s - suspended H - Hot-standby (LACP only) R - Layer3 S - Layer2 128

第二部分 交换机实验 U - in use u - unsuitable for bundling w - waiting to be aggregated d - default port Number of channel-groups in use: 1 Number of aggregators: 1 f - failed to allocate aggregator Group Port-channel Protocol Ports ------+-------------+-----------+---------------------------------------------- 1 Po1(SU) PAgP Fa0/13(P) Fa0/14(P) ( 二 )show etherchannel port-channel 查看指定的 Etherchannel 包含的接口 S1#show etherchannel port-channel Group: 1 ---------- Channel-group listing: ---------------------- Port-channels in the group: --------------------------- Port-channel: Po1 ------------ Age of the Port-channel = 00d:00h:13m:22s Logical slot/port = 2/1 Number of ports = 2 GC = 0x00000000 HotStandBy port = null Port state = Port-channel // 端口的状态 Protocol = PAGP // 使用的协商协议 Port Security = Disabled Ports in the Port-channel: Index Load Port EC state No of bits ------+------+------+------------------+----------- 0 00 Fa0/13 On 0 0 00 Fa0/14 On 0 // 列出了该通道包含的接口 Time since last port bundled: 00d:00h:10m:18s Fa0/14 (3) 测试 Etherchannel 的冗余功能在交换机 S1 和交换机 S2 的 VLAN 接口上配置 IP 地址 S1(config)#int vlan 1 S1(config-if)#ip addr 172.16.100.1 255.255.255.0 S1(config-if)#int f0/15 129

第二部分 交换机实验 S1(config-if)#shutdown S2(config)#int vlan 1 S2(config-if)#ip addr 172.16.100.2 255.255.255.0 S2(config-if)#int f0/15 S2(config-if)#shutdown 130

第二部分 交换机实验 实验 2-8. VTP 配置 一 实验目的 ( 一 )VTP 三种模式的区别 ( 二 )VTP 的配置二 实验拓扑 三 实验步骤 ( 一 ) 配置交换机 S1 交换机 S2 交换机 S3 之间的链路 Trunk Switch(config)#host S1 S1(config)#int f0/15 S1(config-if)#switchport mode dynamic desirable Switch(config)#host S2 S2(config)#int f0/15 S2(config-if)#switchport mode dy de S3(config)#int f0/1 S3(config-if)#switchport mode dynamic desirable S3(config-if)#int f0/2 S3(config-if)#switchport mode dynamic des S3#show interfaces trunk Port Mode Encapsulation Status Native vlan Fa0/1 auto n-802.1q trunking 1 Fa0/2 auto n-802.1q trunking 1 ( 二 ) 检查默认的 VTP 情况 S1#show vtp status VTP Version : 2 // 该 VTP 支持版本 2 Configuration Revision : 0 // 默认修订号为 0 Maximum VLANs supported locally : 255 //VTP 支持的最大 VLAN 数 Number of existing VLANs : 5 // 当前交换机上有 5 个 VLAN 131

第二部分 交换机实验 VTP Operating Mode : Server // 当前交换机上 VTP 模式为 Server VTP Domain Name : // 当前 VTP 域名为空 VTP Pruning Mode : Disabled // 没有启用修剪功能 VTP V2 Mode : Disabled VTP Traps Generation : Disabled // 没有把 VTP 提示信息等发送到 SNMP 服务器 MD5 digest : 0x7D 0x5A 0xA6 0x0E 0x9A 0x72 0xA0 0x3A //MD5 值 Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 //VTP 配置的修改者的 IP 地址和修改时间 Local updater ID is 0.0.0.0 (no valid interface found) ( 三 ) 配置交换机 S1 为 VTP Server, 配置 VTP 域名, 创建 VLAN2 S1(config)#vtp mode? client server Set the device to client mode. Set the device to server mode. transparent Set the device to transparent mode. S1(config)#vtp mode server // 配置交换机 S1 为 VTP Server, 即默认值 Device mode already VTP SERVER. S1(config)#vtp domain VTP-TEST // 配置 VTP 域名 Changing VTP domain name from NULL to VTP-TEST S1(config)#do show vtp status VTP Version : 2 Configuration Revision : 0 Maximum VLANs supported locally : 255 Number of existing VLANs : 5 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation : Server : VTP-TEST : Disabled : Disabled : Disabled MD5 digest : 0x0E 0x44 0x97 0xCD 0xDD 0x77 0x9E 0xA7 Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00 Local updater ID is 0.0.0.0 (no valid interface found) S1(config)#vlan 2 S1(config-vlan)#name VLAN2-TEST S1(config-vlan)#end S1#show vlan VLAN Name Status Ports ---- -------------------------------- --------- --------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/16,Fa0/17 Fa0/18, Fa0/19, Fa0/20,Fa0/21 132

第二部分 交换机实验 Fa0/22, Fa0/23, Fa0/24,Gig1/1 Gig1/2 2 VLAN2-TEST active // 刚创建的 VLAN S1#show vtp status VTP Version : 2 Configuration Revision : 2 // 修订号发生变化 Maximum VLANs supported locally : 255 Number of existing VLANs : 6 //VLAN 数量变为了 6 个 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation : Server : VTP-TEST : Disabled : Disabled : Disabled MD5 digest : 0x40 0xEE 0x0A 0x8B 0xC4 0xE4 0xE6 0xD5 Configuration last modified by 0.0.0.0 at 3-1-93 00:18:17 Local updater ID is 0.0.0.0 (no valid interface found) S3#show vtp status VTP Version : 2 Configuration Revision : 2 Maximum VLANs supported locally : 255 Number of existing VLANs : 6 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation MD5 digest : Server : VTP-TEST : Disabled : Disabled : Disabled : 0x40 0xEE 0x0A 0x8B 0xC4 0xE4 0xE6 0xD5 Configuration last modified by 0.0.0.0 at 3-1-93 00:18:17 Local updater ID is 0.0.0.0 (no valid interface found) S2#show vtp status VTP Version : 2 Configuration Revision : 2 Maximum VLANs supported locally : 255 Number of existing VLANs : 6 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation MD5 digest : Server : VTP-TEST : Disabled : Disabled : Disabled : 0x40 0xEE 0x0A 0x8B 0xC4 0xE4 0xE6 0xD5 Configuration last modified by 0.0.0.0 at 3-1-93 00:18:17 Local updater ID is 0.0.0.0 (no valid interface found) 133

第二部分 交换机实验 S2#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ----------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 2 VLAN2-TEST active // 自动学习到了在交换机 S1 上创建的 VLAN ( 四 ) 配置交换机 S3 为 VTP Transparent S3>ena S3#vlan database S3(vlan)#vtp transparent Setting device to VTP TRANSPARENT mode. S3(vlan)#exit APPLY completed. Exiting... S3#show vtp status VTP Version : 2 Configuration Revision : 0 Maximum VLANs supported locally : 255 Number of existing VLANs : 6 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation MD5 digest : Transparent : VTP-TEST : Disabled : Disabled : Disabled Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/16,Fa0/17 Fa0/18, Fa0/19, Fa0/20,Fa0/21 Fa0/22, Fa0/23, Fa0/24,Gig1/1 Gig1/2 : 0x38 0x47 0x3F 0x40 0xF8 0x7B 0x64 0x4A Configuration last modified by 0.0.0.0 at 3-1-93 00:18:17 在交换机 S3 上创建 VLAN 3, 检查交换机 S1 和交换机 S2 上的 VLAN 信息 S3(config)#vlan 3 S3(config-vlan)#name TEST-VLAN3 S3(config-vlan)#do show vlan VLAN Name Status Ports ---- -------------------------------- --------- ----------------------------- 1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6 Fa0/7, Fa0/8, Fa0/9, Fa0/10 Fa0/11, Fa0/12, Fa0/13,Fa0/14 134

第二部分 交换机实验 Fa0/15, Fa0/16, Fa0/17,Fa0/18 Fa0/19, Fa0/20, Fa0/21,Fa0/22 Fa0/23, Fa0/24, Gig1/1,Gig1/2 2 VLAN2-TEST active 3 TEST-VLAN3 active // 新创建的 VLAN3 S1#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ----------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 2 VLAN2-TEST active 在交换机 S1 上没有学习到 VLAN3, 交换机 S2 上也是如此 Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/16,Fa0/17 Fa0/18, Fa0/19, Fa0/20,Fa0/21 Fa0/22, Fa0/23, Fa0/24,Gig1/1 Gig1/2 在交换机 S2 上创建 VLAN4, 检查交换机 S1 和交换机 S2 上的 VLAN 信息 S2(config)#vlan 4 S2(config-vlan)#name TEST-VLAN4 S2(config-vlan)#end S2#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ----------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 2 VLAN2-TEST active Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/16,Fa0/17 Fa0/18, Fa0/19, Fa0/20,Fa0/21 Fa0/22, Fa0/23, Fa0/24,Gig1/1 Gig1/2 4 TEST-VLAN4 active // 新创建的 VLAN4 S1#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ----------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 Fa0/5, Fa0/6, Fa0/7, Fa0/8 135

第二部分 交换机实验 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/16,Fa0/17 Fa0/18, Fa0/19, Fa0/20,Fa0/21 Fa0/22, Fa0/23, Fa0/24,Gig1/1 Gig1/2 2 VLAN2-TEST active 4 TEST-VLAN4 active // 交换机 S1 自动学习到在交换机 S2 上新创建的 VLAN4 S3#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ----------------------------- 1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6 Fa0/7, Fa0/8, Fa0/9, Fa0/10 Fa0/11, Fa0/12, Fa0/13,Fa0/14 Fa0/15, Fa0/16, Fa0/17,Fa0/18 Fa0/19, Fa0/20, Fa0/21,Fa0/22 Fa0/23, Fa0/24, Gig1/1,Gig1/2 2 VLAN2-TEST active 3 TEST-VLAN3 active // 交换机 S3 并没有新创建的 VLAN4 // 以上表明在一个 VTP 域中可以有多个 VTP Server, 在任何一个 VTP Server 都可以创建和 修改 VLAN 信息, 并通告到其他交换机上 Transparent 交换机上会可以转发 VTP 通告, 但是并不 会根据 VTP 通告更新自己的 VLAN 信息. ( 五 ) 配置交换机 S2 和交换机 S3 为 VTP Client S3(config)#vtp mode client Setting device to VTP CLIENT mode. S2(config)#vtp mode client Setting device to VTP CLIENT mode. S2#show vtp status VTP Version : 2 Configuration Revision : 4 Maximum VLANs supported locally : 255 Number of existing VLANs : 7 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation MD5 digest : Client : VTP-TEST : Disabled : Disabled : Disabled : 0x81 0x28 0x0E 0x07 0x45 0x9B 0x4B 0x3D Configuration last modified by 0.0.0.0 at 3-1-93 00:40:16 136

第二部分 交换机实验 S2(config)#vlan 5 VTP VLAN configuration not allowed when device is in CLIENT mode. // 表明在 Client 模式交换机上不能创建和修改 VLAN 信息 在交换机 S1 上创建 VLAN6, 检查交换机 S2 和交换机 S3 上的 VLAN 信息 S1(config)#vlan 6 S1(config-vlan)#name TEST-VLAN6 S2#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ----------------------------- 1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 2 VLAN2-TEST active 4 TEST-VLAN4 active Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12 Fa0/13, Fa0/14, Fa0/16,Fa0/17 Fa0/18, Fa0/19, Fa0/20,Fa0/21 Fa0/22, Fa0/23, Fa0/24,Gig1/1 Gig1/2 6 TEST-VLAN6 active // 自动学习到 VLAN6 S3#show vlan VLAN Name Status Ports ---- -------------------------------- --------- ----------------------------- 1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6 2 VLAN2-TEST active 4 TEST-VLAN4 active 6 TEST-VLAN6 active 自己的 VLAN 信息 Fa0/7, Fa0/8, Fa0/9, Fa0/10 Fa0/11, Fa0/12, Fa0/13,Fa0/14 Fa0/15, Fa0/16, Fa0/17,Fa0/18 Fa0/19, Fa0/20, Fa0/21,Fa0/22 Fa0/23, Fa0/24, Gig1/1,Gig1/2 //Client 模式的交换机上不仅会可以转发 VTP 通告, 并且会根据 VTP 通告更新 ( 六 ) 配置 VTP 密码 S1(config)#vtp password cisco Setting device VLAN database password to cisco S2(config)#vtp password cisco S3(config)#vtp password cisco 137

第二部分 交换机实验 // 配置 VTP 的密码, 目的是为了安全, 防止不明身份的交换机加入到域中 S1#show vtp password VTP Password: cisco // 显示 VTP 的密码 ( 七 ) 配置 VTP 版本, 只能在 Server 上配置 S1(config)#vtp version? <1-2> Set the adminstrative domain VTP version number S1(config)#vtp version 2 S1#show vtp status VTP Version : 2 Configuration Revision : 7 Maximum VLANs supported locally : 255 Number of existing VLANs : 8 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation MD5 digest : Server : VTP-TEST : Disabled : Enabled : Disabled : 0x2C 0xCB 0xA2 0xEE 0x97 0x51 0xE6 0x0A Configuration last modified by 0.0.0.0 at 3-1-93 01:31:53 Local updater ID is 0.0.0.0 (no valid interface found) S2#show vtp status VTP Version : 2 Configuration Revision : 7 Maximum VLANs supported locally : 255 Number of existing VLANs : 8 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation MD5 digest : Client : VTP-TEST : Disabled : Enabled : Disabled : 0x2C 0xCB 0xA2 0xEE 0x97 0x51 0xE6 0x0A Configuration last modified by 0.0.0.0 at 3-1-93 01:31:53 // 以上表明,VTP Version 2 只需要在任一 VTP Server 上启用, 其他交换机会自动启用该 功能 ( 八 )VTP 域名问题 相邻的交换机处于不同的 VTP 域中, 将导致交换机之间的链路 Trunk 协商失败 138

第二部分 交换机实验 实验 2-9. VLAN 信息覆盖 一 实验目的 ( 一 )VTP 通过修订号作用 ( 二 ) 网络中增添交换机的注意事项二 实验拓扑 三 实验步骤 VTP 通告中的修订号在 VLAN 信息的更新中有着重要的作用, 当交换机收到修订号高的通告后, 会更新自己的 VLAN 信息 ; 然而如果收到低修订号的通告, 将会用自身的 VLAN 信息去更新对方 ( 一 ) 配置交换机 S1 交换机 S2 交换机 S3 之间的链路 Trunk S1(config)#int f0/15 S1(config-if)#switchport mode dynamic desirable S3(config)#int f0/1 S3(config-if)#switchport mode dynamic desirable S3(config-if)#int f0/2 S3(config-if)#switchport mode dynamic desirable S2(config)#int f0/15 S2(config-if)#switchport mode dynamic desirable ( 二 ) 按图配置 VTP S1(config)#vtp mode server Device mode already VTP SERVER. S1(config)#vtp domain VTP-TEST Changing VTP domain name from NULL to VTP-TEST S2(config)#vtp mode server Device mode already VTP SERVER. S2(config)#vtp domain VTP-TEST Changing VTP domain name from NULL to VTP-TEST 139

第二部分 交换机实验 S3(config)#vtp mode server Device mode already VTP SERVER. S3(config)#vtp domain VTP-TEST Domain name already set to VTP-TEST. ( 三 )VTP 覆盖问题关闭交换机 S3 和交换机 S2 的链路, 在两交换机上各自修改 VLAN 信息 S3(config)#int f0/2 S3(config-if)#shutdown S3(config-if)#exit S3(config)#vlan 2 S3(config-vlan)#vlan 3 S3(config-vlan)#vlan 4 S3(config-vlan)#vlan 5 S3(config-vlan)#end // 切断和交换机 S2 连接的链路 S3#show vlan VLAN Name Status Ports ---- -------------------------------- --------- --------------------------- 1 default active Fa0/2, Fa0/3, Fa0/4, Fa0/5 2 VLAN0002 active 3 VLAN0003 active 4 VLAN0004 active 5 VLAN0005 active 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup S3#show vtp status VTP Version : 2 Fa0/6, Fa0/7, Fa0/8, Fa0/9 Fa0/10, Fa0/11, Fa0/12,Fa0/13 Fa0/14, Fa0/15, Fa0/16,Fa0/17 Fa0/18, Fa0/19, Fa0/20,Fa0/21 Fa0/22, Fa0/23, Fa0/24,Gig1/1 Gig1/2 Configuration Revision : 4 //VTP 修订号为 4 Maximum VLANs supported locally : 255 Number of existing VLANs : 9 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation MD5 digest : Server : VTP-TEST : Disabled : Disabled : Disabled : 0x74 0xA0 0x51 0x5D 0xC4 0x94 0x68 0x9D Configuration last modified by 0.0.0.0 at 3-1-93 00:30:11 Local updater ID is 0.0.0.0 (no valid interface found) 140

第二部分 交换机实验 S2(config)#vlan 2 S2(config-vlan)#exit S2(config)#no vlan 2 S2(config)#vlan 2 S2(config-vlan)#exit S2(config)#no vlan 2 S2(config)#vlan 2 S2(config-vlan)#exit S2(config)#no vlan 2 // 反复执行 S2(config)#exit S2#show vtp status VTP Version : 2 Configuration Revision : 6 // 确保它比交换机 S3 上的修订号高 Maximum VLANs supported locally : 255 Number of existing VLANs : 5 VTP Operating Mode VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation MD5 digest : Server : VTP-TEST : Disabled : Disabled : Disabled : 0x01 0x3F 0xBF 0x4C 0x47 0x27 0x71 0x8B Configuration last modified by 0.0.0.0 at 3-1-93 00:35:21 Local updater ID is 0.0.0.0 (no valid interface found) 打开交换机 S3 和交换机 S2 的链路, 观察 VLAN 信息点覆盖 S3(config)#int f0/2 S3(config-if)#no shut S3(config-if)#end S3#show vtp status VTP Version : 2 Configuration Revision : 6 Maximum VLANs supported locally : 255 Number of existing VLANs : 5 VTP Operating Mode : Server VTP Domain Name VTP Pruning Mode VTP V2 Mode VTP Traps Generation MD5 digest : VTP-TEST : Disabled : Disabled : Disabled : 0x01 0x3F 0xBF 0x4C 0x47 0x27 0x71 0x8B Configuration last modified by 0.0.0.0 at 3-1-93 00:35:21 Local updater ID is 0.0.0.0 (no valid interface found) S3#show vlan VLAN Name Status Ports 141

第二部分 交换机实验 ---- -------------------------------- --------- ---------------------------- 1 default active Fa0/3, Fa0/4, Fa0/5, Fa0/6 1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup // 所有的 VLAN 信息和交换机 S2 的信息同步了 Fa0/7, Fa0/8, Fa0/9, Fa0/10 Fa0/11, Fa0/12, Fa0/13,Fa0/14 Fa0/15, Fa0/16, Fa0/17,Fa0/18 Fa0/19, Fa0/20, Fa0/21,Fa0/22 Fa0/23, Fa0/24, Gig1/1,Gig1/2 142

第二部分 交换机实验 实验 2-10. STP PVST 配置 一 实验目的 ( 一 ) 理解 STP 的工作原理 ( 二 ) 掌握 STP 树的控制 ( 三 ) 利用 PVST 进行负载平衡二 实验拓扑 三 实验步骤 网络中配置两个不同的 VLAN, 不同 VLAN 的 STP 具有不同的根桥, 实现负载均衡 ( 一 ) 利用 VTP 创建 VLAN2, 链路之间配置 Trunk Switch(config)#host S1 S1(config)#int f0/13 S1(config-if)#switchport trunk encapsulation dot1q S1(config-if)#switchport mode trunk S1(config-if)#int f0/14 S1(config-if)#switchport trunk encapsulation dot1q S1(config-if)#switchport mode trunk S1(config-if)#shutdown // 先关闭该接口, 暂时不用该链路 S1(config-if)#int f0/15 S1(config-if)#switchport trunk encapsulation dot1q S1(config-if)#switchport mode trunk Switch(config)#host S2 S2(config)#int f0/13 S2(config-if)#switchport trunk encapsulation dot1q 143

第二部分 交换机实验 S2(config-if)#switchport mode t S2(config-if)#switchport mode trunk S2(config-if)#int f0/14 S2(config-if)#switchport trunk encapsulation dot1q S2(config-if)#switchport mode trunk S2(config-if)#shutdown S2(config-if)#int f0/15 S2(config-if)#switchport trunk encapsulation dot1q S2(config-if)#switchport mode trunk Switch(config)#host S3 S3(config)#int f0/1 S3(config-if)#switchport mode trunk S3(config-if)#int f0/2 S3(config-if)#switchport mode trunk //S3 交换机只支持 dot1q S1(config)#vtp domain VTP-TEST Changing VTP domain name from NULL to VTP-TEST S1(config)#vlan 2 ( 二 ) 检查默认的 STP 树 S2#show spanning-tree VLAN0001 Spanning tree enabled protocol ieee // 表明运行的 STP 协议是 IEEE 的 802.1d Root ID Priority 32769 Address 0001.6482.5CB8 // 根桥的 MAC 地址 Cost 19 // 从本交换机到达根桥的 cost 值 Port 13(FastEthernet0/13) // 根口 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec // 各个计数器的值 (Hello 时间 老化时间和转化时间 ) Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 000D.BD99.5B8C Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 // 以上显示该交换机的桥 ID Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/13 Root FWD 19 128.13 P2p Fa0/15 Desg FWD 19 128.15 P2p // Role 列是接口的角色,Desg 是指定口,Altn 是替换接口,Root 是根口 ;Sts 列是接口的 状态,FWD 表示在转发, BLK 表示阻塞,LIS 表示监听,LRN 表示在学习 ;Cost 列是接口的 cost 值 ;Prio.Nbr 列是接口的优先级,Type 列是接口的类型,P2P 是点对点类型,Shr 表示是共享类型 VLAN0002 Spanning tree enabled protocol ieee 144

第二部分 交换机实验 Root ID Priority 32770 Address 0001.6482.5CB8 Cost 19 Port 13(FastEthernet0/13) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32770 (priority 32768 sys-id-ext 2) Address 000D.BD99.5B8C Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/13 Root FWD 19 128.13 P2p Fa0/15 Desg FWD 19 128.15 P2p S2#show spanning-tree vlan 1 VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 Address Cost 19 Port 0001.6482.5CB8 13(FastEthernet0/13) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 000D.BD99.5B8C Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/13 Root FWD 19 128.13 P2p // 该接口是根口 Fa0/15 Desg FWD 19 128.15 P2p // 该接口是指定口 S1#show spanning-tree vlan 1 VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 32769 Address This bridge is the root 0001.6482.5CB8 // 该交换机是根桥 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) 145

第二部分 交换机实验 Address 0001.6482.5CB8 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/15 Desg FWD 19 128.15 P2p Fa0/13 Desg FWD 19 128.13 P2p ( 三 ) 控制交换机 S2 为 VLAN1 的根桥 S2(config)#spanning-tree vlan 1 priority 4096 S2#show spanning-tree vlan 1 VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 4097 Address 000D.BD99.5B8C This bridge is the root Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec // 交换机 S1 成为了 VLAN 1 的根桥了 Bridge ID Priority 4097 (priority 4096 sys-id-ext 1) Address 000D.BD99.5B8C Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/13 Desg FWD 19 128.13 P2p Fa0/15 Desg FWD 19 128.15 P2p S1#show spanning-tree vlan 1 VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 4097 Address 000D.BD99.5B8C Cost 19 Port 13(FastEthernet0/13) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 0001.6482.5CB8 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- 146

Fa0/15 Fa0/13 第二部分 交换机实验 Desg FWD 19 128.15 P2p Root FWD 19 128.13 P2p S3#show spanning-tree vlan 1 VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 4097 Address Cost 19 000D.BD99.5B8C Port 2(FastEthernet0/2) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 00E0.8F60.1977 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/2 Root FWD 19 128.2 P2p Fa0/1 Altn BL K 19 128.1 P2p ( 四 ) 配置 PVST, 对于 VLAN2, 交换机 S1 是根桥 S1(config)#spanning-tree vlan 2 priority 4096 S2(config)#spanning-tree vlan 2 root secondary S3#show spanning-tree vlan 1 略 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/2 Root FWD 19 128.2 P2p Fa0/1 Altn BLK 19 128.1 P2p S3#show spanning-tree vlan 2 略 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/2 Fa0/1 Altn BLK 19 128.2 P2p Root FWD 19 128.1 P2p ( 五 ) 启用交换机 S1 和交换机 S2 之间的 f0/14 链路 S1(config)#int f0/14 S1(config-if)#no shut S1(config-if)#switchport trunk encapsulation dot1q S1(config-if)#switchport mode trunk 147

第二部分 交换机实验 S2(config)#int f0/14 S2(config-if)#no shut S2(config-if)#switchport trunk encapsulation dot1q S2(config-if)#switchport mode trunk S2(config-if)#spanning-tree vlan 1 port-priority 112 148

第二部分 交换机实验 实验 2-11.RSTP 一 实验目的掌握 RSTP 的配置二 实验拓扑 ( 如上图 ) 三 实验步骤在上述实验的基础上继续本实验 配置 RSTP S1(config)#spanning-tree mode rapid-pvst S2(config)#spanning-tree mode rapid-pvst S3(config)#spanning-tree mode rapid-pvst RSTP 状态 S3#show spanning-tree vlan 1 VLAN0001 Spanning tree enabled protocol rstp Root ID Priority 4097 Address Cost 19 Port 0001.42EE.6AC9 2(FastEthernet0/2) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 00E0.8F60.1977 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/2 Root FWD 19 128.2 P2p 配置链路类型 S1(config)#int rang f0/13-14 S1(config-if-range)#duplex full S1(config-if-range)#spanning-tree link-type point-to-point 149

第二部分 交换机实验 S2(config)#int rang f0/13-14 S2(config-if-range)#duplex full S2(config-if-range)#spanning-tree link-type point-to-point S1#show spanning-tree detail Port 14 (FastEthernet0/14) of VLAN0001 is root forwarding Port path cost 19, Port priority 128, Port Identifier 128.14 Designated root has priority 128, address 0004.9A35.0D0E Designated bridge has priority 4097, address 000D.BD99.5B8C Timers: message age 16, forward delay 0, hold 0 Number of transitions to forwarding state: 1 Link type is point-to-point S2#show spanning-tree summary Switch is in rapid-pvst mode Root bridge for: default Extended system ID Portfast Default is enabled is disabled PortFast BPDU Guard Default is disabled Portfast BPDU Filter Default is disabled Loopguard Default is disabled EtherChannel misconfig guard is disabled UplinkFast is disabled BackboneFast is disabled Configured Pathcost method used is short Name Blocking Listening Learning Forwarding STP Active ---------------------- -------- --------- -------- ---------- ---------- VLAN0001 0 0 0 3 3 VLAN0002 1 0 0 2 3 ---------------------- -------- --------- -------- ---------- ---------- 2 vlans 1 0 0 5 6 150

第二部分 交换机实验 实验 2-12. STP 保护 一 实验目的 ( 一 ) 掌握 Root Guard 的使用 ( 二 ) 掌握 Bpdu Guard 的使用二 实验拓扑 三 实验步骤 ( 一 ) 配置交换机 S1 S2 和 S3 之间的 Trunk Switch(config)#host S1 S1(config)#int f0/13 S1(config-if)#switchport trunk encapsulation dot1q S1(config-if)#switchport mode trunk Switch(config)#host S2 S2(config)#int f0/13 S2(config-if)#switchport trunk encapsulation dot1q S2(config-if)#switchport mode trunk S2(config-if)#int f0/15 S2(config-if)#switchport trunk encapsulation dot1q S2(config-if)#switchport mode trunk Switch(config)#host S3 S3(config)#int f0/2 S3(config-if)#switchport trunk encapsulation dot1q S3(config-if)#switchport mode trunk ( 二 ) 配置交换机 S1 成为根桥 S1(config)#spanning-tree vlan 1 priority 8192 ( 三 )S2 的 f0/15 上配置 Guard Root 151

第二部分 交换机实验 S2(config)#int f0/15 S2(config-if)#spanning-tree guard root ( 四 ) 把交换机 S3 改为根交换机 S3(config)#spanning-tree vlan 1 priority 4096 S2#show spanning-tree VLAN0001 Spanning tree enabled protocol ieee Root ID Priority 8193 Address 0007.EC15.7510 Cost 19 Port 13(FastEthernet0/13) Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Bridge ID Priority 32769 (priority 32768 sys-id-ext 1) Address 00D0.BAE7.1AC9 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec Aging Time 20 Interface Role Sts Cost Prio.Nbr Type ---------------- ---- --- --------- -------- -------------------------------- Fa0/13 Root FWD 19 128.13 P2p Fa0/15 Desg LSN 19 128.15 P2p 152

第二部分 交换机实验 实验 2-13. 单臂路由实现 VLAN 间路由 一 实验目的 ( 一 ) 路由器以太网接口上的子接口 ( 二 ) 单臂路由实现 VLAN 间路由的配置二 实验拓扑 三 实验步骤 ( 一 ) 在交换机 S1 上配置 VLAN Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host S1 S1(config)#vlan 2 S1(config-vlan)#exit S1(config)#int f0/1 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 1 S1(config-if)#int f0/2 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 2 ( 二 ) 把交换机上的以太网接口配置成 Trunk 接口 S1(config)#int f0/3 S1(config-if)#switchport mode trunk End with CNTL/Z. ( 三 ) 在路由器 R1 的物理以太网接口下创建子接口, 并定义封装的 VLAN Router>ena Router#conf t 153

第二部分 交换机实验 Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#no shut R1(config-if)#int f0/0.1 R1(config-subif)#encapsulation dot1q 1 R1(config-subif)#ip addr 172.16.1.254 255.255.255.0 R1(config-subif)#int f0/0.2 R1(config-subif)#encapsulation dot1q 2 R1(config-subif)#ip addr 172.16.2.254 255.255.255.0 四 实验调试 R1#show ip route C C 172.16.0.0/24 is subnetted, 2 subnets End with CNTL/Z. 172.16.1.0 is directly connected, FastEthernet0/0.1 172.16.2.0 is directly connected, FastEthernet0/0.2 PC>ping 172.16.2.1 Pinging 172.16.2.1 with 32 bytes of data: Reply from 172.16.2.1: bytes=32 time=125ms TTL=127 Reply from 172.16.2.1: bytes=32 time=125ms TTL=127 Reply from 172.16.2.1: bytes=32 time=125ms TTL=127 Reply from 172.16.2.1: bytes=32 time=125ms TTL=127 154

第二部分 交换机实验 实验 2-14. 三层交换机实现 VLAN 间路由 一 实验目的 ( 一 ) 理解三层交换机的概念 ( 二 ) 配置三层交换 二 实验拓扑 三 实验步骤 ( 一 ) 在交换机 S1 上划分 VLAN Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host S1 S1(config)#vlan 2 S1(config-vlan)#exit S1(config)#int f0/1 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 1 S1(config-if)#int f0/2 S1(config-if)#switchport mode access S1(config-if)#switchport access vlan 2 S1(config-if)#exit ( 二 ) 配置三层交换 S1(config)#ip routing S1(config)#int vlan 1 S1(config-if)#no shut // 开启交换机 S1 的路由功能 S1(config-if)#ip addr 172.16.1.254 255.255.255.0 S1(config-if)#int vlan 2 End with CNTL/Z. 155

第二部分 交换机实验 S1(config-if)#no shut S1(config-if)#ip addr 172.16.2.254 255.255.255.0 四 实验调试 ( 一 ) 检查 IP 地址 S1#show ip interface brief Interface IP-Address OK? Method Status Protocol FastEthernet0/1 unassigned YES manual up up GigabitEthernet0/2 unassigned YES manual down down Vlan1 172.16.1.254 YES manual up up Vlan2 172.16.2.254 YES manual up up ( 二 ) 检查交换机 S1 的路由表 S1#show ip route C 172.16.0.0/24 is subnetted, 2 subnets 172.16.1.0 is directly connected, Vlan1 C 172.16.2.0 is directly connected, Vlan2 ( 三 ) 测试 VLAN 间的通信 Packet Tracer PC Command Line 1.0 PC>ping 172.16.2.1 Pinging 172.16.2.1 with 32 bytes of data: Request timed out. Reply from 172.16.2.1: bytes=32 time=47ms TTL=127 Reply from 172.16.2.1: bytes=32 time=62ms TTL=127 Reply from 172.16.2.1: bytes=32 time=63ms TTL=127 156

第二部分 交换机实验 实验 2-15.HDLC 和 PPP 封装 一 实验目的 ( 一 ) 串行链路上的封装概念 ( 二 ) HDLC 封装 ( 三 ) PPP 封装二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 R1(config)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#encapsulation ppp ( 二 ) 配置路由器 R2 R2(config)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#encapsulation ppp 四 实验调试 ( 一 )show interface s0/0/0 在执行串行接口封装 PPP 之前 R1#show interfaces s0/0/0 Serial0/0/0 is up, line protocol is up (connected) Hardware is HD64570 Internet address is 172.16.12.1/24 MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation HDLC, loopback not set, keepalive set (10 sec) // 默认封装 HDLC 协议 157

第二部分 交换机实验 封装 PPP 之后 R1#show interface s0/0/0 Serial0/0/0 is up, line protocol is up (connected) Hardware is HD64570 Internet address is 172.16.12.1/24 MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation PPP, loopback not set, keepalive set (10 sec) LCP Open Open: IPCP, CDPCP ( 二 )R2#debug ppp negotiation R2#debug ppp negotiation PPP protocol negotiation debugging is on 158

第二部分 交换机实验 实验 2-16.PAP 验证 一 实验目的 ( 一 ) PAP 验证配置 ( 二 )PAP 验证调试二 实验拓扑 三 实验步骤 本实验配置路由器 R1 被路由器 R2 验证, 即单向验证 ( 一 ) 配置路由器 R1 Router(config)#host R1 R1(config)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#encapsulation ppp R1(config-if)#ppp pap sent-username R1 password cisco // 配置将要发送的在中心路由器上被验证的用户名和密码 R1(config-if)#no shut ( 二 ) 配置路由器 R2 Router#conf t Enter configuration commands, one per line. Router(config)#host R2 R2(config)#username R1 password cisco R2(config)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#encapsulation ppp R2(config-if)#ppp authentication pap R2(config-if)#no shut 四 实验调试 R2#debug R2#debug ppp authentication ppp authentication End with CNTL/Z. // 建立本地验证数据库 // 配置 PPP 验证 PPP authentication debugging is on 159

第二部分 交换机实验 实验 2-17.CHAP 验证 一 实验目的 ( 一 )CHAP 验证配置 ( 二 )CHAP 验证调试二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 Router(config)#host R1 R1(config)#username R2 password cisco R1(config)#int s0/0/0 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#encapsulation ppp R1(config-if)#ppp authentication chap R1(config-if)#no shut ( 二 ) 配置路由器 R2 Router(config)#host R2 R2(config)#username R1 password cisco R2(config)#int s0/0/0 R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#encapsulation ppp R2(config-if)#ppp authentication chap R2(config-if)#clock rate 128000 R2(config-if)#no shut 四 实验调试 R1#debug ppp authentication R1#debug ppp authentication PPP authentication debugging is on 160

第二部分 交换机实验 实验 2-18. 帧中继基本配置 一 实验目的 ( 一 ) 帧中继的基本配置 ( 二 ) 帧中继的动态映射 ( 三 ) 帧中继的静态映射 ( 四 ) 帧中继上 RIP 的配置 ( 五 ) 接口水平分割的开启与关闭 二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 Router(config)#host R1 R1(config)#int s0/0/0 R1(config-if)#ip addr 172.16.134.1 255.255.255.0 R1(config-if)#encapsulation frame-relay R1(config-if)#frame-relay? interface-dlci lmi-type map // 接口封装帧中继 Define a DLCI on an interface/subinterface Use CISCO-ANSI-CCITT type LMI Map a protocol address to a DLCI address R1(config-if)#frame-relay lmi-type? ansi cisco q933a 161

第二部分 R1(config-if)#frame-relay lmi-type cisco R1(config-if)#no shut R1(config)#router rip R1(config-router)#version 2 R1(config-router)#no auto-summary R1(config-router)#network 172.16.0.0 ( 二 ) 配置路由器 R3 Router(config)#host R3 R3(config)#int s0/0/0 交换机实验 R3(config-if)#ip addr 172.16.134.3 255.255.255.0 R3(config-if)#encapsulation frame-relay R3(config-if)#no shutdown R3(config-if)#exit R3(config)#router rip R3(config-router)#version 2 R3(config-router)#no auto-summary R3(config-router)#network 172.16.0.0 ( 三 ) 配置路由器 R4 Router(config)#host R4 R4(config)#int s0/0/0 R4(config-if)#ip addr 172.16.134.4 255.255.255.0 R4(config-if)#encapsulation frame-relay R4(config-if)#no shut R4(config-if)#router rip R4(config-router)#version 2 R4(config-router)#no au R4(config-router)#net 172.16.0.0 四 实验调试 ( 一 )show frame-relay map // 查看帧中继的映射 R1#show frame-relay map // 配置接口的 LMI 类型 Serial0/0/0 (up): ip 172.16.134.3 dlci 103, dynamic, broadcast, CISCO, status defined, active Serial0/0/0 (up): ip 172.16.134.4 dlci 104, dynamic, broadcast, CISCO, status defined, active R3#show frame-relay map Serial0/0/0 (up): ip 172.16.134.1 dlci 301, dynamic, broadcast, CISCO, status defined, active Serial0/0/0 (up): ip 172.16.134.4 dlci 304, dynamic, broadcast, CISCO, status defined, active R4#show frame-relay map Serial0/0/0 (up): ip 172.16.134.1 dlci 401, dynamic, broadcast, CISCO, status defined, active Serial0/0/0 (up): ip 172.16.134.3 dlci 403, dynamic, broadcast, CISCO, status 162

第二部分 交换机实验 defined, active ( 二 )sho frame-relay pvc R1#sho frame-relay pvc PVC Statistics for interface Serial0/0/0 (Frame Relay DTE) DLCI = 103, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE, INTERFACE = Serial0/0/0 input pkts 14055 output pkts 32795 in bytes 1096228 out bytes 6216155 dropped pkts 0 in FECN pkts 0 in BECN pkts 0 out FECN pkts 0 out BECN pkts 0 in DE pkts 0 out DE pkts 0 out bcast pkts 32795 out bcast bytes 6216155 DLCI = 104, DLCI USAGE = LOCAL, PVC STATUS = ACTIVE, INTERFACE = Serial0/0/0 input pkts 14055 output pkts 32795 in bytes 1096228 out bytes 6216155 dropped pkts 0 in FECN pkts 0 in BECN pkts 0 out FECN pkts 0 out BECN pkts 0 in DE pkts 0 out DE pkts 0 out bcast pkts 32795 out bcast bytes 6216155 ( 三 )sho frame-relay lmi R1#sho frame-relay lmi LMI Statistics for interface Serial0/0/0 (Frame Relay DTE) LMI TYPE = CISCO // 接口 s0/0/0 帧中继的 DTE,LMI 类型为 CISCO Invalid Unnumbered info 0 Invalid Prot Disc 0 Invalid dummy Call Ref 0 Invalid Msg Type 0 Invalid Status Message 0 Invalid Lock Shift 0 Invalid Information ID 0 Invalid Report IE Len 0 Invalid Report Request 0 Invalid Keep IE Len 0 Num Status Enq. Sent 145 Num Status msgs Rcvd 144 Num Update Status Rcvd 0 Num Status Timeouts 16 ( 四 )show ip route R1#show ip route C R R C 172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks 172.16.1.1/32 is directly connected, Loopback0 172.16.3.3/32 [120/1] via 172.16.134.3, 00:00:02, Serial0/0/0 172.16.4.4/32 [120/1] via 172.16.134.4, 00:00:12, Serial0/0/0 172.16.134.0/24 is directly connected, Serial0/0/0 ( 五 ) 配置帧中继静态映射 Router(config)#host R1 R1(config)#int s0/0/0 163

第二部分 R1(config-if)#encapsulation frame-relay // 配置帧中继静态映射 交换机实验 R1(config-if)#frame-relay map ip 172.16.134.3 103 broadcast R1(config-if)#frame-relay map ip 172.16.134.4 104 broadcast R1(config-if)#frame-relay map ip 172.16.134.1 104 broadcast // 配置到自己接口的 IP 地址的映射, 目的是允许 ping 路由器该接口的 IP 地址 R1(config-if)#ip addr 172.16.134.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.255 R1(config)#router rip R1(config-router)#version 2 R1(config-router)#no au R1(config-router)#ne 172.16.0.0 Router(config)#host R3 R3(config)#int s0/0/0 R3(config-if)#encapsulation frame-relay R3(config-if)#frame-relay map ip 172.16.134.1 301 broadcast R3(config-if)#frame-relay map ip 172.16.134.4 301 broadcast R3(config-if)#frame-relay map ip 172.16.134.3 301 broadcast R3(config-if)#ip addr 172.16.134.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int lo0 R3(config-if)#ip addr 172.16.3.3 255.255.255.255 R3(config)#router rip R3(config-router)#version 2 R3(config-router)#no au R3(config-router)#ne 172.16.0.0 Router(config)#host R4 R4(config)#int s0/0/0 R4(config-if)#encapsulation frame-relay R4(config-if)#frame-relay map ip 172.16.134.1 401 broadcast R4(config-if)#frame-relay map ip 172.16.134.3 401 broadcast R4(config-if)#frame-relay map ip 172.16.134.4 401 broadcast R4(config-if)#ip addr 172.16.134.4 255.255.255.0 R4(config-if)#no shut R4(config-if)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.255 R4(config)#router rip R4(config-router)#version 2 R4(config-router)#network 172.16.0.0 R4(config-router)#no au R1#show frame-relay map 164

active 第二部分 交换机实验 Serial0/0/0 (up): ip 172.16.134.3 dlci 103, static, broadcast, CISCO, defined, Serial0/0/0 (up): ip 172.16.134.4 dlci 104, static, broadcast, CISCO, status defined, active Serial0/0/0 (up): ip 172.16.134.1 dlci 104, static, broadcast, CISCO, status defined, active R3#show frame-relay map Serial0/0/0 (up): ip 172.16.134.1 dlci 301, static, broadcast, CISCO, status defined, active Serial0/0/0 (up): ip 172.16.134.4 dlci 301, static, broadcast, CISCO, status defined, active Serial0/0/0 (up): ip 172.16.134.3 dlci 301, static, broadcast, CISCO, status defined, active R1#show ip route rip 172.16.0.0/16 is variably subnetted, 4 subnets, 2 masks R 172.16.3.3/32 [120/1] via 172.16.134.3, 00:00:16, Serial0/0/0 R 172.16.4.4/32 [120/1] via 172.16.134.4, 00:00:05, Serial0/0/0 165

第二部分 交换机实验 实验 2-19. 帧中继多点子接口配置 OSPF 一 实验目的 ( 一 ) 帧中继多点子接口的特征 ( 二 ) 帧中继多点子接口的配置 ( 三 ) NBMA 模式下 OSPF 的配置与测试 ( 四 ) NBMA 模式下的 DR 选举二 实验拓扑 三 实验步骤 ( 一 ) 配置和路由器 R1 Router(config)#host R1 R1(config)#int lo0 R1(config-if)#ip addr 172.16.1.1 255.255.255.255 R1(config-if)#int s0/0/0 R1(config-if)#no ip address R1(config-if)#encapsulation frame-relay R1(config-if)#no shut R1(config-if)#exit // 物理接口下不要配置 IP 地址 // 接口封装帧中继 R1(config)#int s0/0/0.1 multipoint // 创建帧中继多点子接口 R1(config-subif)#ip addr 172.16.134.1 255.255.255.0 166

第二部分 交换机实验 R1(config-subif)#frame-relay map ip 172.16.134.3 103 broadcast R1(config-subif)#frame-relay map ip 172.16.134.4 104 broadcast R1(config-subif)#frame-relay map ip 172.16.134.1 103 R1(config-subif)#exit R1(config)#router ospf 1 R1(config-router)#router-id 1.1.1.1 R1(config-router)#network 172.16.1.0 0.0.0.255 area 0 R1(config-router)#network 172.16.134.0 0.0.0.255 area 0 ( 二 ) 配置路由器 R3 Router(config)#host R3 R3(config)#int lo0 R3(config-if)#ip addr 172.16.3.3 255.255.255.255 R3(config-if)#int s0/0/0 R3(config-if)#no ip addr R3(config-if)#encapsulation frame-relay R3(config-if)#no shut R3(config-if)#exit R3(config)#int s0/0/0.1 mu R3(config-subif)#ip addr 172.16.134.4 255.255.255.0 R3(config-subif)#ip ospf priority 0 // 配置端口优先级, 确保路由器 R1 成为 DR R3(config-subif)#frame-relay map ip 172.16.134.1 301 broadcast R3(config-subif)#frame-relay map ip 172.16.134.4 301 broadcast R3(config-subif)#frame-relay map ip 172.16.134.3 301 R3(config-subif)#exit R3(config)#router ospf 1 R3(config-router)#router-id 3.3.3.3 R3(config-router)#net 172.16.3.0 0.0.0.255 area 0 R3(config-router)#net 172.16.134.0 0.0.0.255 area 0 ( 三 ) 配置路由器 R4 Router(config)#host R4 R4(config)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.255 R4(config-if)#int s0/0/0 R4(config-if)#no ip addr R4(config-if)#encapsulation frame-relay R4(config-if)#no shut R4(config-if)#exit R4(config)#int s0/0/0.1 mu R4(config-subif)#ip addr 172.16.134.4 255.255.255.0 R4(config-subif)#ip ospf priority 0 R4(config-subif)#frame-relay map ip 172.16.134.1 401 broadcast R4(config-subif)#frame-relay map ip 172.16.134.3 401 broadcast 167

第二部分 交换机实验 R4(config-subif)#frame-relay map ip 172.16.134.4 401 R4(config-subif)#exit R4(config)#router ospf 1 R4(config-router)#router-id 4.4.4.4 R4(config-router)#net 172.16.4.0 0.0.0.255 area 0 R4(config-router)#net 172.16.134.0 0.0.0.255 area 0 四 实验调试 ( 一 )show frame-relay map R1#show frame-relay map Serial0/0/0.1 (up): ip 172.16.134.3 dlci 103, static, broadcast, CISCO, status defined, active Serial0/0/0.1 (up): ip 172.16.134.4 dlci 104, static, broadcast, CISCO, status defined, active Serial0/0/0.1 (up): ip 172.16.134.1 dlci 103, static, CISCO, status defined, active ( 二 )show ip ospf interface R1#show ip ospf interface s0/0/0.1 Serial0/0/0.1 is up, line protocol is up Internet address is 172.16.134.1/24, Area 0 Process ID 1, Router ID 1.1.1.1, Network Type MULTI-POINT, Cost: 64 Transmit Delay is 1 sec, State DR, Priority 1 Designated Router (ID) 1.1.1.1, Interface address 172.16.134.1 No backup designated router on this network Timer intervals configured, Hello 30, Dead 120, Wait 120, Retransmit 5 Hello due in 00:00:01 Index 2/2, flood queue length 0 Next 0x0(0)/0x0(0) Last flood scan length is 1, maximum is 1 Last flood scan time is 0 msec, maximum is 0 msec Neighbor Count is 0, Adjacent neighbor count is 0 Suppress hello for 0 neighbor(s) ( 不能建立邻居列表 ) 168

第二部分 交换机实验 实验 2-20. 帧中继点到点子接口下配置 OSPF 一 实验目的 ( 一 ) 帧中继点到点子接口的特征 ( 二 ) 帧中继点到点子接口的配置 ( 三 ) 帧中继点到点子接口模式下 OSPF 的配置和调试二 实验拓扑 三 实验步骤 ( 一 ) 配置 DLCI 号点击 R2, 选择 配置 选项, 点击 S0 接口, 在 DLCI 输入 103, 名称输入 to R3, 其他类 似, 在点击帧中继, 选择对应的号就可以了 169

( 二 ) 配置路由器 R1 Router(config)#host R1 R1(config)#int lo0 第二部分 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#no ip address R1(config-if)#encapsulation frame-relay R1(config)#int s0/0/0.13 point-to-point // 创建帧中继点到点子接口 R1(config-subif)#ip addr 172.16.13.1 255.255.255.0 R1(config-subif)#frame-relay interface-dlci 103 R1(config-subif)#exit R1(config)#int s0/0/0.14 point-to-point R1(config-subif)#ip addr 172.16.14.1 255.255.255.0 R1(config-subif)#frame-relay interface-dlci 104 R1(config-subif)#router ospf 1 R1(config-router)#router-id 1.1.1.1 交换机实验 R1(config-router)#network 172.16.1.0 0.0.0.255 area 0 R1(config-router)#network 172.16.13.0 0.0.0.255 area 0 R1(config-router)#network 172.16.14.0 0.0.0.255 area 0 ( 三 ) 配置路由器 R3 Router(config)#host R3 R3(config)#int lo0 R3(config-if)#ip addr 172.16.3.3 255.255.255.0 R3(config-if)#int s0/0/1 R3(config-if)#no ip add R3(config-if)#encapsulation frame-relay R3(config-if)#no shut R3(config)#int s0/0/1.13 point-to-point R3(config-subif)#ip addr 172.16.13.3 255.255.255.0 R3(config-subif)#frame-relay interface-dlci 301 R3(config-subif)#exit R3(config)#router ospf 1 R3(config-router)#route R3(config-router)#router-id 3.3.3.3 R3(config-router)#network 172.16.3.0 0.0.0.255 area 0 R3(config-router)#network 172.16.13.0 0.0.0.255 area 0 ( 四 ) 配置路由器 R4 Router(config)#host R4 R4(config)#int lo0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config)#int s0/0/1 R4(config-if)#no ip add R4(config-if)#encapsulation frame-relay R4(config-if)#no shut R4(config-if)#exit 170

第二部分 交换机实验 R4(config)#int s0/0/1.14 point-to-point R4(config-subif)#ip addr 172.16.14.4 255.255.255.0 R4(config-subif)#frame-relay interface-dlci 401 R4(config-subif)#exit R4(config)#router ospf 1 R4(config-router)#router-id 4.4.4.4 R4(config-router)#network 172.16.4.0 0.0.0.255 area 0 R4(config-router)#network 172.16.14.0 0.0.0.255 area 0 四 实验调试 ( 一 )show frame-relay map R1#show frame-relay map Serial0/0/0.13 (up): point-to-point dlci, dlci 103, broadcast, status defined, active Serial0/0/0.14 (up): point-to-point dlci, dlci 104, broadcast, status defined, active R3#show frame-relay map Serial0/0/1.13 (up): point-to-point dlci, dlci 301, broadcast, status defined, active R4#show frame-relay map Serial0/0/1.14 (up): point-to-point dlci, dlci 401, broadcast, status defined, active // 输出表面路由器使用了点到点子接口, 每条映射条目只可看到该子接口下的 DLCI, 但没有对 端的 IP 地址 ( 二 )R1#show ip ospf interface R1#show ip ospf interface s0/0/0.13 Serial0/0/0.13 is up, line protocol is up Internet address is 172.16.13.1/24, Area 0 Process ID 1, Router ID 1.1.1.1, Network Type POINT-TO-POINT, Cost: 64 //OSPF 网络类型为点到点 Transmit Delay is 1 sec, State POINT-TO-POINT, Priority 0 No designated router on this network No backup designated router on this network Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5 // 点到点模式下,Hello 周期为 10s. Hello due in 00:00:05 Index 2/2, flood queue length 0 略 ( 三 )show ip route R1#show ip route ospf O O 172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks 172.16.3.3 [110/65] via 172.16.13.3, 00:30:48, Serial0/0/0.13 172.16.4.4 [110/65] via 172.16.14.4, 00:22:32, Serial0/0/0.14 R3#show ip route ospf 172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks O 172.16.1.1 [110/65] via 172.16.13.1, 00:32:37, Serial0/0/1.13 171

第二部分 交换机实验 O O 172.16.4.4 [110/129] via 172.16.13.1, 00:24:11, Serial0/0/1.13 172.16.14.0 [110/128] via 172.16.13.1, 00:32:37, Serial0/0/1.13 R4#show ip route ospf O O O ( 四 ) 172.16.0.0/16 is variably subnetted, 5 subnets, 2 masks 172.16.1.1 [110/65] via 172.16.14.1, 00:25:21, Serial0/0/1.14 172.16.3.3 [110/129] via 172.16.14.1, 00:25:21, Serial0/0/1.14 172.16.13.0 [110/128] via 172.16.14.1, 00:25:21, Serial0/0/1.14 R3#show ip ospf neighbor detail Neighbor 1.1.1.1, interface address 172.16.13.1 In the area 0 via interface Serial0/0/1.13 Neighbor priority is 0, State is FULL, 6 state changes DR is 0.0.0.0 BDR is 0.0.0.0 // 点到点模式的 DR 和 BDR 事 0.0.0.0 Options is 0x00 Dead timer due in 00:00:36 Neighbor is up for 00:34:25 Index 1/1, retransmission queue length 0, number of retransmission 0 First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0) Last retransmission scan length is 0, maximum is 0 Last retransmission scan time is 0 msec, maximum is 0 msec 172

第二部分 交换机实验 实验 2-21. 路由器的访问安全 一 实验目的 ( 一 ) 掌握路由器访问安全的配置 ( 二 ) 掌握用 SSH 协议访问路由器的配置二 实验拓扑 三 实验步骤 ( 一 ) 配置 IP 地址 Router(config)#host R1 R1(config)# R1(config)#int f0/0 R1(config-if)#no shut R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#int s0/0/0 R1(config-if)#no shut R1(config-if)#ip addr 172.16.12.1 255.255.255.0 Router(config)#host R2 R2(config)#int s0/0/0 R2(config-if)#no shut R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 //PC 的网卡配置为 172.16.1.100 255.255.255.0, 并测试和路由器 R1 的连通性 ( 二 ) 在路由器 R1 上配置密码和 login 安全等 R1(config)#enable secret cisco R1(config)#service password-encryption R1(config)#line console 0 R1(config-line)#password cisco // 配置 enable 密码 // 启用密码加密服务 173

第二部分 交换机实验 R1(config-line)#login R1(config-line)#line vty 0 4 R1(config-line)#password cisco R1(config-line)#login // 配置 Console 口密码 // 配置 Telnet 的密码和登录, 如果需要有不同用户有各自的密码, 采用如下配置 : R1(config)#aaa? authentication authorization new-model Authentication configurations parameters. Authorization configurations parameters. Enable NEW access control commands and functions.(disables OLD commands.) R1(config)#aaa new-model // 启用 AAA 功能 R1(config)#aaa authentication login aaa_local? enable group local none Use enable password for authentication. Use Server-group. Use local username authentication. NO authentication. R1(config)#aaa authentication login aaa_local local // 定义一个 login 的认证方法, 名为 aaa_local R1(config)#username user1 secret cisco R1(config)#username user2 secret 12345 R1(config)#security passwords min-length 5 R1(config)#line con 0 R1(config-line)#login authentication aaa_local // 配置从 console 口登录时要进行认证 R1(config-line)#exec-timeout? <0-35791> Timeout in minutes R1(config-line)#exec-timeout 5? <0-2147483> Timeout in seconds <cr> R1(config-line)#exec-timeout 5 30 // 配置超时时间 R1(config)#access-list 5 permit 172.16.0.0 0.0.255.255 R1(config)#line vty 0 4 R1(config-line)#acc R1(config-line)#access-class 5 in R1(config-line)#exec R1(config-line)#exec-timeout 5 30 R1(config-line)#login authentication aaa_local User Access Verification Username: // 配置密码的最小长度 为了防止黑客暴力破解密码, 可以对用户频繁登录进行限制 : R1(config)#login block-for 60 attempts 3 within 30 // 配置用户 30s 内连续登录失败 3 次后, 等待 60s 后, 才能再次登录 R1(config)#login on-failure log // 登录失败会在日志中记录 R1(config)#login on-success log // 登录成功会在日志中记录 R1#show login 174

第二部分 交换机实验 No login delay has been applied. No Quiet-Mode access list has been configured. All failed login is logged. All successful login is logged. Router enabled to watch for login Attacks. If more than 3 login failures occur in 30 seconds or less, logins will be disabled for 60 seconds. Router presently in Normal-Mode. Current Watch Window Time remaining: 16 seconds. Login failures for current window: 0. Total login failures: 0. 常常配置一些提示信息, 在用户登录时显示给用户 R1(config)#banner motd $ Enter TEXT message. End with the character '$'. without authorization,shall not be visited $ Banner motd 在路由器提示输入用户和密码前出现 Banner login 提示输入用户和密码前出现, 但是在 banner motd 之后, 该信息只在从 console 口登录时才出现 Banner exec 在进入 exec 模式之前提示的信息, 即用户通过了认证后 R1(config)#banner login # Enter TEXT message. End with the character '#'. LLLLLLLLLLLLLLL # ( 三 ) 配置 SSH R1(config)#clock timezone GMT 8 R1(config)#exit // 配置路由器的时区 R1#clock set 16:42:50 29 march 2010 // 配置路由器的时间 R1(config)#ip domain-name cisco.com R1(config)#crypto key generate rsa // 配置域名 The name for the keys will be: R1.cisco.com Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes. How many bits in the modulus [512]: // 密钥的长度 % Generating 512 bit RSA keys, keys will be non-exportable...[ok] R1(config)#line vty 0 4 R1(config-line)#transport input? all All protocols none No protocols 175

第二部分 交换机实验 ssh TCP/IP SSH protocol telnet TCP/IP Telnet protocol R1(config-line)#transport input ssh // 只允许用户通过 SSH 远程登录到路由器 R2#ssh? -l Log in using this user name // 指明用户名 -v Specify SSH Protocol Version // 指明 SSH 版本 R2#ssh -l user2 172.16.12.1 Open Password: ( 密码 12345) R1> ( 四 ) 关闭不必要的服务 (no...) ( 五 )R1#auto secure 176

第二部分 交换机实验 实验 2-22. 路由器日志 一 实验目的 ( 一 ) 掌握日志服务器软件的使用 ( 二 ) 掌握把路由器日志发送到服务器的配置 二 实验拓扑 三 实验步骤 R1(config)#logging? A.B.C.D buffered console host on trap 如上实验拓扑图 IP address of the logging host Set buffered logging parameters Set console logging parameters Set syslog server IP address and parameters Enable logging to all enabled destinations Set syslog server logging level userinfo Enable logging of user info on privileged mode enabling R1(config)#logging on // 打开路由器的日志功能 R1(config)#logging console R1(config)#logging buffered R1(config)#logging host 172.16.1.100 // 把日志在控制台上显示出来 // 把日志记录在内存中 %SYS-6-LOGGINGHOST_STARTSTOP: Logging to host 172.16.1.100 port 514 started - CLI initiated // 把日志发送到专门的日志服务器, 服务器地址为 172.16.1.100 R1(config)#logging trap debugging R1(config)#service? nagle password-encryption timestamps R1(config)#service timestamps? debug Timestamp debug messages Enable Nagle's congestion control algorithm Encrypt system passwords Timestamp debug/log messages log Timestamp log messages R1(config)#service timestamps log datetime msec R1#show logging Syslog logging: enabled (0 messages dropped, 0 messages rate-limited, 0 flushes, 0 overruns, xml disabled, filtering disabled) // 发送到 syslog 服务器上的日志情况 No Active Message Discriminator. 177

第二部分 No Inactive Message Discriminator. 交换机实验 Console logging: level debugging, 13 messages logged, xml disabled, filtering disabled // 发送到控制台的日志情况 Monitor logging: level debugging, 0 messages logged, xml disabled, filtering disabled // 发送到终端的日志情况 Buffer logging: filtering disabled // 发送到内存的日志情况 Logging Exception size (4096 bytes) level debugging, 0 messages logged, xml disabled, Count and timestamp logging messages: disabled Persistent logging: disabled No active filter modules. ESM: 0 messages dropped Trap logging: level debugging, 14 message lines logged Logging to 172.16.1.100 (udp port 514, audit disabled, authentication disabled, encryption disabled, link up), 3 message lines logged, 0 message lines rate-limited, 0 message lines dropped-by-md, xml disabled, sequence number disabled filtering disabled Log Buffer (4096 bytes): 四 实验调试 178

第二部分 交换机实验 实验 2-23. 标准 ACL 一 实验目的 ( 一 )ACL 工作方式和工作过程 ( 二 ) 定义标准 ACL ( 三 ) 应用标准 ACL ( 四 ) access-class 命令应用 ( 五 ) 定义命令标准 ACL 二 实验拓扑 三 实验步骤 要求 : 拒绝 PC2 所在网段访问 Server(172.16.3.100) 只允许 PC1 访问路由器 R1 路由器 R2 和路由器 R3 的 Telnet 服务 ( 一 ) 配置路由器 R1 Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int f0/1 R1(config-if)#ip addr 172.16.2.1 255.255.255.0 R1(config-if)#no shut 179

R1(config-if)#int s0/0/0 第二部分 交换机实验 R1(config-if)#ip addr 172.16.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#router eigrp 1 R1(config-router)#net 172.16.1.0 0.0.0.255 R1(config-router)#net 172.16.2.0 0.0.0.255 R1(config-router)#net 172.16.12.0 0.0.0.255 R1(config-router)#no au R1(config-router)#exit R1(config)#access-list 2? deny permit remark Specify packets to reject Specify packets to forward Access list entry comment R1(config)#access-list 2 remark only host pc1 can telnet // 添加备注增加列表的可读性 R1(config)#access-list 2 permit host 172.16.1.100 R1(config)#line vty 0 4 R1(config-line)#access-class 2 in R1(config-line)#password cisco R1(config-line)#login ( 二 ) 配置路由器 R2 Router(config)#host R2 R2(config)#int s0/0/0 // 在 VTY 下应用 ACL R2(config-if)#ip addr 172.16.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 172.16.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router eigrp 1 R2(config-router)#net 172.16.12.0 0.0.0.255 180 // 定义 ACL %DUAL-5-NBRCHANGE: IP-EIGRP 1: Neighbor 172.16.12.1 (Serial0/0/0) is up: new adjacency R2(config-router)#net 172.16.23.0 0.0.0.255 R2(config-router)#no au R2(config-router)#exit R2(config)#access-list 2 remark ony host pc1 can telnet R2(config)#access-list 2 permit host 172.16.1.100 R2(config)#line vty 0 4 R2(config-line)#access-class 2 in R2(config-line)#password cisco R2(config-line)#login ( 三 ) 配置路由器 R3

第二部分 交换机实验 Router(config)#host R3 R3(config)#int f0/0 R3(config-if)#ip addr 172.16.3.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/1 R3(config-if)#ip addr 172.16.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router eigrp 1 R3(config-router)#net 172.16.23.0 0.0.0.255 R3(config-router)#net 172.16.3.0 0.0.0.255 R3(config-router)#no au R3(config-router)#exit R3(config)#access-list 2 remark only host pc1 can telnet R3(config)#access-list 2 permit 172.16.1.100 R3(config)#access-list 1 remark deny network 172.16.2.0 from R1 R3(config)#access-list 1 deny 172.16.2.0 0.0.0.255 R3(config)#access-list 1 permit any R3(config)#int s0/0/1 R3(config-if)#ip access-group 1 in R3(config-if)#line vty 0 4 R3(config-line)#access-class 2 in R3(config-line)#password cisco R3(config-line)#login 四 实验调试 ( 一 )Telnet 测试 // 接口下应用 ACL 只用 PC1 可以成功 Telnet 到各个路由器, 其他地址登录将不能成功, 显示信息如下 : % Connection refused by remote host ( 二 )Ping 和 tracerouter 测试在路由器 R1 上 ping 主机 172.16.3.100 R1#ping 172.16.3.100 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.3.100, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 78/88/94 ms R1#traceroute 172.16.3.100 Type escape sequence to abort. Tracing the route to 172.16.3.100 1 172.16.12.2 31 msec 15 msec 31 msec 2 172.16.23.3 63 msec 63 msec 62 msec 3 172.16.3.100 94 msec 94 msec 94 msec 通的原因是它是以路由器 s0/0/0 接口的地址 (172.16.12.2) 发起的, 没有被 ACL 拒绝 使用扩展 ping 和扩展 tracerouter 命令 181

R1#ping Protocol [ip]: 第二部分 Target IP address: 172.16.3.100 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 172.16.2.1 Type of service [0]: Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: 交换机实验 Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.3.100, timeout is 2 seconds: Packet sent with a source address of 172.16.2.1... Success rate is 0 percent (0/5) R1#traceroute Protocol [ip]: Target IP address: 172.16.3.100 Source address: 172.16.2.1 Numeric display [n]: Timeout in seconds [3]: Probe count [3]: Minimum Time to Live [1]: Maximum Time to Live [30]: Type escape sequence to abort. Tracing the route to 172.16.3.100 1 172.16.12.2 31 msec 32 msec 31 msec 2 * * * 3 * * * 4 * * * 5 * * * ( 三 )show ip access-lists R3#show ip access-lists Standard IP access list 2 // 标准 IP ACL permit host 172.16.1.100 (2 match(es)) Standard IP access list 1 deny 172.16.2.0 0.0.0.255 (184 match(es)) permit any (406 match(es)) // 这么多数据包匹配的原因与 EIGRP 的 Hello 包有关 ( 四 )show ip interface 182

R3#show ip interface s0/0/1 第二部分 交换机实验 Serial0/0/1 is up, line protocol is up (connected) Internet address is 172.16.23.3/24 Broadcast address is 255.255.255.255 Address determined by setup command MTU is 1500 Helper address is not set Directed broadcast forwarding is disabled Outgoing access list is not set Inbound access list is 1 Proxy ARP is enabled Security level is default ( 五 ) 配置命令标准 ACL R3(config)#ip access-list standard acl1 // 定义标准命令 ACL R3(config-std-nacl)#remark deny network 172.16.2.0 from r1 R3(config-std-nacl)#deny 172.16.2.0 0.0.0.255 R3(config-std-nacl)#permit any R3(config-std-nacl)#int s0/0/1 R3(config-if)#ip ac R3(config-if)#ip access-group acl1 in // 接口下应用命令 ACL 183

第二部分 交换机实验 实验 2-24. 扩展 ACL 1433 一 实验目的 ( 一 ) 定义扩展 ACL ( 二 ) 应用扩展 ACL ( 三 ) 扩展 ACL 测试 ( 四 ) 定义命名扩展 ACL 二 实验拓扑 如上图实验 三 实验步骤 要求 : 拒绝 PC1 所在网段访问 Server 172.16.3.100 的 Web 服务 拒绝 PC2 所在网段访问 Server 172.16.3.100 的 Ftp 服务 拒绝 PC1 所在网段访问 Server 172.16.3.100 的 SQL 服务 拒绝 PC1 所在网段访问路由器 R3 的 Telnet 服务 拒绝 PC2 所在网段访问路由器 R2 的 Web 服务 拒绝 PC1 和 PC2 所在网段 ping Server 服务器 只允许路由器 R3 以接口 s0/0/1 为源 ping 路由器 R2 的接口 s0/0/1 地址, 而不允许路由器 R2 以接口 s0/0/1 为源 ping 路由器 R3 的接口 s0/0/1 地址, 即单向 ping. ( 一 ) 配置路由器 R1(config)#access-list 110 remark this is an example for extended acl // 添加备注, 增加可读性 R1(config)#access-list 110 deny tcp 172.16.1.0 0.0.0.255 host 172.16.3.100 eq 80 // 拒绝 PC1 所在网段访问 Server 172.16.3.100 的 Web 服务 R1(config)#access-list 110 deny tcp 172.16.2.0 0.0.0.255 host 172.16.3.100 eq 21 R1(config)#access-list 110 deny tcp 172.16.2.0 0.0.0.255 host 172.16.3.100 eq 20 // 拒绝 PC2 所在网段访问 Server 172.16.3.100 的 Ftp 服务 R1(config)#access-list 110 deny tcp 172.16.1.0 0.0.0.255 host 172.16.3.100 eq // 拒绝 PC1 所在网段访问 Server 172.16.3.100 的 SQL 服务 R1(config)#access-list 110 deny tcp 172.16.1.0 0.0.0.255 host 172.16.23.3 eq 23 R1(config)#access-list 110 deny tcp 172.16.1.0 0.0.0.255 host 172.16.3.3 eq 23 // 拒绝 PC1 所在网段访问路由器 R3 的 Telnet 服务 R1(config)#access-list 110 deny tcp 172.16.2.0 0.0.0.255 host 172.16.12.2 eq 80 R1(config)#access-list 110 deny tcp 172.16.2.0 0.0.0.255 host 172.16.23.2 eq 80 // 拒绝 PC2 所在网段访问路由器 R2 的 Web 服务 R1(config)#access-list 110 deny icmp 172.16.1.0 0.0.0.255 host 172.16.3.100 184

第二部分 交换机实验 R1(config)#access-list 110 deny icmp 172.16.2.0 0.0.0.255 host 172.16.3.100 // 拒绝 PC1 和 PC2 所在网段 ping Server 服务器 R1(config)#access-list 110 permit ip any any R1(config)#int s0/0/0 R1(config-if)#i ac R1(config-if)#i acc R1(config-if)#ip ac R1(config-if)#ip access-group 110 out // 接口下应用 ACL ( 二 ) 配置路由器 R3 R3(config)#access-list 120 deny icmp host 172.16.23.2 host 172.16.23.3 echo R3(config)#access-list 120 permit ip any any R3(config)#int s0/0/1 R3(config-if)#ip access-group 120 in 四 实验调试 ( 一 ) 路由器 R1 上查看 ACL110 R1#show ip access-lists 110 Extended IP access list 110 deny tcp 172.16.1.0 0.0.0.255 host 172.16.3.100 eq www deny tcp 172.16.2.0 0.0.0.255 host 172.16.3.100 eq ftp deny tcp 172.16.2.0 0.0.0.255 host 172.16.3.100 eq 20 deny tcp 172.16.1.0 0.0.0.255 host 172.16.3.100 eq 1433 deny tcp 172.16.1.0 0.0.0.255 host 172.16.23.3 eq telnet deny tcp 172.16.1.0 0.0.0.255 host 172.16.3.3 eq telnet deny tcp 172.16.2.0 0.0.0.255 host 172.16.12.2 eq www deny tcp 172.16.2.0 0.0.0.255 host 172.16.23.2 eq www deny icmp 172.16.1.0 0.0.0.255 host 172.16.3.100 deny icmp 172.16.2.0 0.0.0.255 host 172.16.3.100 permit ip any any ( 二 ) 路由器 R3 和路由器 R2 互相 ping R3#ping 172.16.23.2 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.23.2, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 15/31/47 ms R2#ping 172.16.23.3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.23.3, timeout is 2 seconds:... Success rate is 0 percent (0/5) ( 三 ) 路由器 R3 查看 ACL 120 185

R3#show ip access-lists 120 Extended IP access list 120 第二部分 交换机实验 deny icmp host 172.16.23.2 host 172.16.23.3 echo (5 match(es)) permit ip any any (65 match(es)) ( 四 ) 配置命令扩展 ACL R3(config)#ip access-list extended acl120 R3(config-ext-nacl)#deny icmp host 172.16.23.2 host 172.16.23.3 echo R3(config-ext-nacl)#permit ip any any R3(config-ext-nacl)#int s0/0/1 R3(config-if)#ip access-group acl120 in R3#show ip access-lists Extended IP access list acl120 deny icmp host 172.16.23.2 host 172.16.23.3 echo (5 match(es)) permit ip any any (16 match(es)) 186

第二部分 交换机实验 实验 2-25. 通过 ADSL 连接到 Internet( ( 使用 ADSL Modem) 一 实验目的 掌握在路由器上使用 ADSL Modem 连接到 Internet 的配置 二 实验拓扑 三 实验步骤 ( 一 )DSL Modem 配置和计算机的网卡配置 ( 二 )R1 的配置 187

Router(config)#host R1 R1(config)#int f0/0 第二部分 交换机实验 R1(config-if)#ip addr 172.16.1.254 255.255.255.0 R1(config-if)#no shut R1(config)#int f0/1 R1(config-if)#ip addr 172.16.2.254 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#ip dhcp pool feiniao0 R1(dhcp-config)#network 172.16.1.0 255.255.255.0 R1(dhcp-config)#default-router 172.16.1.254 R1(dhcp-config)#dns-server 172.16.2.253 R1(dhcp-config)#exit R1(config)#ip dhcp pool feiniao1 R1(dhcp-config)#network 172.16.2.0 255.255.255.0 R1(dhcp-config)#default-router 172.16.2.254 R1(dhcp-config)#dns-server 172.16.2.253 188

第二部分 交换机实验 实验 2-26.GRE Tunnel 一 实验目的 ( 一 ) 理解 GRE Tunnel 的概念 ( 二 ) 掌握 GRE Tunnel 的配置二 实验拓扑 三 实验步骤 路由器 R2 和路由器 R3 模拟 Internet, 路由器 R1 的 f0/0 接口模拟为远程办公室所在的局 域网, 路由器 R4 模拟为企业总部所在的局域网 把远程办公室和企业总部进行连接 ( 一 )IP 地址和路由配置, 测试公网接口网络的连通性 Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int s0/0/0 R1(config-if)#ip addr 202.96.134.1 255.255.255.0 R1(config-if)#no shut R1(config)#ip route 0.0.0.0 0.0.0.0 s0/0/0 //R1 通常由默认路由指向 Internet Router(config)#host R2 R2(config)#int s0/0/0 R2(config-if)#ip addr 202.96.134.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 218.30.1.2 255.255.255.0 R2(config-if)#clock rate 128000 189

R2(config-if)#no shut R2(config-if)#exit 第二部分 交换机实验 R2(config)#ip route 61.0.0.0 255.255.255.0 s0/0/1 Router(config)#host R3 R3(config)#int s0/0/1 R3(config-if)#ip addr 218.30.1.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/0 R3(config-if)#ip addr 61.0.0.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#ip route 202.96.134.0 255.255.255.0 s0/0/1 //Internet 上不会有企业内部网络的路由 Router(config)#host R4 R4(config)#int f0/0 R4(config-if)#ip addr 172.16.4.4 255.255.255.0 R4(config-if)#no shut R4(config-if)#int s0/0/0 R4(config-if)#ip addr 61.0.0.4 255.255.255.0 R4(config-if)#clock rate 128000 R4(config-if)#no shut R4(config-if)#exit R4(config)#ip route 0.0.0.0 0.0.0.0 s0/0/0 ( 二 ) 配置 GRE Tunnel R1(config)#int tunnel 0 // 创建 Tunnel 接口, 编号为 0 R1(config-if)#tunnel source s0/0/0 //Tunnel 的源接口, 路由器将以此接口的地址作为源地址重新封装 VPN 数据包 R1(config-if)#tunnel destination 61.0.0.4 //Tunnel 的目的地址 R1(config-if)#ip addr 172.16.14.1 255.255.255.0 // 创建隧道接口上的 IP 地址 R4(config)#int tunnel 0 R4(config-if)#tunnel source s0/0/0 R4(config-if)#tunnel destination 202.96.134.1 R4(config-if)#ip addr 172.16.14.4 255.255.255.0 R1#show interfaces tunnel 0 Tunnel0 is up, line protocol is up (connected) Hardware is Tunnel Internet address is 172.16.14.1/24 MTU 17916 bytes, BW 100 Kbit/sec, DLY 50000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation TUNNEL, loopback not set 190

第二部分 交换机实验 Keepalive not set Tunnel source 202.96.134.1 (Serial0/0/0), destination 61.0.0.4 Tunnel protocol/transport GRE/IP R4#show interfaces tunnel 0 Tunnel0 is up, line protocol is up (connected) Hardware is Tunnel Internet address is 172.16.14.4/24 MTU 17916 bytes, BW 100 Kbit/sec, DLY 50000 usec, reliability 255/255, txload 1/255, rxload 1/255 Encapsulation TUNNEL, loopback not set Keepalive not set Tunnel source 61.0.0.4 (Serial0/0/0), destination 202.96.134.1 Tunnel protocol/transport GRE/IP R1#ping 172.16.14.4 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.14.4, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 93/96/109 ms ( 三 ) 配置路由协议 R1(config)#router rip R1(config-router)#version 2 R1(config-router)#network 172.16.0.0 R4(config)#router rip R4(config-router)#version 2 R4(config-router)#network 172.16.0.0 四 实验调试 ( 一 ) 测试两地网络的通信 R1#show ip route 172.16.0.0/24 is subnetted, 3 subnets C R C 172.16.1.0 is directly connected, FastEthernet0/0 172.16.4.0 [120/1] via 172.16.14.4, 00:00:09, Tunnel0 172.16.14.0 is directly connected, Tunnel0 C 202.96.134.0/24 is directly connected, Serial0/0/0 S* 0.0.0.0/0 is directly connected, Serial0/0/0 扩展 ping 命令 R1#ping Protocol [ip]: Target IP address: 172.16.4.4 Repeat count [5]: 191

Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y 第二部分 Source address or interface: 172.16.1.1 Type of service [0]: Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: 交换机实验 Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 172.16.4.4, timeout is 2 seconds: Packet sent with a source address of 172.16.1.1!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 78/88/94 ms ( 二 )NAT 配置 企业内部网络和 Internet 仍无法通信, 需配置 NAT R1(config)#int s0/0/0 R1(config-if)#ip nat outside R1(config-if)#int f0/0 R1(config-if)#ip nat inside R1(config-if)#exit R1(config)#access-list 10 permit 172.16.1.0 0.0.0.255 R1(config)#ip nat inside source list 10 int s0/0/0 overload R4(config)#int s0/0/0 R4(config-if)#ip nat outside R4(config-if)#int f0/0 R4(config-if)#ip nat inside R4(config-if)#exit R4(config)#access-list 10 permit 172.16.4.0 0.0.0.255 R4(config)#ip nat inside source list 10 int s0/0/0 overload 从 PC1(172.16.4.100) 测试连通性 PC>ping 172.16.1.100 Pinging 172.16.1.100 with 32 bytes of data: Reply from 172.16.1.100: bytes=32 time=140ms TTL=126 Reply from 172.16.1.100: bytes=32 time=156ms TTL=126 Reply from 172.16.1.100: bytes=32 time=141ms TTL=126 Reply from 172.16.1.100: bytes=32 time=156ms TTL=126 Ping statistics for 172.16.1.100: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 140ms, Maximum = 156ms, Average = 148ms 192

第二部分 交换机实验 实验 2-27.DHCP 配置 一 实验目的 ( 一 )DHCP 的工作原理和工作过程 ( 二 )DHCP 服务器的配置和测试 ( 三 )DHCP 中继配置 ( 四 )DHCP 客户端配置二 实验拓扑 三 实验步骤 路由器 R1 是 DHCP 服务器, 负责向 PC11 所在网段和 PC12 所在网段的主机动态分配 IP 地 址, 所以 R1 上需要定义两个地址池 ( 一 ) 配置路由器 R1 R1#show run Building configuration... Current configuration : 934 bytes! version 12.4 no service timestamps log datetime msec no service timestamps debug datetime msec no service password-encryption! 193

hostname R1! 第二部分 交换机实验 interface FastEthernet0/0 ip address 172.16.1.1 255.255.255.0 duplex auto speed auto interface Serial0/0/0 ip address 172.16.12.1 255.255.255.0! router rip version 2 network 172.16.0.0 no auto-summary! ip dhcp excluded-address 172.16.1.1 172.16.1.2 ip dhcp excluded-address 172.16.2.2! ip dhcp pool pool_1 network 172.16.1.0 255.255.255.0 default-router 172.16.1.1 dns-server 172.16.1.2 ip dhcp pool pool_2 network 172.16.2.0 255.255.255.0! default-router 172.16.2.2 dns-server 172.16.1.3 ( 二 ) 配置路由器 R2 R2#show run Building configuration... hostname R2! interface FastEthernet0/0 ip address 172.16.2.2 255.255.255.0 ip helper-address 172.16.12.1 duplex auto speed auto! interface Serial0/0/0 ip address 172.16.12.2 255.255.255.0 clock rate 128000! router rip 194

version 2 network 172.16.0.0 no auto-summary 第二部分 交换机实验 ( 三 ) 设置 windows 客户端 四 实验调试 R1#show ip dhcp binding IP address Client-ID/ Lease expiration Type Hardware address 172.16.1.3 0009.7C85.4465 -- Automatic 172.16.1.4 0002.172C.038B -- Automatic 172.16.1.5 0060.2F89.3C02 -- Automatic 172.16.2.1 0002.175E.6114 -- Automatic 172.16.2.3 00D0.BC09.9DA3 -- Automatic 172.16.2.4 000A.415A.D800 -- Automatic R2#show ip interface FastEthernet0/0 is up, line protocol is up (connected) Internet address is 172.16.2.2/24 Broadcast address is 255.255.255.255 Address determined by setup command MTU is 1500 Helper address is 172.16.12.1 195

第二部分 交换机实验 实验 2-28. 静态 NAT 配置 一 实验目的 ( 一 ) 静态 NAT 的特征 ( 二 ) 静态 NAT 基本配置和调试二 实验拓扑 三 实验步骤 路由器 R1 为内网提供 NAT 服务的路由器, 外网运行 EIGRP 协议 ( 一 ) 配置路由器 R1 Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#ip addr 172.16.1.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#int s0/0/0 R1(config-if)#ip addr 202.2.12.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#router eigrp 1 R1(config-router)#network 202.2.12.0 R1(config-router)#network 172.16.1.0 R1(config-router)#no au R1(config-router)#exit R1(config)#ip nat inside source static 172.16.1.11 202.2.12.3 R1(config)#ip nat inside source static 172.16.1.12 202.2.12.4 R1(config)#ip nat inside source static 172.16.1.100 202.2.12.5 R1(config)#int f0/0 R1(config-if)#ip nat inside 196

R1(config-if)#int f0/0 R1(config-if)#ip nat outside ( 二 ) 配置路由器 R2 Router(config)#host R2 第二部分 交换机实验 R2(config)#int s0/0/0 R2(config-if)#ip addr 202.2.12.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#int s0/0/1 R2(config-if)#ip addr 218.18.23.2 255.255.255.0 R2(config-if)#clock rate 128000 R2(config-if)#no shut R2(config-if)#exit R2(config)#router eigrp 1 R2(config-router)#network 202.2.12.0 R2(config-router)#network 218.18.23.0 R2(config-router)#no au ( 三 ) 配置路由器 R3 Router(config)#host R3 R3(config)#int f0/0 R3(config-if)#ip addr 219.19.3.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#int s0/0/1 R3(config-if)#ip addr 218.18.23.3 255.255.255.0 R3(config-if)#no shut R3(config-if)#exit R3(config)#router eigrp 1 R3(config-router)#netwo 218.18.23.0 R3(config-router)#netwo 219.19.3.0 R3(config-router)#no au 四 实验调试 ( 一 )debug ip packet R1#debug ip packet ( 二 )show ip nat translations R1#show ip nat translations Pro Inside global Inside local Outside local Outside global --- 202.2.12.5 172.16.1.100 --- --- --- 202.2.12.3 172.16.1.11 --- --- --- 202.2.12.4 172.16.1.12 --- --- 197

第二部分 交换机实验 实验 2-29. 动态 NAT 配置 一 实验目的 ( 一 ) 动态 NAT 的特征 ( 二 ) 动态 NAT 的配置和调试 二 实验拓扑 上图实验拓扑 三 实验步骤 删除 PC1 和 PC2 主机的静态 NAT,Server 主机的静态 NAT 保留 R1(config)#no ip nat inside source static 172.16.1.11 202.2.12.3 R1(config)#no ip nat inside source static 172.16.1.12 202.2.12.4 R1(config)#ip nat pool d_nat 202.2.12.10 202.2.12.100 netmask 255.255.255.0 // 配置动态地址池 R1(config)#access-list 1 permit 172.16.1.0 0.0.0.255 // 配置允许动态 NAT 的内部地址 R1(config)#ip nat inside source list 1 pool d_nat // 配置动态映射 将 NAT 地址与 ACL 绑定 R1(config)#int f0/0 R1(config-if)#ip nat inside R1(config-if)#int s0/0/0 R1(config-if)#ip nat outside 四 实验调试 清除 NAT 表, 在 PC1 和 PC2 上分别 ping 服务器 219.19.3.100, 并且访问其 Web 服务 (1)show ip nat translations R1#clear ip nat translation * // 清除动态 NAT 表 R1#show ip nat translations Pro Inside global Inside local Outside local Outside global icmp 202.2.12.11:36 172.16.1.11:36 219.19.3.100:36 219.19.3.100:36 icmp 202.2.12.11:37 172.16.1.11:37 219.19.3.100:37 219.19.3.100:37 icmp 202.2.12.11:38 172.16.1.11:38 219.19.3.100:38 219.19.3.100:38 icmp 202.2.12.11:39 172.16.1.11:39 219.19.3.100:39 219.19.3.100:39 icmp 202.2.12.12:5 172.16.1.12:5 219.19.3.100:5 219.19.3.100:5 icmp 202.2.12.12:6 172.16.1.12:6 219.19.3.100:6 219.19.3.100:6 icmp 202.2.12.12:7 172.16.1.12:7 219.19.3.100:7 219.19.3.100:7 icmp 202.2.12.12:8 172.16.1.12:8 219.19.3.100:8 219.19.3.100:8 198

第二部分 交换机实验 --- 202.2.12.5 172.16.1.100 --- --- tcp 202.2.12.11:1025 172.16.1.11:1025 219.19.3.100:80 219.19.3.100:80 tcp 202.2.12.12:1025 172.16.1.12:1025 219.19.3.100:80 219.19.3.100:80 (2)debug ip nat R1#debug ip nat IP NAT debugging is on R1# NAT: s=172.16.1.12->202.2.12.13, d=219.19.3.100 [23] NAT*: s=219.19.3.100, d=202.2.12.13->172.16.1.12 [59] NAT: s=172.16.1.12->202.2.12.13, d=219.19.3.100 [24] NAT*: s=219.19.3.100, d=202.2.12.13->172.16.1.12 [60] NAT: s=172.16.1.12->202.2.12.13, d=219.19.3.100 [25] NAT*: s=219.19.3.100, d=202.2.12.13->172.16.1.12 [61] NAT: s=172.16.1.12->202.2.12.13, d=219.19.3.100 [26] NAT*: s=219.19.3.100, d=202.2.12.13->172.16.1.12 [62] (3)show ip nat statistics R1#show ip nat statistics Total translations: 10 (1 static, 9 dynamic, 9 extended) // 活动转换条目的总数, 其中 1 条静态,9 条动态,9 条扩展 Outside Interfaces: Serial0/0/0 //NAT 外部接口 Inside Interfaces: FastEthernet0/0 //NAT 内部接口 Hits: 79 Misses: 64 // 共计转换 79 个数据包, 有 64 个转换失败 Expired translations: 32 // 超时的转换条目是 32 条 Dynamic mappings: // 动态映射情况 -- Inside Source access-list 1 pool d_nat refcount 9 pool d_nat: netmask 255.255.255.0 start 202.2.12.10 end 202.2.12.100 type generic, total addresses 91, allocated 2 (2%), misses 0 199

第二部分 交换机实验 实验 2-30.NAT 过载配置 一 实验目的 ( 一 )NAT 过载的特征 ( 二 )overload 的使用 ( 三 )NAT 过载配置和测试 二 实验拓扑 上图实验拓扑 三 实验步骤 (1) 配置路由器 R1 保留实验 3 的配置, 在路由器上进心修改 R1(config)#ip nat inside source list 1 pool d_nat overload 四 实验调试 清除 NAT 表, 在 PC1 PC2 上分别 ping 服务器 219.19.3.100, 并且访问 Web 服务 R1#clear ip nat translation * R1#show ip nat translations Pro Inside global Inside local Outside local Outside global icmp 202.2.12.14:48 172.16.1.11:48 219.19.3.100:48 219.19.3.100:48 icmp 202.2.12.14:49 172.16.1.11:49 219.19.3.100:49 219.19.3.100:49 icmp 202.2.12.14:50 172.16.1.11:50 219.19.3.100:50 219.19.3.100:50 icmp 202.2.12.14:51 172.16.1.11:51 219.19.3.100:51 219.19.3.100:51 icmp 202.2.12.14:21 172.16.1.12:21 219.19.3.100:21 219.19.3.100:21 icmp 202.2.12.14:22 172.16.1.12:22 219.19.3.100:22 219.19.3.100:22 icmp 202.2.12.14:23 172.16.1.12:23 219.19.3.100:23 219.19.3.100:23 icmp 202.2.12.14:24 172.16.1.12:24 219.19.3.100:24 219.19.3.100:24 --- 202.2.12.5 172.16.1.100 --- --- tcp 202.2.12.14:1027 172.16.1.11:1027 219.19.3.100:80 219.19.3.100:80 tcp 202.2.12.14:1028 172.16.1.12:1028 219.19.3.100:80 219.19.3.100:80 R1#show ip nat statistics Total translations: 3 (1 static, 2 dynamic, 2 extended) Outside Interfaces: Serial0/0/0 Inside Interfaces: FastEthernet0/0 Hits: 101 Misses: 74 200

Expired translations: 48 Dynamic mappings: -- Inside Source 第二部分 access-list 1 pool d_nat refcount 2 pool d_nat: netmask 255.255.255.0 start 202.2.12.10 end 202.2.12.100 交换机实验 type generic, total addresses 91, allocated 1 (1%), misses 0 201

第三部分 无线网实验 第三部分 无线网实验 实验 3-1.WRT300N 无线路由器配置 一 实验目的 ( 一 )WRT300N 的基本配置 ( 二 )WRT300N 的无线配置二 实验拓扑 三 实验步骤 使用 Linksys WRT300N 进行实验 ( 一 ) 基本配置打开计算机浏览器输入 : http://192.168.0.1, 弹出密码输入提示页面 用户名 和 密码 默认的 admin, 单击 确定 按钮, 进入图示界面, 可以进行基本配置 203

第三部分 无线网实验 互联网连接类型 部分用于设置如何将路由器连接到 Internet Internet 连接类型主要有 : 1 DHCP 路由器 Internet 接口的 IP 地址自动获得 2 静态 IP 如果要使用永久性 IP 地址与 Internet 进行连接, 则选择此项, 并且还要填入 ISP 提供的 IP 地址, 网关和 DNS 等 3 PPPoE 如果使用 ADSL 上网, 则选择此项, 并填入 ISP 提供的用户名和密码 备选设置 部分用于设置路由器的名称等 : 1 主机名和域名 2 MTU 路由器 IP 地址 设置路由器 IP 地址以及子网掩码 "DHCP" 用于对路由器的动态主机配置协议服务器功能进行配置 1 DHCP 服务器 出厂时默认启用 2 开始 IP 地址 用于在发放 IP 地址时 DHCP 服务器的起始值 默认为 192.168.0.100 3 最大用户数 分配 IP 地址的最大电脑数量, 不能超过 253, 默认为 50 4 客户租用时间 允许配有动态 IP 地址的网络用户连接到路由器的时间 5 6 静态 DNS(1~3) 域名系统用于 Internet 将域名翻译成为 IP 地址 WINS 204

( 二 ) 基本无线设置 第三部分 无线网实验 1 无线网络模式 : 可以选择在你的网络中运行的无线标准 2 无线网络名称 (SSID): 无线网络中所有设备共享的网络名称 区分大小写, 不得超过 32 个字符 3 4 无线信道 : 从提供的列表中选择合适的信道 无线 SSID 广播 ( 三 ) 无线安全 无线安全选项 :WPA 个人 WPA 企业 WPA2 个人 WPA2 企业 WEP 1 WAP 个人 : 提供 TKIP 和 AES 两种加密方法, 采用动态加密密钥 205

2 WPA 企业 第三部分 无线网实验 3 WEP ( 四 ) 无线 MAC 过滤 ( 五 ) 安全 防火墙 206

第三部分 无线网实验 ( 六 ) 访问限制 ( 七 ) 端口重定向 207

第三部分 无线网实验 ( 八 ) 管理控制 208

第三部分 无线网实验 实验 3-2.IPv6 静态路由配置 一 实验目的 ( 一 ) 启用 IPv6 路由 ( 二 ) 配置 IPv6 地址 ( 三 )IPv6 静态路由配置和调试 ( 四 )IPv6 默认静态路由配置和调试二 实验拓扑 三 实验步骤 ( 一 ) 配置路由器 R1 Router(config)#host R1 R1(config)#ipv6 unicast-routing R1(config)#int lo0 R1(config-if)#ipv6 addr 2010:1111::1/64 R1(config-if)#int lo1 R1(config-if)#ipv6 addr 2011:1111::1/64 R1(config-if)#int s0/0/0 R1(config-if)#ipv6 addr 2009:1212::1/64 R1(config-if)#no shut R1(config-if)#exit R1(config)#ipv6 route 2009:2323::/64 s0/0/0 R1(config)#ipv6 route 2012:3333::/64 s0/0/0 ( 二 ) 配置路由器 R2 Router(config)#host R2 R2(config)#ipv6 unicast-routing R2(config)#int s0/0/0 R2(config-if)#ipv6 addr 2009:1212::2/64 R2(config-if)#clock rate 128000 R2(config-if)#no shut 209

R2(config-if)#int s0/0/1 第三部分 R2(config-if)#ipv6 addr 2009:2323::2/64 R2(config-if)#clock rate 128000 R2(config-if)#no shut 无线网实验 R2(config-if)#exit R2(config)#ipv6 route 2010:1111::/64 s0/0/0 R2(config)#ipv6 route 2011:1111::/64 s0/0/0 R2(config)#ipv6 route 2012:3333::/64 s0/0/1 ( 三 ) 配置路由器 R3 Router(config)#host R3 R3(config)#ipv6 unicast-routing R3(config)#int lo0 R3(config-if)#ipv6 addr 2012:3333::3/64 R3(config-if)#int s0/0/1 R3(config-if)#ipv6 addr 2009:2323::3/64 R3(config-if)#no shut R3(config-if)#exit R3(config)#ipv6 route ::/0 s0/0/1 四 实验调试 ( 一 )show ipv6 interface R1#show ipv6 interface s0/0/0 Serial0/0/0 is up, line protocol is up // 配置 IPv6 默认静态路由 IPv6 is enabled, link-local address is FE80::201:63FF:FEA6:1201 // 本接口启用 IPv6, 本地链路地址自动配置 No Virtual link-local address(es): Global unicast address(es): 2009:1212::1, subnet is 2009:1212::/64 Joined group address(es): FF02::1 FF02::2 FF02::1:FF00:1 FF02::1:FFA6:1201 MTU is 1500 bytes ICMP error messages limited to one every 100 milliseconds ICMP redirects are enabled ICMP unreachables are sent ND DAD is enabled, number of DAD attempts: 1 ND reachable time is 30000 milliseconds Hosts use stateless autoconfig for addresses. ( 二 )show ipv6 route R1#show ipv6 route IPv6 Routing Table - 9 entries C 2009:1212::/64 [0/0] via ::, Serial0/0/0 L 2009:1212::1/128 [0/0] 210

via ::, Serial0/0/0 S 2009:2323::/64 [1/0] via ::, Serial0/0/0 C 2010:1111::/64 [0/0] via ::, Loopback0 L 2010:1111::1/128 [0/0] via ::, Loopback0 C 2011:1111::/64 [0/0] via ::, Loopback1 L 2011:1111::1/128 [0/0] via ::, Loopback1 S 2012:3333::/64 [1/0] via ::, Serial0/0/0 L FF00::/8 [0/0] via ::, Null0 第三部分 无线网实验 R3#show ipv6 route IPv6 Routing Table - 6 entries S ::/0 [1/0] via ::, Serial0/0/1 C 2009:2323::/64 [0/0] via ::, Serial0/0/1 L 2009:2323::3/128 [0/0] via ::, Serial0/0/1 C 2012:3333::/64 [0/0] via ::, Loopback0 L 2012:3333::3/128 [0/0] via ::, Loopback0 L FF00::/8 [0/0] via ::, Null0 (3) R1#ping 2012:3333::3 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 2012:3333::3, timeout is 2 seconds:!!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 62/62/63 ms 211

第三部分 无线网实验 实验 3-3. IPv6 的 RIPng 配置 一 实验目的 二 实验拓扑 三 实验步骤 四 实验调试 212

第三部分 无线网实验 213

第四部分 扩张性实验 第四部分 扩展性实验 实验 4-1. Easy VPN 实验指南 实验要求 : 一台路由器做总部 VPN 网关, 一台路由模拟 Internet 网 ( 就是没私有 IP 路由的路由器 ), 一台路由路模拟能上 Internet 网的路由器 ( 也就是做了 NAT 上网 ) 外出移动办公的笔记本通过能上 Internet 网的路由器 Easy VPN 连接到总部, 并访问总部的 web 服务器 实验拓扑 : IP 地址规划如下 : 总部服务器 :192.168.1.1/24 总部路由器 :fa 0/0:192.168.1.254/24 fa0/1:100.1.1.2/24 215

第四部分 扩张性实验 Internet 网路由器 :fa 0/1:100.1.1.2/24 fa0/0:200.1.1.1/24 远端路由器 :fa0/0:200.1.1.2/24 fa0/1:172.16.1.254/24 办公笔记本 :172.16.1.1 /24 实验配置 : 总部路由器 : Router(config)#host zongbu zongbu(config)#int f0/0 zongbu(config-if)#ip addr 192.168.1.254 255.255.255.0 zongbu(config-if)#no shutdown zongbu(config-if)#int f0/1 zongbu(config-if)#ip addr 100.1.1.2 255.255.255.0 zongbu(config-if)#no shut zongbu(config-if)#ip route 0.0.0.0 0.0.0.0 100.1.1.1 Internet 路由器 : Router(config)#host Internet Internet(config)#int f0/0 Internet(config-if)#ip addr 200.1.1.1 255.255.255.0 Internet(config-if)#no shut Internet(config-if)#int f0/1 Internet(config-if)#ip addr 100.1.1.1 255.255.255.0 Internet(config-if)#no shut 远端路由器的配置 : Router(config)#host yuanduan yuanduan(config)#int f0/0 yuanduan(config-if)#ip addr 200.1.1.2 255.255.255.0 yuanduan(config-if)#no shutdown yuanduan(config-if)#int f0/1 yuanduan(config-if)#ip addr 172.16.1.254 255.255.255.0 yuanduan(config-if)#no shut yuanduan(config-if)#exit yuanduan(config)#access-list 1 permit 172.16.1.0 0.0.0.255 yuanduan(config)#ip nat inside source list 1 interface f0/0 overload yuanduan(config)#int f0/0 yuanduan(config-if)#ip nat outside 216

第四部分扩张性实验 yuanduan(config-if)#int f0/1 yuanduan(config-if)#ip nat inside yuanduan(config-if)#exit yuanduan(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.1 此时, 远端的笔记本能上网, 但不能访问总部内的 Web 服务器 现在在 zongbu 做 Easy VPN 的配置 其配置如下 : zongbu(config)#aaa new-model ( 开启 AAA 认证 ) zongbu(config)#aaa authentication login eza local ( 命名 eza, 对 eza 认证 ) zongbu(config)#aaa authorization network ezo local ( 命名 ezo, 对 ezo 的事件授权 ) zongbu(config)#username tang password 123( 创建用户名密码 ) zongbu(config)#crypto isakmp policy 10(IPSec 阶段一的安全参数配置 ) zongbu(config-isakmp)#hash md5 zongbu(config-isakmp)#authentication pre-share zongbu(config-isakmp)#group 2 zongbu(config-isakmp)#exit zongbu(config)#ip local pool ez 192.168.2.1 192.168.2.10 (Easy VPN 接入后所分配的地址 ) zongbu(config)#crypto isakmp client configuration group myez (Easy VPN 的组和密码配置 ) zongbu(config-isakmp-group)#key 123 zongbu(config-isakmp-group)#pool ez zongbu(config-isakmp-group)#exit zongbu(config)#crypto ipsec transform-set tim esp-3des esp-md5-hmac (IPSec 阶段二的配置 ) zongbu(config)#crypto dynamic-map ezmap 10( 动态加密图 ) zongbu(config-crypto-map)#set transform-set tim zongbu(config-crypto-map)#reverse-route ( 反向路由注入 ) zongbu(config-crypto-map)#exit ( 以下是对 Easy VPN 的认证, 授权配置,list 是调用上面的 AAA 配置名 ) zongbu(config)#crypto map tim client authentication list eza zongbu(config)#crypto map tim isakmp authorization list ezo zongbu(config)#crypto map tim client configuration address respond zongbu(config)#crypto map tim 10 ipsec-isakmp dynamic ezmap ( 动态加密图必须有静态绑定 ) zongbu(config)#int f0/1 zongbu(config-if)#crypto map tim( 绑定到接口 ) Easy VPN 的测试 : 首先, 双击笔记本, 打开图, 选择 Desktop( 桌面 ), 再下面选择 command Pormpt( 命令提示符 ),ping 一下总部的公网地址 100.1.1.2, 通了后再 ping 内部服务器 192.168.1.1, 此时是 ping 不通的, 因为我们来没 Easy VPN 接入 217

第四部分 扩张性实验 其次, 我们依然选择 Desktop 下的 VPN, 依次输入如下信息 : GroupName:myez Group key:123 Host IP(server IP):100.1.1.2 Username:tang Password:123 点击 connect, 就会提示连接上去, 此时会显示下发的 IP 地址 ( 若没马上连上去, 在配置没错的前提下, Ipsec VPN 协商时, 前面几个包是不通的, 解决方法, 在 ping 一下 100.1.1.2, 再连接 Easy VPN) 最后, 我们访问 web 服务器, 选择 Desktop 下的 Web Browser, 输入 IP:192.168.1.1 即可访问到 web 服务器. 218

第四部分 扩张性实验 实验 4-2. 最真实的模拟 VPN 综合实验 实验拓扑 : 实验的 IP 规划 : PC0 PC1 :DHCP 获取笔记本 :laptop0 和 wuxian:dhcp 获取内部服务器 :Web 192.168.1.253/24 TFTP 192.168.1.252/24 ISP 服务器 :ISP DNS 202.103.96.112/24 ISP Web 202.103.96.120/24 总部 fa0/0:192.168.1.254/24 fa0/1:100.1.1.2/24 Internet 网 :fa0/1 :100.1.1.1/24 fa 0/0:200.1.1.1/24 E1/0:210.1.1.1/24( 移动笔记本 wuxian 所获得公网地址段 ) E1/1:202.103.96.1/24(ISP DNS 和 ISP Web 服务器的网关 ) 分部 :f0/0:200.1.1.2/24 fa 0/1:192.168.2.254/24 服务器 DNS 和 Web 的配置 : 双击服务器的图标, 选择桌面, 在选择 IP 配置设置 IP 地址 : 219

第四部分 扩张性实验 220

第四部分 扩张性实验 DNS 的配置 :(ISP 的 Web 服务器和总部的 Web 服务器做的 DNS 映射 ) 选择 ISP DNS 的 config, 在选择 DNS,name 是域名,address 是 IP 地址, 做好就 add 添加 实验配置 : Internet 网配置 : Router(config)#host Internet Internet(config)#line console 0 Internet(config-line)#logging synchronous Internet(config-line)#exec-timeout 0 0 Internet(config-line)#exit Internet(config)#no ip domain-lookup Internet(config)#int f0/1 Internet(config-if)#ip addr 100.1.1.1 255.255.255.0 Internet(config-if)#no shut Internet(config-if)#int f0/0 Internet(config-if)#ip addr 200.1.1.1 255.255.255.0 Internet(config-if)#no shut Internet(config-if)#int e1/1 Internet(config-if)#ip addr 202.103.96.1 255.255.255.0 Internet(config-if)#no shut Internet(config-if)#int e1/0 Internet(config-if)#ip addr 210.1.1.1 255.255.255.0 Internet(config-if)#no shut Internet(config-if)#exit 221

第四部分 扩张性实验 Internet(config)#ip dhcp excluded-address 210.1.1.1 Internet(config)#ip dhcp pool wifi Internet(dhcp-config)#network 210.1.1.0 255.255.255.0 Internet(dhcp-config)#default-router 210.1.1.1 Internet(dhcp-config)#dns-server 202.103.96.112 zongbu 配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host zongbu zongbu(config)#line console 0 zongbu(config-line)#logg sy zongbu(config-line)#exec-timeout 0 0 zongbu(config)#no ip domain-lookup zongbu(config)#int f0/1 zongbu(config-if)#ip addr 100.1.1.2 255.255.255.0 zongbu(config-if)#no shut zongbu(config-if)#int f0/0 End with CNTL/Z. zongbu(config-if)#ip addr 192.168.1.254 255.255.255.0 zongbu(config-if)#no shut zongbu(config-if)#exit zongbu(config)#ip route 0.0.0.0 0.0.0.0 100.1.1.1 zongbu(config)#ip dhcp excluded-address 192.168.1.254 zongbu(config)#ip dhcp pool zongbu zongbu(dhcp-config)#network 192.168.1.0 255.255.255.0 zongbu(dhcp-config)#default-router 192.168.1.254 zongbu(dhcp-config)#dns-server 202.103.96.112 zongbu(dhcp-config)#exit zongbu(config)#access-list 100 deny ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 zongbu(config)#access-list 100 permit ip 192.168.1.0 0.0.0.255 any zongbu(config)#int f0/1 zongbu(config-if)#ip nat outside zongbu(config-if)#int f0/0 zongbu(config-if)#ip nat inside zongbu(config-if)#exit zongbu(config)#ip nat inside source list 100 int f0/1 overload zongbu(config)#ip nat inside source static tcp 192.168.1.253 80 100.1.1.2 80 fenbu 配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host fenbu fenbu(config)#line console 0 End with CNTL/Z. 222

fenbu(config-line)#logg sy fenbu(config-line)#exec-time 0 0 fenbu(config-line)#exit fenbu(config)#no ip domain-l 第四部分 fenbu(config)#int f0/0 fenbu(config-if)#ip addr 200.1.1.2 255.255.255.0 fenbu(config-if)#no shut fenbu(config-if)#ip nat outside fenbu(config-if)#int f0/1 扩张性实验 fenbu(config-if)#ip addr 192.168.2.254 255.255.255.0 fenbu(config-if)#no shut fenbu(config-if)#ip nat inside fenbu(config-if)#exit fenbu(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.1 fenbu(config)#ip dhcp excluded-address 192.168.2.254 fenbu(config)#ip dhcp pool fenbu fenbu(dhcp-config)#network 192.168.2.0 255.255.255.0 fenbu(dhcp-config)#default-router 192.168.2.254 fenbu(dhcp-config)#dns-server 202.103.96.112 fenbu(dhcp-config)#exit fenbu(config)#access-list 100 deny ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255 fenbu(config)#access-list 100 permit ip 192.168.2.0 0.0.0.255 any fenbu(config)#ip nat inside source list 100 int f0/0 overload 但由于 VPN 没有做, 外网和分部的 PC 是 Ping 不通内部的 PC 和服务器的 现在进行 VPN 配置 : 总部配置 : zongbu(config)#crypto isakmp policy 10 zongbu(config-isakmp)#encryption 3des zongbu(config-isakmp)#hash md5 zongbu(config-isakmp)#authentication pre-share zongbu(config-isakmp)#exit zongbu(config)#crypto isakmp key tom address 200.1.1.2 zongbu(config)#crypto ipsec transform-set tom esp-3des esp-md5-hmac zongbu(config)#access-list 101 permit ip 192.168.1.0 0.0.0.255 192.168.2.0 0.0.0.255 zongbu(config)#crypto map tom 11 ipsec-isakmp % NOTE: This new crypto map will remain disabled until a peer and a valid access list have been configured. zongbu(config-crypto-map)#set peer 200.1.1.2 zongbu(config-crypto-map)#set transform-set tom zongbu(config-crypto-map)#match address 101 zongbu(config-crypto-map)#exit zongbu(config)#int f0/1 zongbu(config-if)#crypto map tom 223

*Jan 第四部分 扩张性实验 3 07:16:26.785: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON zongbu(config-if)#exit zongbu(config)#aaa new-model zongbu(config)#aaa authentication login eza local zongbu(config)#aaa authorization network ezo local zongbu(config)#username tang password 123 zongbu(config)#ip local pool ez 192.168.3.1 192.168.3.100 zongbu(config)#crypto isakmp client configuration group myez zongbu(config-isakmp-group)#key 123 zongbu(config-isakmp-group)#pool ez zongbu(config-isakmp-group)#exit zongbu(config)#crypto dynamic-map ezmap 10 zongbu(config-crypto-map)#set transform-set tom zongbu(config-crypto-map)#reverse-route zongbu(config-crypto-map)#exit zongbu(config)#crypto map tom client authentication list eza zongbu(config)#crypto map tom isakmp authorization list ezo zongbu(config)#crypto map tom client configuration address respond zongbu(config)#crypto map tom 10 ipsec-isakmp dynamic ezmap (Easy VPN 是 IPSEC VPN 的两个阶段之间的 2.5 阶段, 固阶段一喝阶段二都可以条用一样的策略 ) 分部配置 : fenbu(config)#crypto isakmp policy 10 fenbu(config-isakmp)#encryption 3des fenbu(config-isakmp)#hash md5 fenbu(config-isakmp)#authentication pre-share fenbu(config-isakmp)#exit fenbu(config)#crypto isakmp key tom address 100.1.1.2 fenbu(config)#crypto ipsec transform-set tom esp-3des esp-md5-hmac fenbu(config)#crypto map tom 10 ipsec-isakmp % NOTE: This new crypto map will remain disabled until a peer and a valid access list have been configured. fenbu(config-crypto-map)#set peer 100.1.1.2 fenbu(config-crypto-map)#set transform-set tom fenbu(config-crypto-map)#match address 101 fenbu(config-crypto-map)#exit fenbu(config)#access-list 101 permit ip 192.168.2.0 0.0.0.255 192.168.1.0 0.0.0.255 fenbu(config)#int f0/0 fenbu(config-if)#crypto map tom 测试 : Ipsec VPN 就是分部的 ping 总部的 PC, 来检测连通性, 当 VPN 都连通后, 就能 ping 通内部的 TFTP 服务器了! 224

第四部分 扩张性实验 实验 4-3. 交换机和路由器的维护实验 网络设备维护基本知识 : 备份和还原网络设备的操作系统, 备份和还原设备的配置文件, 网络设备密码遗忘了如何恢复, 对 telnet SSH Web 等管理设置密码及身份认证, 根据新增的需求配置网络设备. 实验拓扑 : IP 的规划 : PC0:192.168.2.1/24 PC1: 192.168.3.1/24 TFTP:192.168.1.2/24 交换机管理 IP:192.168.1.1/24 路由器的配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#line console 0 Router(config-line)#logg sy Router(config-line)#exec-timeout 0 0 Router(config-line)#exit Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#ip addr 192.168.1.254 255.255.255.0 R1(config-if)#no shut End with CNTL/Z. 225

第四部分 扩张性实验 R1(config-if)#int f0/0.1 R1(config-subif)#encapsulation dot1q 2 R1(config-subif)#ip addr 192.168.2.254 255.255.255.0 R1(config-subif)#no shut R1(config-subif)#int f0/0.3 R1(config-subif)#encapsulation dot1q 3 R1(config-subif)#ip addr 192.168.3.254 255.255.255.0 R1(config-subif)#no shut 交换机配置 : Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#line console 0 Switch(config-line)#logg sy Switch(config-line)#exec-timeout 0 0 Switch(config-line)#exit Switch(config)#vlan 2 Switch(config-vlan)#name vlan2 Switch(config-vlan)#vlan 3 Switch(config-vlan)#name vlan3 Switch(config-vlan)#exit Switch(config)#int range f0/1-5 Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport access vlan 2 Switch(config-if-range)#spanning-tree portfast End with CNTL/Z. %Warning: portfast should only be enabled on ports connected to a single host. Connecting hubs, concentrators, switches, bridges, etc... to this interface when portfast is enabled, can cause temporary bridging loops. Use with CAUTION %Portfast will be configured in 5 interfaces due to the range command but will only have effect when the interfaces are in a non-trunking mode. Switch(config-if-range)#exit Switch(config)#int range f0/6-10 Switch(config-if-range)#switchport mode access Switch(config-if-range)#switchport access vlan 3 Switch(config-if-range)#spanning-tree portfast Switch(config-if-range)#exit Switch(config)#int f0/24 Switch(config-if)#switchport mode trunk Switch(config-if)#exit Switch(config)#int vlan 1 Switch(config-if)#ip addr 192.168.1.1 255.255.255.0 Switch(config-if)#no shut 226

第四部分扩张性实验 Switch(config-if)#exit Switch(config)#ip default-gateway 192.168.1.254 ( 不同网段要想能 ping 和访问必须为交换机配置网关 ) 登入 cisco 网络设备, 常用的是通过 console 口直接连接, 远程 telnet, 安全的远程 SSH, 以及 web 访问 一 密码访问登入 Console: R1(config)#line console 0 R1(config-line)#password xiaot R1(config-line)#login 当你配置上这些命令的时候, 你 console 口登入就会如下提示输入密码 Password: ( 密码隐藏 ) R1> Telnet: R1(config)#line vty 0 4 ( 这表示从 0-4, 有五个用户可以同时登入 ) R1(config-line)#password xiaot R1(config-line)#login R1(config-line)#exit R1(config)#enable password 123( 此密码必须配置, 不然你就只能停留在用户模式 ) 测试在 PC 的 CMD 中 telnet, 效果如下图 : 227

第四部分 扩张性实验 二 基于用户名密码认证 : Console: R1(config)#username xiaot password tang R1(config)#line con 0 R1(config-line)#login local 这是你从 console 登入, 将会看到如下的提示 : Username: xiaot Password: R1> Telnet: R1(config)#username xiaot password tang R1(config)#line vty 0 4 R1(config-line)#login local R1(config-line)#enab R1(config-line)#exit R1(config)#eanb R1(config)#enab R1(config)#enable pas R1(config)#enable password 123 测试的效果图如下 : 228

第四部分 扩张性实验 SSH 登入 : Router(config)#hostname R1 R1(config)#ip domain-name cisco.com ( 这两条语句很关键, 因为路由要以设备名称和这个域名为材料进行 RSA 算法, 产生一对公私密钥对, 客户机 SSH 登入时, 路由器会将公钥发给客户机, 客户机用公钥加密, 路由器用私钥解密 ) R1(config)#crypto key generate rsa The name for the keys will be: R1.cisco.com Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes. How many bits in the modulus [512]: ( 产生密钥对的长度 ) % Generating 512 bit RSA keys, keys will be non-exportable...[ok] R1(config)#line vty 0 4 *?? 1 1:23:6.530: RSA key size needs to be at least 768 bits for ssh version 2 *?? 1 1:23:6.530: %SSH-5-ENABLED: SSH 1.5 has been enabled ( 当出现这个提示的 SSH 服务也随之开启了!) R1(config-line)#login loca R1(config-line)#transport input ssh R1(config-line)#en R1(config-line)#exit R1(config)#enable password 123 SSH 的测试结果如下 : PC>ssh -l xiaot 192.168.1.254 Open Password: (tang) R1>ena Password: (123) 229

第四部分 扩张性实验 实验 4-4.SNMP 实验指南 实验拓扑 : IP 规划 : 路由器 :fa0/0 192.168.1.1/24 交换机管理地址 : VLAN 1 192.168.1.2/24 PC:192.168.1.10/24 网络设备配置 : 路由器配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R1 R1(config)#int f0/0 R1(config-if)#ip addr 192.168.1.1 255.255.255.0 R1(config-if)#no shut R1(config-if)#exit R1(config)#snmp-server community xiaoro RO End with CNTL/Z. %SNMP-5-WARMSTART: SNMP agent on host R1 is undergoing a warm start R1(config)#snmp-server community xiaorw RW ( 开启 SNMP,community 是一中简单的身份认证,ro 是只读文件, rw 是可读可写文件 ) 交换机配置 : Switch(config)#int vlan 1 Switch(config-if)#ip addr 192.168.1.2 255.255.255.0 Switch(config-if)#no shut Switch(config-if)#exit 230

第四部分 扩张性实验 Switch(config)#snmp-server community xiaorw RW 操作 : 首先, 点进 PC, 选着 Destop 的中 MIB 231

第四部分 扩张性实验 上图就是 MIB 的窗口, 网络管理软件中的 MIB 跟上图左下角的 SNMP Tree 差不多,OID 就是 MIB 的信息节点精确路径,operations 就是对 MIB 的操作然后通过 SNMP 传递到网络设备上 首先, 选者 Advanced, 填入需要管理网络设备的 IP 地址, 填入设备上 community 值, 这是网络设备与网络管理设备身份认证 如图 : 这是路由器的管理 IP,read community 是 xiaoro,write community 是 xiaorw 我们通过查找 MIB 数据库中精确查找我们需要的信息节点路径, 在通过 Get 操作以 SNMP 数据到网络设备获取网络设备的信息 如下图, 在左下角的 MIB 中找到相应的节点路径 (OID:.1.3.6.1.2.1.1.0 或者 iso.org.dod.interface.mgmt.mib-2.system.sysdescr), 执行 Get 操作, 所获得到的路由器的系统信息描述信息, 包括了路由器的型号和 IOS 型号等 232

第四部分 扩张性实验 注意 : 在右下角的方框中显示了 read-only, 说明该信息是只读信息, 不能通过 SNMP 来配置网络设备 只有 write-read 就可配置 接下来, 演示通过 SNMP 来配置网络的 hostname. 同样, 我们上面一样先获取方法一样, 我们要找到 MIB 中 sysname 的位置, 点击 go, 先获取网络设备的 hostname, 效果如下图 : 我们看到他的值跟路由上命名是一样的 现在我们来修改一下网络设备的 hostname, 把 R1 改成 xiaotrouter 如图操作 : 将 operations 改为 set, 然后所要 OID 位置, 数据类型是字符串的 ( SNMP 在表示层用的 ASN.1 抽象语法表示,Value 就是我们要修改的值 xiaotrouter, 然后点击 OK, 再点击 GO 我们再路由器上看看, 在路由器的命令行中敲几个回车你就看到效果了 233

第四部分 扩张性实验 实验 4-5. 基于 AAA 的 Easy VPN 实验 所谓,AAA 就是认证 (Authentication), 授权 (Authorization ), 审计 ( Accounting) 这三个英文单词的缩写 AAA 的基本工作原理就是, 一个事件先必须通过认证才能接入进来 ; 然后根据相应的授权策略, 下发相应的权限 ; 审计则记录发生的每件事情 网络拓扑 : 网路配置 : AAA 服务器配置如下 : 双击服务器图标, 选择 Config, 在选择 AAA: 234

第四部分 扩张性实验 AAA 服务器配置简单说明 :Clientname 是随意的,Client IP 是你所要管理的路由器或交换机等网络设备的 IP 地址 Secret 是 AAA 服务器与管理的网络设备之间的密钥 ServiceType 是协议内型,Radius 是国际标准,Tacacs 是 cisco 专有协议 本实验使用的 Radius 配置用户名和密码如图所示, 点 + 添加 zongbu 路由的 AAA Easy VPN 配置 : Router>ena Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#host zongbu zongbu(config)#int f0/1 zongbu(config-if)#ip addr 100.1.1.2 255.255.255.0 zongbu(config-if)#no shut zongbu(config-if)#int f0/0 zongbu(config-if)#ip addr 192.168.1.254 255.255.255.0 zongbu(config-if)#no shut zongbu(config-if)#exit zongbu(config)#ip route 0.0.0.0 0.0.0.0 100.1.1.1 zongbu(config)#aaa new-model ( 使用 AAA 认证 ) zongbu(config)#aaa authentication login eza group radius 235

第四部分 扩张性实验 zongbu(config)#aaa authorization network ezo group radius zongbu(config)#radius-server host 192.168.1.1 auth-port 1645 key 123 ( 指点 AAA 服务器的 IP 地址和密钥,1645 是 Radius 的默认端口号 ) zongbu(config)#crypto isakmp policy 10 zongbu(config-isakmp)#encryption 3des zongbu(config-isakmp)#hash md5 zongbu(config-isakmp)#authentication pre-share zongbu(config-isakmp)#group 2 zongbu(config-isakmp)#exit zongbu(config)#crypto ipsec transform-set tim esp-3des esp-md5-hmac zongbu(config)#ip local pool ez 192.168.3.1 192.168.3.10 zongbu(config)#crypto isakmp client configuration group myez zongbu(config-isakmp-group)#key 123 zongbu(config-isakmp-group)#pool ez zongbu(config-isakmp-group)#exit zongbu(config)#crypto dynamic-map ezmap 10 zongbu(config-crypto-map)#set transform-set tim zongbu(config-crypto-map)#reverse-route zongbu(config-crypto-map)#exit zongbu(config)#crypto map tim client authentication list eza zongbu(config)#crypto map tim isakmp authorization list ezo zongbu(config)#crypto map tim client configuration address respond zongbu(config)#crypto map tim 10 ipsec-isakmp dynamic ezmap zongbu(config)#int f0/1 zongbu(config-if)#crypto map tim *Jan 3 07:16:26.785: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON Internet 配置 : Router>ena Router#conf t Router(config)#host Internet Internet(config)#int f0/0 Internet(config-if)#ip addr 200.1.1.1 255.255.255.0 Internet(config-if)#no shut Internet(config-if)#int f0/1 Internet(config-if)#ip addr 100.1.1.1 255.255.255.0 Internet(config-if)#no shut Yuancheng 配置 : Router>ena Router#conf t Router(config)#host yuancheng 236

测试 : 第四部分 扩张性实验 yuancheng(config)#int f0/0 yuancheng(config-if)#ip addr 200.1.1.2 255.255.255.0 yuancheng(config-if)#no shut yuancheng(config-if)#ip nat yuancheng(config-if)#exit yuancheng(config)#int f0/1 yuancheng(config-if)#ip addr 172.16.1.254 255.255.255.0 yuancheng(config-if)#no shut yuancheng(config-if)#exit yuancheng(config)#access-list 1 permit 172.16.1.0 0.0.0.255 yuancheng(config)#ip nat inside source list 1 interface f0/0 overload yuancheng(config)#int f0/0 yuancheng(config-if)#ip nat outside yuancheng(config-if)#int f0/1 yuancheng(config-if)#ip nat inside yuancheng(config-if)#exit yuancheng(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.1 在远端笔记本的 VPN 中输入如下信息 : 点击 connect, 就会提示连接上去, 此时会显示下发的 IP 地址 ( 若没马上连上去, 在配置没错的前提下,Ipsec VPN 协商时, 前面几个包是不通的, 解决方法, 在 ping 一下 100.1.1.2, 再连接 Easy VPN) Easy VPN 接入后, 就可 ping 总部的任何地址了 这时可以查看笔记本的 ip 地址, 同时查看 zongbu 路由器的路由表 237

第四部分 扩张性实验 实验 4-6.GRE 实验 ( 一 ) GRE: 通用路由封装, 全称 Generic Routing Encapsulation, 也算是 VPN 技术的一种 它能快速 简单地跨越 Internet( 公网 ) 实现私网之间连通, 特别是在跨越公网组建大的网络 但 GRE 致命的缺点就是, 他是明文传输数据 所以在部署 GRE 的时候, 往往结合各种安全措施来保护数据, 如利用 Ipsec 对其数加密 网络拓扑 : IP 规划表 : Internet< >zongbu Internet 30.1.1.1/24 zongbu 30.1.1.2/24 Internet< >fenbu_2 Internet 20.1.1.1/24 fenbu_2 20.1.1.2/24 Internet< >fenbu_1 Internet 10.1.1.1/24 fenbu_1 10.1.1.2/24 Zongbu < >Server zongbu 192.168.3.254/24 server 192.168.3.1/24 239

第四部分扩张性实验 fenbu_2< >PC1 zongbu 192.168.2.254/24 PC1 192.168.2.1/24 fenbu_1< >PC0 zongbu 192.168.1.254/24 PC0 192.168.1.1/24 实验配置 : Zongbu 配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host zongbu zongbu(config)#no ip domain-lookup zongbu(config)#int f0/0 zongbu(config-if)#ip addr 30.1.1.2 255.255.255.0 zongbu(config-if)#no shut zongbu(config-if)#int f0/1 End with CNTL/Z. zongbu(config-if)#ip addr 192.168.3.254 255.255.255.0 zongbu(config-if)#no shut zongbu(config-if)#exit zongbu(config)#line console 0 zongbu(config-line)#logg sy zongbu(config-line)#exit zongbu(config)#ip route 0.0.0.0 0.0.0.0 30.1.1.1 zongbu(config)#ip route 192.168.1.0 255.255.255.0 1.1.1.2 ( 配置通过 GRE 到达 192.168.1.0/24 的静态路由 ) zongbu(config)#ip route 192.168.2.0 255.255.255.0 2.1.1.2 ( 配置通过 GRE 到达 192.168.2.0/24 的静态路由 ) zongbu(config)#int tunnel 0( 创建 Tunnel 接口 0, 此接口在本实验中是与 fenbu_1 建立 GRE) zongbu(config-if)#ip addr 1.1.1.1 255.255.255.0 ( 设置 Tunnel 0 的 IP, 此 IP 与 fenbu_1 同一网段 ) zongbu(config-if)#tunnel source f0/0 (GRE 封装时公网源 IP 为 fa 0/0 的 IP) zongbu(config-if)#tunnel destination 10.1.1.2(GRE 封装是公网目标 IP 为 10.1.1.2 的 IP) zongbu(config-if)#exit zongbu(config)#int tunnel 1( 创建 Tunnel 接口 1, 此接口在本实验中是与 fenbu_2 建立 GRE) zongbu(config-if)#ip addr 2.1.1.2 255.255.255.0 ( 设置 Tunnel 1 的 IP, 此 IP 与 fenbu_2 同一网段 ) zongbu(config-if)#tunnel source f0/0 (GRE 封装时公网源 IP 为 fa 0/0 的 IP) zongbu(config-if)#tunnel destination 20.1.1.2(GRE 封装时公网目标 IP 为 20.1.1.2 的 IP) Internet 配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host Internet Internet(config)#int e1/0 End with CNTL/Z. 240

第四部分 扩张性实验 Internet(config-if)#ip addr 10.1.1.1 255.255.255.0 Internet(config-if)#no shut Internet(config-if)#int e1/1 Internet(config-if)#ip addr 20.1.1.1 255.255.255.0 Internet(config-if)#no shut Internet(config-if)#int e1/2 Internet(config-if)#ip addr 30.1.1.1 255.255.255.0 Internet(config-if)#no shut Fenbu_1 配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host fenbu_1 fenbu_1(config)#no ip domain-lookup fenbu_1(config)#line console 0 fenbu_1(config-line)#exec-timeout 0 0 fenbu_1(config-line)#logg sy fenbu_1(config-line)#int f0/0 fenbu_1(config-if)#ip addr 10.1.1.2 255.255.255.0 fenbu_1(config-if)#no shut End with CNTL/Z. fenbu_1(config-if)#int f0/1 fenbu_1(config-if)#ip addr 192.168.1.254 255.255.255.0 fenbu_1(config-if)#no shut fenbu_1(config-if)#exit fenbu_1(config)#int tunnel 0 fenbu_1(config-if)#ip addr 1.1.1.2 255.255.255.0 fenbu_1(config-if)#tunnel source f0/0 fenbu_1(config-if)#tunnel destination 30.1.1.2 fenbu_1(config-if)#exit fenbu_1(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1 fenbu_1(config)#ip route 192.168.3.0 255.255.255.0 1.1.1.1 fenbu_1(config)#ip route 192.168.2.0 255.255.255.0 1.1.1.1 Fenbu_2 配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#no ip domain-lookup Router(config)#int tunnel 0 Router(config-if)#ip addr 2.1.1.2 255.255.255.0 Router(config-if)#tunnel source f0/0 Router(config-if)#tunnel destination 30.1.1.2 Router(config-if)#int f0/0 End with CNTL/Z. 241

第四部分 扩张性实验 Router(config-if)#ip addr 20.1.1.2 255.255.255.0 Router(config-if)#no shut Router(config-if)#int f0/1 Router(config-if)#ip addr 192.168.2.254 255.255.255.0 Router(config-if)#no shut Router(config-if)#exit Router(config)#ip route 0.0.0.0 0.0.0.0 20.1.1.1 Router(config)#ip route 192.168.3.0 255.255.255.0 2.1.1.1 Router(config)#ip route 192.168.1.0 255.255.255.0 2.1.1.1 zongbu#show ip route Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route Gateway of last resort is 30.1.1.1 to network 0.0.0.0 C C C 1.0.0.0/24 is subnetted, 1 subnets 1.1.1.0 is directly connected, Tunnel0 2.0.0.0/24 is subnetted, 1 subnets 2.1.1.0 is directly connected, Tunnel1 30.0.0.0/24 is subnetted, 1 subnets 30.1.1.0 is directly connected, FastEthernet0/0 S 192.168.1.0/24 [1/0] via 1.1.1.2 S 192.168.2.0/24 [1/0] via 2.1.1.2 C 192.168.3.0/24 is directly connected, FastEthernet0/1 S* 0.0.0.0/0 [1/0] via 30.1.1.1 fenbu_1#show ip route Gateway of last resort is 10.1.1.1 to network 0.0.0.0 1.0.0.0/24 is subnetted, 1 subnets C C 1.1.1.0 is directly connected, Tunnel0 10.0.0.0/24 is subnetted, 1 subnets 10.1.1.0 is directly connected, FastEthernet0/0 C 192.168.1.0/24 is directly connected, FastEthernet0/1 S 192.168.2.0/24 [1/0] via 1.1.1.1 S 192.168.3.0/24 [1/0] via 1.1.1.1 S* 0.0.0.0/0 [1/0] via 10.1.1.1 测试方法 : 总部和各分部 PC 相互 ping 242

第四部分 扩张性实验 Fenbu_1 中的 PC0(192.168.1.1/24) 到 zongbu 的 server(192.168.3.1/24),pc0 的数据到达 fenbu_1 的路由器, 查看路由表到达 192.168.3.0/24 的下一跳 IP 是 1.1.1.1, 路由器再次查找路由 如何到 1.1.1.1 的, 到达 1.1.1.1 是要从 Tunnel0 接口出去, 此时路由器判断要对数据进行 GRE 封装处理, 于是在原有的私有 IP 包报头前封装已经配置好的原公网 IP(fa 0/0 接口 IP) 和目标公网 IP( 即 zongbu 的 fa 0/0 接口 IP), 封装好后, 路由器再次查找路由表发现到达 zongbu 的 fa 0/0 从缺省路由出去 就这样数据被送入 Internet( 公网 ),Internet( 公网 ) 的路由器直能查看公网 IP 报头, 根据公网的目标 IP 转发数据 数据到达 zongbu 后, 总部路由器首先看到路由器的目标 IP 是 自己的, 接受去除公网 IP 报头, 发现是一个 GRE 数据, 再根据私有 IP 报头中的私有目标 IP 再次查找数据, 根据路由表将数据包从 fa 0/1 送至到 server Server 接受数据, 拆封数据查看内容, 并 产生回应 IP 包到 fenbu_1 的 PC0 此后的过程跟从 PC0 到 server 是一样的 GRE 操作 243

第五部分 综合性实验 第五部分 综合性实验 实验 5-1. 综合实验 1 背景描述 : 该企业的具体环境如下 : 1 企业具有 2 个办公地点, 且相距较远, 公司总共大约有 200 台主机 ; 2 A 办公地点具有的部门较多, 例如业务部 财务部 综合部等, 为主要的办公场所, 因此 这部分的交换网络对可用性和可靠性要求较高 ; 3 B 办公地点只有较少办公人员, 但是 Internet 的接入点在这里 ; 4 公司只申请到了一个公网 IP 地址, 供企业内网接入使用 ; 5 公司内部使用私网地址. 实验工具 :PT5.3 网络拓扑 : 245

第五部分 综合性实验 IP 地址分配 : 设备名 IP 地址接口连接设备备注 R_A R_B SW_A SW_B 业务部财务部综合部 10.1.1.1/24 F0/0 SW_A 20.2.2.1/24 F0/1 SW_B 30.1.1.1/24 S0/0/0 R_B 202.1.1.1/24 Fa0/0 互联网 30.1.1.2/24 S0/0/0 R_A DCE 端 ( 6400 0) 10.1.1.2/24 F0/24 R_A F0/22~F0/23 SW_B 端口聚合 192.168.10.1/24 虚拟 vlan( 管理 ) 192.168.20. 1/24 IP 地址 192.168.30. 1/24 20.2.2.2/24 F0/24 R_A F0/22~F0/23 SW_B 端口聚合 192.168.10.1/24 虚拟 vlan( 管理 ) 192.168.20. 1/24 IP 地址 192.168.30. 1/24 192.168.10.2/24 -------- SW_A 的 F0/1 Pc101 192.168.10.3/24 -------- SW_B 的 F0/1 Pc102 192.168.20.2/24 -------- SW_A 的 F0/2 Pc201 192.168.20.3/24 -------- SW_B 的 F0/2 Pc202 192.168.30.2/24 -------- SW_A 的 F0/3 Pc301 192.168.30.3/24 -------- SW_B 的 F0/3 Pc302 需求分析 : 需求 1: 采取一定方式分隔广播域 分析 1: 在交换机上划分 VLAN 可以实现对广播域的分隔 划分业务部 VLAN10 财务部 VLAN20 综合部 VLAN30, 并分配接口 需求二 : 核心交换机采用高性能的三层交换机, 且采用双核心互为备份的形势, 接入层交换机分别通过 2 条上行链路连接到 2 台核心交换机, 由三层交换机实现 VLAN 之间的路由 分析二 交换机之间的链路配置为 Trunk 链路 三层交换机上采用 SVI 方式 (switch virtual interface) 实现 VLAN 之间的路由 需求三 :2 台核心交换机之间也采用双链路连接, 并提高核心交换机之间的链路带宽分析三 在 2 台三层交换机之间配置端口聚合, 以提高带宽 需求四 : 接入交换机的 access 端口上实现对允许的连接数量为 4 个, 以提高网络的安全性 分析四 采用端口安全的方式实现 需求五 : 三层交换机配置路由接口, 与 RA RB 之间实现全网互通分析五 两台三层交换机上配置路由接口, 连接 A 办公地点的路由器 RA 246

第五部分 综合性实验 通 RA 和 RB 分别配置接口 IP 地址 在三层交换机的路由接口和 RA, 及 RB 的内网接口上启用 RIP 路由协议, 实现全网互 需求六 :RA 和 B 办公地点的路由器 RB 之间通过广域网链路连接, 并提供一定的安全性 分析六 RA 和 RB 的广域网接口上配置 PPP( 点到点 ) 协议, 并用 PAP 认证提高安全性 需求七 :RB 配置静态路由连接到 Internet 分析七 两台三层交换上配置缺省路由, 指向 RA RA 上配置缺省路由指向 RB RB 上配置缺省路由指向连接到互联网的下一跳地址 需求八 : 在 RB 上用一个公网 IP 地址实现企业内网到互联网的访问分析八 用 PAT( 网络地址转换 ) 方式, 实现企业内网仅用一个公网 IP 地址到互联网的访问 需求九 : 在 RB 上对内网到外网的访问进行一定控制, 要求不允许财务部访问互联网, 业务部只能访问 WWW 和 FTP 服务, 而综合部只能访问 WWW 服务, 其余访问不受控制 分析九 通过 ACL( 访问控制列表 ) 实现 实验配置 : 路由器 R_B 的配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R_B R_B(config)#int f0/0 R_B(config-if)#ip addr 20.1.1.1 255.255.255.0 R_B(config-if)#no shut R_B(config-if)#int s0/0/0 R_B(config-if)#ip addr 30.1.1.2 255.255.255.0 R_B(config-if)#clock rate 64000 R_B(config-if)#no shut End with CNTL/Z. 上面只是路由器 R_B 的基本配置, 下面在 R_B 上启用动态路由协议 Ripv2, 同时配置一条连接到 Internet 的默认路由, 并且配置 pap 验证, 配置信息如下 : R_B(config-if)#exit R_B(config)#router rip R_B(config-router)#version 2 R_B(config-router)#no au R_B(config-router)#network 20.1.1.0 R_B(config-router)#network 30.0.0.0 R_B(config-router)#exit R_B(config)#ip route 0.0.0.0 0.0.0.0 f0/0 R_B(config)#username R_A password cisco R_B(config)#int s0/0/0 // 配置默认路由 // 建立用户 R_A, 密码 cisco 247

第五部分 R_B(config-if)#encapsulation ppp R_B(config-if)#ppp authentication pap 综合性实验 // 用 PPP 封装 //PPP 验证方式为 pap R_B(config-if)#ppp pap sent-username R_B password cisco // 发送用户名 R-B, 密码 cisco 到 R-A 上验证 下面通过 ACL( 访问控制列表 ) 配置来实现财务部不能访问访问互联网, 业务部只能访问 WWW 和 FTP 服务, 而综合部只能访问 WWW 服务, 其余访问不受控制, 配置信息如下 : R_B(config-if)#exit R_B(config)#access-list 100 deny ip 192.168.10.0 0.0.0.0 any R_B(config)#access-list 100 permit tcp 192.168.20.0 0.0.0.255 any eq www R_B(config)#access-list 100 permit tcp 192.168.20.0 0.0.0.255 any eq ftp R_B(config)#access-list 100 permit tcp 192.168.30.0 0.0.0.255 any eq www R_B(config)#access-list 100 permit ip any any R_B(config)#int s0/0/0 R_B(config-if)#ip ac R_B(config-if)#ip access-group 100 in 上面通过访问控制列表实现了网络的安全, 下面进行 NAT 转换的配置, 由于申请的只有一个公网 IP 地址, 所以就用基于端口转换的 NAT, 即所说的 PAT, 其配置如下 : R_B#conf t Enter configuration commands, one per line. End with CNTL/Z. R_B(config)#access-list 10 permit any R_B(config)#ip nat inside source list 10 int f0/0 overload ( 将局域网内的所有 IP 地址转换成 interface fa0/0 上对应的 20.1.1.1 这个内部全局地址 ) R_B(config)#int f0/0 R_B(config-if)#ip nat outside R_B(config-if)#int s0/0/0 R_B(config-if)#ip nat inside R_B(config-if)#exit 路由器 R_A 的配置 : Router>ena Router#conf t Enter configuration commands, one per line. Router(config)#host R_A R_A(config)#int f0/0 R_A(config-if)#ip addr 10.1.1.1 255.255.255.0 R_A(config-if)#no shut R_A(config-if)#int f0/1 R_A(config-if)#ip addr 20.2.2.1 255.255.255.0 R_A(config-if)#no shut R_A(config-if)#int s0/0/0 R_A(config-if)#ip addr 30.1.1.1 255.255.255.0 R_A(config-if)#no shut End with CNTL/Z. 上面只是路由器 R-A 的基本配置, 下面在 R-A 上启用动态路由协议 Ripv2, 同时配置 ppp 中的 pap 验证, 还要一条默认路由, 配置信息如下 : 248

第五部分 综合性实验 R_A(config-if)#exit R_A(config)#router rip R_A(config-router)#version 2 R_A(config-router)#no au R_A(config-router)#network 10.0.0.0 R_A(config-router)#network 20.0.0.0 R_A(config-router)#network 30.0.0.0 R_A(config-router)#exit R_A(config)#ip route 0.0.0.0 0.0.0.0 30.1.1.2 ( 配置一条到 R-B 默认路由 R_A(config)#username R_B password cisco R_A(config)#int s0/0/0 R_A(config-if)#encapsulation ppp R_A(config-if)#ppp authentication pap // 用 PPP 封装 // 建立用户 R-B, 密码 cisco 验证方式为 pap R_A(config-if)#ppp pap sent-username R_A password cisco // 发送用户名 R-A, 密码 cisco 到 R-B 上验证 交换机 SW-A 的配置 : Switch>ena Switch#conf t Enter configuration commands, one per line. Switch(config)#host SW_A SW_A(config)#int f0/24 SW_A(config-if)#no switchport End with CNTL/Z. ( 注释 : 由于是三层交换机, 没有启用第三层的功能的, 所以这里需要启用第三层, 用 no switchport 来实现, 下面配置 IP 地址才会成功 ) SW_A(config-if)#ip addr 10.1.1.2 255.255.255.0 SW_A(config-if)#no shut SW_A(config-if)#exit SW_A(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.1 ( 注释 : 配置一条默认路由到 R-A, 下一跳 IP 地址为 R-A 上 fa0/0 上的 IP 地址 ) 下面进行 vlan 的划分, 指派属于 VLAN 的端口, 配置如下 : SW_A(config)#vlan 10 SW_A(config-vlan)#name 10 SW_A(config-vlan)#vlan 20 SW_A(config-vlan)#name 20 SW_A(config-vlan)#vlan 30 SW_A(config-vlan)#name 30 SW_A(config-vlan)#exit SW_A(config)#int f0/1 SW_A(config-if)#switchport mode access SW_A(config-if)#switchport access vlan 10 SW_A(config-if)#int f0/2 SW_A(config-if)#switchport mode access SW_A(config-if)#switchport access vlan 20 SW_A(config-if)#int f0/3 249

第五部分 SW_A(config-if)#switchport mode access SW_A(config-if)#switchport access vlan 30 综合性实验 下面为各个 Vlan 配置 IP 地址, 并配置 Thunk 链路以实现相同 Vlan 之间跨越交换机也是可以通信的, 最后配置端口聚合配置如下 : SW_A(config)#int vlan 10 SW_A(config-if)#ip addr 192.168.10.1 255.255.255.0 SW_A(config-if)#no shut SW_A(config-if)#exit SW_A(config)#int vlan 20 SW_A(config-if)#ip addr 192.168.20.1 255.255.255.0 SW_A(config-if)#no shut SW_A(config-if)#exit SW_A(config)#int vlan 30 SW_A(config-if)#ip addr 192.168.30.1 255.255.255.0 SW_A(config-if)#no shut SW_A(config-if)#exit SW_A(config)#int port-channel 1 SW_A(config-if)#switchport mode trunk // 设置 trunk 链路 SW_A(config-if)#switchport trunk allowed vlan all // 允许所有 Vlan 通过 trunk 链路 SW_A(config-if)#int range f0/22-23 SW_A(config-if-range)#channel-group 1 mode on // 端口聚合 SW_A(config-if-range)#end 在三层交换机上启用 Ripv2 协议, 同时启用端口安全, 配置如下 SW_A(config)#router rip SW_A(config-router)#version 2 SW_A(config-router)#no au SW_A(config-router)#network 192.168.10.0 SW_A(config-router)#network 192.168.20.0 SW_A(config-router)#network 192.168.30.0 SW_A(config-router)#network 10.0.0.0 SW_A(config-router)#exit SW_A(config)#int range f0/1-3 SW_A(config-if-range)#switchport mode access SW_A(config-if-range)#int f0/1 SW_A(config-if)#switchport port-security maximum 4 SW_A(config-if)#int f0/2 SW_A(config-if)#switchport port-security maximum 4 SW_A(config-if)#int f0/3 SW_A(config-if)#switchport port-security maximum 4 交换机 SW-B 的配置 : Switch>ena 250

Switch#conf t 第五部分 综合性实验 Enter configuration commands, one per line. Switch(config)#host SW_B SW_B(config)#int f0/24 SW_B(config-if)#no switchport SW_B(config-if)#ip addr 20.2.2.2 255.255.255.0 SW_B(config-if)#no shut SW_B(config-if)#exit SW_B(config)#ip route 0.0.0.0 0.0.0.0 20.2.2.1 SW_B(config)#vlan 10 SW_B(config-vlan)#name 10 SW_B(config-vlan)#vlan 20 SW_B(config-vlan)#name 20 SW_B(config-vlan)#vlan 30 SW_B(config-vlan)#name 30 SW_B(config-vlan)#exit SW_B(config)#int f0/1 SW_B(config-if)#switchport mode access SW_B(config-if)#switchport access vlan 10 SW_B(config-if)#int f0/2 SW_B(config-if)#switchport mode access SW_B(config-if)#switchport access vlan 20 SW_B(config-if)#int f0/3 SW_B(config-if)#switchport mode access SW_B(config-if)#switchport access vlan 30 SW_B(config-if)#exit SW_B(config)#int vlan 10 SW_B(config-if)#ip addr 192.168.10.1 255.255.255.0 SW_B(config-if)#no shut SW_B(config-if)#int vlan 20 SW_B(config-if)#ip addr 192.168.20.1 255.255.255.0 SW_B(config-if)#no shut SW_B(config-if)#int vlan 30 SW_B(config-if)#ip addr 192.168.30.1 255.255.255.0 SW_B(config-if)#no shut SW_B(config-if)#exit SW_B(config)#int port-channel 1 SW_B(config-if)#switchport mode trunk SW_B(config-if)#switchport trunk allowed vlan all SW_B(config-if)#int range f0/22-23 SW_B(config-if-range)#channel-group 1 mode on SW_B(config)#router rip SW_B(config-router)#version 2 SW_B(config-router)#no au SW_B(config-router)#network 192.168.10.0 SW_B(config-router)#network 192.168.20.0 251 End with CNTL/Z.

第五部分 SW_B(config-router)#network 192.168.30.0 SW_B(config-router)#network 192.168.20.0 SW_B(config-router)#exit SW_B(config)#int range f0/1-3 综合性实验 SW_B(config-if-range)#switchport mode access SW_B(config-if-range)#int f0/1 SW_B(config-if)#switchport port-security maximum 4 SW_B(config-if)#int f0/2 SW_B(config-if)#switchport port-security maximum 4 SW_B(config-if)#int f0/3 SW_B(config-if)#switchport port-security maximum 4 PC 机的配置如下 : 业务部 PC 机 IP 地址范围为 :192.168.10.2 192.168.10.254 网关为 :192.168.10.1 财务部 PC 机 IP 地址范围为 :192.168.20.2 192.168.20.254 网关为 :192.168.20.1 综合部 PC 机 IP 地址范围为 :192.168.30.2 192.168.30.254 网关为 :192.168.30.1 252

第五部分 实验 5-2. 综合性实验 CCNA 大综合实验 转自博客 spccie.blog.51cto.com 环境背景 : 中小型企业. 有两个部门, 销售部 (vlan 10) 与行政部 (vlan 20). 同部门之间采用二层交换网络相连 ; 不同部门之间采用单臂路由方式互访. 企业有一台内部 web 服务器, 承载着内部网站, 方便员工了解公司的即时信息. 局域网路由器启用多种路由协议 ( 静态路由 动态路由协议 ), 并实施路由控制 负载均衡 链路认证 访问限制等功能. 企业有一条专线接到运营商用以连接互联网, 采用 Frame-Relay 封装, 需要手工设置 DLCI 与 IP 的映射. 由于从运营商只获取到一个公网 IP 地址, 所以企业员工上网需要做 NAT 网络地址转换. 网络配置 : 一 基础配置 253