实验简述:
1
、为方便起见,图中R1
和R2
分别由三层交换机来代替;
2
、PC1
和PC3
分别用真机实现,但PC2
和PC4
分别用换回接口来实现;
实验器材:
两台H3C S3610
三层交换机
实验目标:
1、
分别用静态路由、RIP
、OSPF
实现全网互通
2、
通过聚合的方式将路由表的大小控制在最小的范围内(
静态路由要求此步骤)
3、
RIP
要求开启毒性逆转,并通过debug
的方式验证
4、
OSPF
中用debug
的方式观察并理解OSPF
的工作过程
实验内容:
R1
采用静态路由并实现聚合的的简要配置:
#
vlan 1
#
domain system
access-limit disable
state active
idle-cut disable
self-service-url disable
#
user-group system
#
interface Ethernet1/0/1
port link-mode route
ip address 192.168.110.1 255.255.255.0
#
interface Ethernet1/0/24
port link-mode route
ip address 192.161.0.1 255.255.255.0
#
interface NULL0
#
interface LoopBack1
ip address 192.162.0.2 255.255.255.255
#
ip route-static 172.160.0.0 255.252.0.0 192.168.110.2 //
路由汇聚
#
Return
R2
采用静态路由并实现聚合的简要配置
vlan 1
#
domain system
access-limit disable
state active
idle-cut disable
self-service-url disable
#
user-group system
#
interface Ethernet1/0/1
port link-mode route
ip address 192.168.110.2 255.255.255.0
#
interface Ethernet1/0/24
port link-mode route
ip address 172.161.0.1 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 172.162.0.1 255.255.255.255
#
ip route-static 192.160.0.0 255.252.0.0 192.168.110.1 //
路由汇聚
#
return
RIP
的简要配置
R1
上的配置:
#
interface Ethernet1/0/1
port link-mode route
ip address 192.168.110.1 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 192.161.0.1 255.255.255.255
#
interface LoopBack1
ip address 192.162.0.1 255.255.255.255
#
rip 11
network 192.168.110.0
network 192.161.0.0
network 192.162.0.0
#
return
R2
的简要配置
#
interface Ethernet1/0/1
port link-mode route
ip address 192.168.110.2 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 172.161.0.1 255.255.255.255
#
interface LoopBack1
ip address 172.162.0.1 255.255.255.255
#
rip 22
network 192.168.110.0
network 172.161.0.0
network 172.162.0.0
#
return
OSPF
的简要配置
R1
的简要配置:
#
interface Ethernet1/0/1
port link-mode route
ip address 192.168.110.1 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 192.161.0.1 255.255.255.255
#
interface LoopBack1
ip address 192.162.0.1 255.255.255.255
#
ospf 11 router-id 1.1.1.1
area 0.0.0.0
network 192.168.110.0 0.0.0.255
network 192.161.0.0 0.0.0.255
network 192.162.0.0 0.0.0.255
#
return
R2
的简要配置
#
interface Ethernet1/0/1
port link-mode route
ip address 192.168.110.2 255.255.255.0
#
interface NULL0
#
interface LoopBack0
ip address 172.161.0.1 255.255.255.255
#
interface LoopBack1
ip address 172.162.0.1 255.255.255.255
#
ospf 22 router-id 2.2.2.2
area 0.0.0.0
network 192.168.110.0 0.0.0.255
network 172.161.0.0 0.0.0.255
network 172.162.0.0 0.0.0.255
#
Return
RIP
毒性逆转debug
的查看与分析:
当接口开启毒性逆转后,该端口每接收到一个与自己直连网段的路由更新信息时,其都会立刻回复一个cost
为16
的路由信息。
Debug
查看与分析ospf
的工作过程:
OSPF
的Debug
信息:
*Apr 26 12:50:16:854 2000 r1 RM/6/RMDEBUG:OSPF 1: SEND Packet.
*Apr 26 12:50:16:855 2000 r1 RM/6/RMDEBUG:Source Address: 192.168.110.2
*Apr 26 12:50:16:855 2000 r1 RM/6/RMDEBUG:Destination Address: 224.0.0.5
*Apr 26 12:50:16:856 2000 r1 RM/6/RMDEBUG:Ver# 2, Type: 1, Length: 48.
*Apr 26 12:50:16:856 2000 r1 RM/6/RMDEBUG:Router: 1.1.1.1, Area: 0.0.0.0, Checksum: 24896.
*Apr 26 12:50:16:874 2000 r1 RM/6/RMDEBUG:AuType: 00, Key(ascii): 0 0 0 0 0 0 0 0.
*Apr 26 12:50:16:895 2000 r1 RM/6/RMDEBUG:Net Mask: 255.255.255.0, Hello Int: 10, Option: _E_.
*Apr 26 12:50:16:915 2000 r1 RM/6/RMDEBUG:Rtr Priority: 1, Dead Int: 40, DR: 192.168.10.2, BDR:192.168.10.1.
*Apr 26 12:50:16:935 2000 r1 RM/6/RMDEBUG:Attached Neighbor: 2.2.2.2.
*Apr 26 12:50:19:218 2000 r1 RM/6/RMDEBUG:OSPF 1: RECV Packet.
*Apr 26 12:50:19:219 2000 r1 RM/6/RMDEBUG:Source Address: 192.168.110.1
*Apr 26 12:50:19:219 2000 r1 RM/6/RMDEBUG:Destination Address: 224.0.0.5
*Apr 26 12:50:19:219 2000 r1 RM/6/RMDEBUG:Ver# 2, Type: 1, Length: 48.
*Apr 26 12:50:19:220 2000 r1 RM/6/RMDEBUG:Router: 2.2.2.2, Area: 0.0.0.0, Checksum: 24896.
*Apr 26 12:50:19:239 2000 r1 RM/6/RMDEBUG:AuType: 00, Key(ascii): 0 0 0 0 0 0 0 0.
*Apr 26 12:50:19:258 2000 r1 RM/6/RMDEBUG:Net Mask: 255.255.255.0, Hello Int: 10, Option: _E_.
*Apr 26 12:50:19:278 2000 r1 RM/6/RMDEBUG:Rtr Priority: 1, Dead Int: 40, DR: 192.168.110.2, BDR: 192.168.110.1.
*Apr 26 12:50:19:299 2000 r1 RM/6/RMDEBUG:Attached Neighbor: 1.1.1.1.
[r1-LoopBack0]un shut
*Apr 26 12:53:16:752 2000 r1 RM/6/RMDEBUG:OSPF 1: SEND Packet.
*Apr 26 12:53:16:753 2000 r1 RM/6/RMDEBUG:Source Address: 192.168.110.2
*Apr 26 12:53:16:753 2000 r1 RM/6/RMDEBUG:Destination Address: 224.0.0.5
*Apr 26 12:53:16:754 2000 r1 RM/6/RMDEBUG:Ver# 2, Type: 4, Length: 88.
*Apr 26 12:53:16:754 2000 r1 RM/6/RMDEBUG:Router: 1.1.1.1, Area: 0.0.0.0, Checksum: 40190.
*Apr 26 12:53:16:773 2000 r1 RM/6/RMDEBUG:AuType: 00, Key(ascii): 0 0 0 0 0 0 0 0.
*Apr 26 12:53:16:793 2000 r1 RM/6/RMDEBUG:LSA Count: 1.
*Apr 26 12:53:16:995 2000 r1 RM/6/RMDEBUG:OSPF 1: RECV Packet.
*Apr 26 12:53:16:995 2000 r1 RM/6/RMDEBUG:Source Address: 192.168.110.1
*Apr 26 12:53:16:996 2000 r1 RM/6/RMDEBUG:Destination Address: 224.0.0.5
*Apr 26 12:53:16:996 2000 r1 RM/6/RMDEBUG:Ver# 2, Type: 5, Length: 44.
*Apr 26 12:53:16:997 2000 r1 RM/6/RMDEBUG:Router: 2.2.2.2, Area: 0.0.0.0, Checksum: 47559.
*Apr 26 12:53:17:15 2000 r1 RM/6/RMDEBUG:AuType: 00, Key(ascii): 0 0 0 0 0 0 0 0.
*Apr 26 12:53:17:35 2000 r1 RM/6/RMDEBUG:LSAType: 1, LinkStateId: 1.1.1.1, Advertising Rtr: 1.1.1.1.
*Apr 26 12:53:17:55 2000 r1 RM/6/RMDEBUG:LSA Age: 3194 Options: ExRouting:ON.
*Apr 26 12:53:17:56 2000 r1 RM/6/RMDEBUG:Length: 60 Seq# 80000008 CheckSum: 47543.
分析:
1、
由debug
信息可以看出,在ospf
的hello
报文中,只有双方的网络掩码、发送间隔和死亡间隔时间都相同时,才可能建立邻居关系。且在hello
报文中包含了路由器的router id
和优先级,凭此可以进行DR
和BDR
的选举。
2、
当一个链路down
掉以后,当前路由器会迅速组播发送LSU
报文告诉网络中的邻居,此链路已经不存在,邻居收到以后会回复一个LSACK
的报文,需要注意的是,回复的LSACK
报文不是以单播的方式发送,而是以组播的形式发送。
实验总结:
1
、在用RIP
进行路由协议时,尽量将自动汇总功能关闭,因为 RIP
默认开启自动汇总,若开启自动汇总功能,当网络中存在不连续子网时(
个人理解不连续子网,改为跨路由子网更为贴切)
,会造成路由学习有误的现象。
2
、若在创建ospf
中,采用手工方式指定router id
,且router id
不是某个接口的地址时,则不需要在宣告网络时另外宣告router id
的网络地址,因为router id
只是路由器的一个标识,只要保证全网唯一即可(
必须全网唯一:因为在选举DR/BDR
时可能会用到它)
。