资源描述
本资料由-大学生创业|创业|创业网
思科路由部分11个实验项目 全程记录+讲解+知识点
实验基于Dynamips-0.2.6-Rc4 | unzip-c3620-i-mz.122-37.bin |unzip-c3640-js-mz.124-10 with NM-16ESW
实验平台 双Xeon 3.0 4G ECC 运行稳定后CPU 40%左右
实验1:在P1范围内实现RIPv2
实验2:在P1范围内实现基于RIPv2的等价负载均衡
实验3:在P1范围内实现基于RIPv2的Key-Chain密钥实验
实验4:在P2范围内实现IGRP的非等价负载均衡
实验5:全区域中通过桢中继实现RIPv2路由协议 + 密钥验证
实验6:全区域中实现EIGRP路由+FR+非等价负载均衡+验证
实验7:OSPF基本配置[P1区域内配置]+DR/BDR考察
实验8:单区域NBMA环境OSPF实现+验证
实验9:多区域OSPF实现
实验10:简单的路由重发布 末节区域 完全末节区域 NSSA区域 Virtual-Link
实验11:被动接口 路由更新过滤 策略路由 路由单项重发布以及AD/Metric更改 路由双向重发布
P1配置部分
P1R1-P1R2
192.168.1.1 - 192.168.1.2 /24 P1R1上配置Lo0 200.200.200.200 /24
P1R1-P1R3
192.168.2.1 - 192.168.2.2 /24
P1R3-P1R4
192.168.3.1 - 192.168.3.2 /24
P1R2-P1R4
192.168.4.1 - 192.168.4.2 /24
P1R1-BBR1 - 10.0.0.2 /8
P1R2-BBR1 - 10.0.0.3 /8
P2配置部分
P2R1-P2R2
172.16.1.1 - 172.16.1.2 /16 P2R1上配置Lo0 100.100.100.100 /8
P2R1-P2R3
172.17.1.1 - 172.17.1.2 /16
P2R3-P2R4
172.18.1.1 - 172.18.1.2 /16
P2R2-P2R4
172.19.1.1 - 172.19.1.2 /16
P2R1-BBR2 - 11.0.0.2 /8
P2R2-BBR2 - 11.0.0.3 /8
BBR配置部分
BBR1-BBR2
219.146.241.1 -219.146.241.2 /24
BBR1 s0/0.1 -s0/0.2
10.0.0.1
BBR2 s0/0.1 -s0/0.2
11.0.0.1
BBR2-SW1
219.146.242.1 - 219.146.242.2
BBR1-SW2
219.146.243.1 - 219.146.243.2
SW1-SW2
219.146.244.1 - 219.146.244.2
SR配置部分
SR1-SW1 101.0.0.1 - 101.0.0.2
SR2-SW1 102.0.0.1 - 102.0.0.2
SR3-SW2 103.0.0.1 - 103.0.0.2
SR4-SW2 104.0.0.1 - 104.0.0.2
SR1:lo0 105.0.0.1 Lo1 106.0.0.1
SR2:lo0 107.0.0.1 Lo1 108.0.0.1
实验1:在P1范围内实现RIPv2
[P1R1]
router rip
ver 2
net 192.168.1.0
net 192.168.2.0
net 200.200.200.0
[P1R2]
router rip
ver 2
net 192.168.1.0
net 192.168.4.0
[P1R3]
router rip
ver 2
net 192.168.2.0
net 192.168.3.0
[P1R4]
router rip
ver 2
net 192.168.3.0
net 192.168.4.0
验证结果,P1R1
[Copy to clipboard]
CODE:
sh ip route:
C 200.200.200.0/24 is directly connected, Loopback0
R 192.168.4.0/24 [120/2] via 192.168.2.2, 00:00:22, FastEthernet0/0
C 192.168.1.0/24 is directly connected, Serial1/1
C 192.168.2.0/24 is directly connected, FastEthernet0/0
R 192.168.3.0/24 [120/1] via 192.168.2.2, 00:00:22, FastEthernet0/0
注意:
区分RIP两个版本,配置时候必须配置相同的rip version,虽然有办法让他们协同工作,但是基本上没什么意义
RIPV1
分类路由,没30秒发送一次更新分组,分组中不包含子网掩码信息,不支持 VLSM,默认进行边界自动路由汇总,且不可关闭,所以该路由不能支持非连续网络.不支持身份验证. 使用跳数作为度量,管理距离 120.每个分组中最多只能包含25个路由信息.使用广播进行路由更新.
RIPV2
无类路由,发送分组中含有子网掩码信息,支持VLSM,但默认该协议开启了自动汇总功能,所以如需向不同主类网络发送子网信息,需要手工关闭自动汇总功能(no auto-summary),RIPV2只支持将路由汇总至主类网络,无法将不同主类网络汇总,所以不支持CIDR.使用多播224.0.0.9进行路由更新,只有对应的多播MAC地址能够响应分组,在MAC层就能区分是否对分组响应.支持身份验证.
分类路由选择协议,当发送路由分组的接口所处子网与分组相关的子网属于同一主类网络,那么路由器在该接口可以把具体的子网发送出去.路由器假设该接口与分组子网使用相同的子网掩码.
什么是连续子网:
属于同一主类网络,使用相同的子网掩码就是连续的子网.否则就是非连续子网.在接口上手工汇总命令:ip summary-address rip 被汇总子网 被汇总子网掩码
RIP 使用UDP(用户报文协议)520端口 传输路由更新分组
RIP只能做等价负载均衡
实验2 在P1范围内实现基于RIPv2的等价负载均衡
P1R1上的Lo0为200.200.200.200,作为此实验的目的IP
[P1R4]
int f0/0
no ip route-cache
int s1/0
no ip route-cache
access-list 101 permit ip icmp any 200.200.200.0 0.0.0.255
debug ip pac 101
验证结果
[P1R2]
router rip
ver 2
net 192.168.1.0
net 192.168.4.0
[P1R3]
router rip
ver 2
net 192.168.2.0
net 192.168.3.0
[P1R4]
router rip
ver 2
net 192.168.3.0
net 192.168.4.0
P1R4上sh ip route,可以看到
[Copy to clipboard]
CODE:
Gateway of last resort is not set
R 200.200.200.0/24 [120/2] via 192.168.4.1, 00:00:16, FastEthernet0/0
[120/2] via 192.168.3.1, 00:00:09, Serial1/0
C 192.168.4.0/24 is directly connected, FastEthernet0/0
R 192.168.1.0/24 [120/1] via 192.168.4.1, 00:00:16, FastEthernet0/0
R 192.168.2.0/24 [120/1] via 192.168.3.1, 00:00:09, Serial1/0
C 192.168.3.0/24 is directly connected, Serial1/0
到达200.200.200.0网段的metric完全相同,并且通过两个出口
P1R4#ping 200.200.200.200 re 2
[Copy to clipboard]
CODE:
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 200.200.200.200, timeout is 2 seconds:
!!
Success rate is 100 percent (2/2), round-trip min/avg/max = 12/14/16 ms
P1R4#
16:00:24: IP: tableid=0, s=192.168.4.2 (local), d=200.200.200.200 (FastEthernet0/0), routed via RIB
16:00:24: IP: s=192.168.4.2 (local), d=200.200.200.200 (FastEthernet0/0), len 100, sending
16:00:24: IP: tableid=0, s=192.168.3.2 (local), d=200.200.200.200 (Serial1/0), routed via RIB
16:00:24: IP: s=192.168.3.2 (local), d=200.200.200.200 (Serial1/0), len 100, sending
注意
1.route-cache是进程交换, ip route-cache是快速交换, ip route-cache optimum是最优交换, route-cache distributed是分布式最优,负载均衡需要切换为进程交换(根据分组处理,而不是目的地),7000以上系列需要no ip cef
2.通过定义ACL定义过滤,然后debug抓取特定的数据包,可以最优化显示debug结果
均衡负载的知识:
均衡负载可以是基于目标地址或者是基于每个packet的 所谓基于目标地址的均衡负载,是说假如有2条到达目标地址的路径,那么第一个packet将通过第一条链路到达第一个目标设备,第二个packet将通过第二条链路到达第二个目标设备,第三个packet又将通过第一条链路到达第三个目标设备等等,以次类推.当Cisco路由器工作在默认的交换模式,Fast Switching(快速交换)模式下,就使用这种类型的均衡负载 Fast Switching的工作原理是:当路由器对第一个packet进行发往目标地址的处理的时候,先查看路由表和选择出口接口,然后获取组成 frame的信息(比如ARP表的查询)并进行封装,然后传输.之前获取的这些路由和数据链路信息将被保存在快速交换的cache中.接下来,当有要到达和第一个包相同的目标地址的包的时候,就可以不进行路由表和ARP表的查询,直接对packet进行交换 快速交换降低了CPU的占用和处理时间,并意味着去往某个目标地址的packet都从相同的路由器接口被路由出去.当有到达同一网络不同主机的packet,路由器可能会吧这些packet通过另外一条链路进行路由.因此,路由器能做的最好的就是给予目标地址的均衡负载 所谓基于基于packet的均衡负载,是说假如有2条到达目标地址的路径,那么第一个packet将通过第一条链路到达目标设备,第二个packet将通过第二条链路到达目标设备,第三个packet又将通过第一条链路到达目标设备等等,以次类推.(这里考虑的是等价的均衡负载) Cisco路由器工作在Process Switching(进程交换)模式的时候就采用基于 packet的均衡负载 进程交换,是指每次对packet的交换,都要查询路由表,选择出口接口和查询数据链路信息,因为每次的路由决策都是独立的.要在某个接口打开进程交换模式,使用no ip route-cache命令.
实验3 在P1范围内实现基于RIPv2的Key-Chain密钥实验
[P1R1]
key chain cisco
key 1
key-string mypassword
int f0/0
ip rip auth key-chain cisco
ip rip auth mode md 5
int s1/1
ip rip auth key-chain cisco
ip rip auth mode md5
验证结果
在P1R1上定义密钥以后,分别在s1/1和f0/0上面启用,在其他路由器并没有启用相同的密钥的时候,通过debug ip rip eve查看:
16:18:45: RIP: ignored v2 packet from 192.168.1.2 (invalid authentication)
sh ip route查看
R 192.168.3.0/24 is possibly down, routing via 192.168.2.2, FastEthernet0/0
说明因为密钥匹配原因,packet ignored,并且路由条目状态变化为possibly down
在P1R2上定义同样密钥后
debug 信息显示
Page 5 of Cisco Tec! - Powered by Discuz! Board 31
P1R4上sh ip route,可以看到
16:31:16: RIP: received packet with MD5 authentication
认证成功
附加部分
在P1R2上采用同样密钥,但是在接口上应用的时候如果采用明文方式 ip rip auth mod text(P1R1采用MD5加密)
因为两边不匹配,则一样会invalid authentication
注意
可以在路由器上配置RIPv2消息认证包括:明文或MD5加密密码
在钥匙链(key-chain)上定义多个秘钥(key)或密码,后者可选
定义秘钥链名称:key chain test
定义秘钥 key 1
定义密码key-string cisco
在接口上启用 int e0/0 ip rip authentication key-chain test
定义发送方式 ip rip authtication mode md5
记住,钥匙链-钥匙-钥匙的凹凸代表密码,必须在个锁(接口)上使用此钥匙(引用)
sh ip pro可以查看version和keychain情况
Default version control: send version 2, receive version 2
Interface Send Recv Triggered RIP Key-chain
FastEthernet0/0 2 2 cisco
Serial1/1 2 2 cisco
Loopback0 2 2
等价负载均衡同RIP部分,设置上没什么特殊之处
[P2R4]
int f0/0
bandwidth 10000
no ip route-cache
int s1/0
bandwidth 1000
no ip route-cache
router igrp 100
vari 10
access-list 101 permit ip icmp any 100.100.100.0 0.0.0.255
debug ip pac 101
验证结果
使用sh int f0/0察看其默认BW为BW 100000 Kbit
使用sh int s1/0察看其默认BW为BW 1544 Kbit
但是奇怪的是,我还没有设置variance,且BW不同的情况下,基于Dynamips的metric计算值竟然相同,先不管它
I 100.0.0.0/8 [100/8986] via 172.19.1.1, 00:00:09, FastEthernet0/0
[100/8986] via 172.18.1.1, 00:00:18, Serial1/0
如果只是设置了带宽,则所有的pac将从f0/0发出
[Copy to clipboard]
CODE:
P2R4#ping 100.100.100.100 re 2
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 100.100.100.100, timeout is 2 seconds:
!!
Success rate is 100 percent (2/2), round-trip min/avg/max = 12/14/16 ms
P2R4#
00:54:07: IP: tableid=0, s=172.19.1.2 (local), d=100.100.100.100 (FastEthernet0/0), routed via RIB
00:54:07: IP: s=172.19.1.2 (local), d=100.100.100.100 (FastEthernet0/0), len 100, sending
00:54:07: IP: tableid=0, s=172.19.1.2 (local), d=100.100.100.100 (FastEthernet0/0), routed via RIB
00:54:07: IP: s=172.19.1.2 (local), d=100.100.100.100 (FastEthernet0/0), len 100, sending
16:31:16: RIP: received packet with MD5 authentication
认证成功
附加部分
在P1R2上采用同样密钥,但是在接口上应用的时候如果采用明文方式 ip rip auth mod text(P1R1采用MD5加密)
因为两边不匹配,则一样会invalid authentication
设置好variance以后,sh ip route
I 100.0.0.0/8 [100/8986] via 172.19.1.1, 00:01:09, FastEthernet0/0
[100/12510] via 172.18.1.1, 00:00:16, Serial1/0
两条路出来了,然后观察抓包即可
[Copy to clipboard]
CODE:
P1R4#ping 100.100.100.100 re 2
Type escape sequence to abort.
Sending 2, 100-byte ICMP Echos to 100.100.100.100, timeout is 2 seconds:
!!
Success rate is 100 percent (2/2), round-trip min/avg/max = 12/14/16 ms
P1R4#
00:58:24: IP: tableid=0, s=172.19.1.1 (local), d=100.100.100.100 (FastEthernet0/0), routed via RIB
00:58:24: IP: s=172.19.1.1 (local), d=100.100.100.100 (FastEthernet0/0), len 100, sending
00:58:24: IP: tableid=0, s=172.18.1.1 (local), d=100.100.100.100 (Serial1/0), routed via RIB
00:58:24: IP: s=172.18.1.1 (local), d=100.100.100.100 (Serial1/0), len 100, sending
注意:
设置BW中的两个错误
1.将两个BW值 一个500000 一个1500,设置variance 为 334,5000000/1500=333,但是经过实验,variance设置范围为1-128
2.设置BW值不适当的时候,可能会导致sh ip route显示possiblydown,这个时候重新启用IGRP即可
知识点:
IP协议出现最早,最大跳数只支持15跳,只适合小型网络;IGRP是Cisco公司为了弥补RIP的缺陷而开发设计,适合更大的网络,最大支持255跳,为了减轻网络的负担,将默认的更新周期从RIP的30秒改为90秒,但是这也造成了网络拓扑变化时收敛速度变迟缓了。RIP和IGRP都支持最多达6条等价路由,IGRP还支持非等价路由,增加了负载均衡的灵活性。IGRP为Cisco公司所私有,目前只能在Cisco的路由器上使用。
IGRP默认支持4条路径的等价的负载均衡,最大支持6条,IGRP还支持非等价的负载均衡命令maximum-paths x
在IGRP的update包里,把路由条目分为了3个类别,如下:
1.内部路由(interior route):被宣告的路由条目是本地化的
2.系统路由(system route):到达被边界路由器汇总的网络地址的路由
3.外部路由(exterior route):来自外部,比如其他的AS的路由
IGRP Metrics
IGRP的metric是复合性的,4个要素分别是带宽(bandwidth,BW),延迟(delay),可靠性(reliability)和负载(load).默认IGRP的metric只以BW和delay作为标准.其他的2个要素可以通过命令,配置成metric的要素的一部分.有一点要注意的是,虽然IGRP的metric不使用最大传输单元(maximum transmission unit,MTU)作为要素,但是IGRP仍然会对每条路径上最小的MTU进行跟踪.
IGRP Timers and Stability Features
IGRP的update包发送周期为90秒,是RIP的3倍,但是为防止timer的同步,一般这个周期为72到90秒之间的随机数当一条路由初次被学习到以后,这条路由的invalid timer就设置为270秒(RIP的3倍).flush timer被设置为630秒(update发送周期的7倍).每次接收到该路由的update包以后,这些timer都会重新的初始化.如果在invalid timer超出,仍然没接收到该路由的update,那么该路由就标记为不可达,但是该路由仍然会保存在路由表中,并且以目标不可达的方式宣告出去,直到flush timer超出,该路由就被彻底从路由表中删除
IGRP使用了3倍于RIP的timer,优点是节约了链路的带宽,但是缺点是收敛(convergence)慢于RIP.比如当一台路由器出问题down掉了IGRP要用3倍于RIP的时间才能检测到该路由器状态的变化。
当一条路由标记为不可达的时候,或者下一跳的路由器增大了到达目标地址的metric并引起触发更新(triggered update),那么该路由将进入holddown状态,并且holddown timer的长度为3倍update发送时间再加10秒(280秒).这个时候,关于目标地址的任何新的信息都不会被接受直到holddown timer超出.可以使用命令no metric holddown来关闭这个holddown特性,一般在一个无环路的网络拓扑里,holddown特性是没什么用的,关闭这一特性有助于加快收敛时间。
实验5 全区域中通过桢中继实现RIPv2路由协议 + 密钥验证
为什么非要加入密钥验证部分,因为现实中它基本上是必须的
[P1&P2&BBR]通用部分
router rip
ver 2
net x.x.x.x
key chain cisco
key 1
key-string mypass
int x/x.x
ip rip auth key cisco
ip rip auth mod md5
[P1R1]
int s1/0
ip add 10.0.0.2 255.0.0.0
no shut
ip rip auth key cisco
ip rip auth mod md5
encpa fr
fr map ip 10.0.0.1 103 br
[P1R2|P2R1|P2R2]配置都是这样,不再阐述
[BBR1]
int s1/0
no ip add
no shut
int s1/0.1 mu
ip add 10.0.0.1
fr map ip 10.0.0.2 301 br
fr map ip 10.0.0.3 302 br
ip rip auth key cisco
ip rip auth mod md5
[BBR2]
int s1/0
no ip add
no shut
int s1/0.1 mu
ip add 11.0.0.1
fr map ip 11.0.0.2 604 br
fr map ip 11.0.0.3 605 br
ip rip auth key cisco
ip rip auth mod md5
验证结果:
[Copy to clipboard]
CODE:
sh ip route
R 200.200.200.0/24 [120/2] via 219.146.241.2, 00:00:02, FastEthernet0/0
R 100.0.0.0/8 [120/1] via 11.0.0.2, 00:00:01, Serial1/0.1
R 172.17.0.0/16 [120/3] via 11.0.0.3, 00:00:00, Serial1/0.1
R 172.16.0.0/16 [120/1] via 11.0.0.3, 00:00:00, Serial1/0.1
R 172.19.0.0/16 [120/1] via 11.0.0.3, 00:00:00, Serial1/0.1
R 172.18.0.0/16 [120/2] via 11.0.0.3, 00:00:00, Serial1/0.1
C 219.146.241.0/24 is directly connected, FastEthernet0/0
R 192.168.4.0/24 [120/3] via 219.146.241.2, 00:00:02, FastEthernet0/0
R 10.0.0.0/8 [120/1] via 219.146.241.2, 00:00:02, FastEthernet0/0
C 11.0.0.0/8 is directly connected, Serial1/0.1
R 192.168.1.0/24 [120/2] via 219.146.241.2, 00:00:02, FastEthernet0/0
R 192.168.2.0/24 [120/2] via 219.146.241.2, 00:00:02, FastEthernet0/0
R 192.168.3.0/24 [120/3] via 219.146.241.2, 00:00:02, FastEthernet0/0
BBR上面sh fr map
[Copy to clipboard]
CODE:
BBR2#sh fr map
key chain cisco
key 1
key-string mypass
int x/x.x
ip rip auth key cisco
ip rip auth mod md5
[P1R1]
int s1/0
ip add 10.0.0.2 255.0.0.0
no shut
ip rip auth key cisco
ip rip auth mod md5
encpa fr
fr map ip 10.0.0.1 103 br
[P1R2|P2R1|P2R2]配置都是这样,不再阐述
[BBR1]
int s1/0
no ip add
no shut
Serial1/0.1 (up): ip 11.0.0.2 dlci 604(0x25C,0x94C0), static,
broadcast,
CISCO, status defined, active
Serial1/0.1 (up): ip 11.0.0.3 dlci 605(0x25D,0x94D0), static,
broadcast,
CISCO, status defined, active
注意:
1.定义密钥,不需要在每台router上全部设定,这样是没有意义的重复劳动,在此网络结构中,只需要在P1,P2还有BBR区域的边界路由器上的边界端口设定key验证,现实当中也一样,不管跑什么协议,除非是不支持此功能的,否则为了安全起见,至少边界路由器要设定验证
2.此结构中的BBR区域桢中继采用点到多点接口,所以,密钥的实现一定要在子接口里面实现,如果在物理接口上去敲命令,那么你debug肯定会告诉你invaild auth
知识点:
桢中继交换机配置
定义交换机frame switch
进入端口
no ip no shut
封装frame
定义frame intf-type dce
定义lmi
定义clockrate
定义frame route 100 interface s1/1 200
典型配置
interface Serial1/0
no ip address
encapsulation frame-relay
no fair-queue
serial restart-delay 0
clock rate 64000
frame-relay intf-type dce
frame-relay route 100 interface Serial1/1 200
frame-relay route 600 interface Serial1/2 500
!
interface Serial1/1
no ip address
encapsulation frame-relay
serial restart-delay 0
clock rate 64000
frame-relay intf-type dce
frame-relay route 200 interface Serial1/0 100
frame-relay route 300 interface Serial1/2 400
!
interface Serial1/2
no ip address
encapsulation frame-relay
serial restart-delay 0
clock rate 64000
frame-relay intf-type dce
frame-relay route 400 interface Serial1/1 300
frame-relay route 500 interface Serial1/0 600
实验6 全区域中实现EIGRP路由+FR+非等价负载均衡+验证
[P1&P2&BBR]通用部分
router eigrp 100
net x.x.x.x
[P1R1]
int s1/0
ip add 10.0.0.2 255.0.0.0
no shut
encpa fr
fr map ip 10.0.0.1 103 br
Serial1/0.1 (up): ip 11.0.0.2 dlci 604(0x25C,0x94C0), static,
broadcast,
CISCO, status defined, active
Serial1/0.1 (up): ip 11.0.0.3 dlci 605(0x25D,0x94D0), static,
broadcast,
CISCO, status defined, active
[P1R2|P2R1|P2R2]配置都是这样,不再阐述
[BBR1]
int
展开阅读全文