ospf的高级应用之rip!(H3C)

2023-01-31 04:01:56 高级 OSPF H3C

案例一:

1作业要求:

  • 把rip学到的路由重分发到ospf中
  • 在rip中注入默认路由指向ospf
  • 实现路由汇总(在ABR上汇总)
  • 配置末梢区域
  • 配置完全末梢区域

2.拓扑图

image

3.设备介绍:

交换机:HUAWEI QUIDWAY S2000 serials

路由器:HUAWEI QUIDWAY R2621

4.设备配置:

交换机的配置:

[Quidway]vlan 10

[Quidway-vlan10]description in

[Quidway-vlan10]port e0/3 to e0/6

[Quidway-vlan10]quit

[Quidway]int Vlan-interface 10

[Quidway-Vlan-interface10]ip add 192.168.1.1 255.255.255.0

[Quidway]vlan 20

[Quidway-vlan20]description out

[Quidway-vlan20]port e0/1 

[Quidway-vlan20]quit

[Quidway]int vlan 20               //进vlan

[Quidway-Vlan-interface20]ip add 192.168.2.1 255.255.255.0   //配IP

[Quidway-Vlan-interface20]quit

[Quidway]ospf                                         //模式请注意:

[Quidway-ospf]area 2                               //进入要宣告网络的区域

[Quidway-ospf-area-0.0.0.2]network 192.168.1.0 0.0.0.255    //宣告网络

[Quidway-ospf-area-0.0.0.2]network 192.168.2.0 0.0.0.255

路由器R3的配置:

[R3]int e1

[R3-Ethernet1]ip add 192.168.2.2 255.255.255.0

[R3-Ethernet1]int s0

[R3-Serial0]ip add 192.168.3.1 255.255.255.0

[R3-Serial0]quit

[R3]ospf enable            // 启用OSPF协议

[R3]int s0                   //进接口 启用ospf (所有接口都要启用

[R3-Serial0]ospf enable area 0

[R3-Serial0]int e1

[R3-Ethernet1]ospf enable area 2

路由器R10的配置:

[R10]int s0

[R10-Serial0]ip address 192.168.3.2 24

[R10-Serial0]int s1

[R10-Serial1]ip add 192.168.4.1 24

[R10-Serial1]int e1

[R10-Ethernet1]ip add 192.168.5.1 24

[R10]ospf enable

[R10]int s1

[R10-Serial1]ospf enable area 1

[R10-Serial1]int s0

[R10-Serial0]ospf enable area 0

[R10]rip // 启动rip协议

[R10-rip]network 192.168.5.0

[r10]int s0                              //串行口的最后一端要复位!

[r10-Serial0]shutdown

[r10-Serial0]undo shutdow

路由器R5的配置:

[R5]int s1

[R5-Serial1]ip add 192.168.4.2 24

[R5]int loo 1                                                   //由于未接线,所以设置loopback 接口

[R5-LoopBack1]ip add 192.168.8.1 24                   // 主地址

[R5-LoopBack1]ip add 192.168.9.1 24 sub            //配置辅助IP地址 (为了实现路由汇总)

[R5-LoopBack1]ip add 192.168.10.1 24 sub

[R5-LoopBack1]ip add 192.168.11.1 24 sub

[R5-LoopBack1]quit

[R5]int s1

[R5-Serial1]ospf enable area 1

[R5-Serial1]int lo 1

[R5-LoopBack1]ospf enable area 1

[R5]int s1

[R5-Serial1]shut

[R5-Serial1]undo shut

路由器R9的配置:

[Router]sysname r9

[r9]int e1

[r9-Ethernet1]ip add 192.168.5.2 24

[r9-Ethernet1]int s0

[r9-Serial0]ip add 192.168.6.1 24

[r9-Serial0]qu

[r9]rip                               //启用rip协议

waiting...

RIP is running

[r9-rip]network 192.168.5.0      //宣告网络

[r9-rip]network 192.168.6.0

路由器R12的配置:

[r12-Ethernet0]int s0

[r12-Serial0]ip add 192.168.6.2 24

[r12-Serial0]int e1

[r12-Ethernet0]ip add 192.168.7.1 24

[r12]rip

waiting...

RIP is running

[r12-rip]network 192.168.6.0

[r12-rip]network 192.168.7.0

[r12]int s0                               //该接口复位,否则不通

[r12-Serial0]shutdown

[r12-Serial0]undo shutdow

 

5.路由重分发:

[R10]ospf enable

[R10-ospf]import-route direct    //发布直连路由

[R10-ospf]import-route rip        //把rip学到的路由信息发送到OSPF中

[R10]int null 0                        //必须先创建NULL0

[R10]ip route 0.0.0.0 0 null 0     //用一条默认路由指向该接口,表示:通过该接口的路由都扔掉

[R10]rip

[R10-rip]import static              发布静态路由

查看路由表信息如下:

[r9]dis ip rout

Routing Tables:

Destination/Mask Proto Pref Metric Nexthop Interface

0.0.0.0/0 RIP 100 1 192.168.5.1 Ethernet1

127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0

127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0

192.168.5.0/24 Direct 0 0 192.168.5.2 Ethernet1

192.168.5.2/32 Direct 0 0 127.0.0.1 LoopBack0

192.168.6.0/24 Direct 0 0 192.168.6.2 Serial0

192.168.6.1/32 Direct 0 0 127.0.0.1 LoopBack0

192.168.6.2/32 Direct 0 0 192.168.6.2 Serial0

<Quidway>dis ip rout

Routing Table: public net

Destination/Mask Protocol Pre Cost Nexthop Interface

127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0

127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0

192.168.2.0/24 DIRECT 0 0 192.168.2.1 Vlan-interface20

192.168.2.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0

192.168.3.0/24 OSPF 10 1572 192.168.2.2 Vlan-interface20

192.168.3.1/32 O_ASE 150 1 192.168.2.2 Vlan-interface20

192.168.4.0/24 OSPF 10 3134 192.168.2.2 Vlan-interface20

192.168.4.2/32 O_ASE 150 1 192.168.2.2 Vlan-interface20

192.168.5.0/24 O_ASE 150 1 192.168.2.2 Vlan-interface20

192.168.6.0/24 O_ASE 150 1 192.168.2.2 Vlan-interface20

192.168.8.0/24 OSPF 10 4696 192.168.2.2 Vlan-interface20

192.168.9.0/24 OSPF 10 4696 192.168.2.2 Vlan-interface20

192.168.10.0/24 OSPF 10 4696 192.168.2.2 Vlan-interface20

192.168.11.0/24 OSPF 10 4696 192.168.2.2 Vlan-interface20

6.配置末梢区域:

[Quidway]ospf

[Quidway-ospf]area 2

[Quidway-ospf-area-0.0.0.2]stub

[R3]ospf

[R3-ospf]stub cost 100 area 2

[R10-ospf]abr-summary 192.168.8.0 mask 255.255.252.0 area 1

查看路由表:

[R3]dis ip rout

Routing Tables:

Destination/Mask Proto Pref Metric Nexthop Interface

127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0

127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0

192.168.2.0/24 Direct 0 0 192.168.2.2 Ethernet1

192.168.2.2/32 Direct 0 0 127.0.0.1 LoopBack0

192.168.3.0/24 Direct 0 0 192.168.3.2 Serial0

192.168.3.1/32 Direct 0 0 127.0.0.1 LoopBack0

192.168.3.2/32 Direct 0 0 192.168.3.2 Serial0

192.168.4.0/24 OSPF 10 3124 192.168.3.2 Serial0

192.168.4.2/32 O_ASE 150 1 192.168.3.2 Serial0

192.168.5.0/24 O_ASE 150 1 192.168.3.2 Serial0

192.168.6.0/24 O_ASE 150 1 192.168.3.2 Serial0

192.168.8.0/22 OSPF 10 4686 192.168.3.2 Serial0

7.在ABR上配置完全末梢区域:

[R3-ospf]stub cost 100 area 2 no-summary

[Quidway]dis ip rout

Routing Table: public net

Destination/Mask Protocol Pre Cost Nexthop Interface

0.0.0.0/0 OSPF 10 110 192.168.2.2 Vlan-interface20

127.0.0.0/8 DIRECT 0 0 127.0.0.1 InLoopBack0

127.0.0.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0

192.168.2.0/24 DIRECT 0 0 192.168.2.1 Vlan-interface20

192.168.2.1/32 DIRECT 0 0 127.0.0.1 InLoopBack0

8.测试

本机:

clip_image002

C:\Users\Administrator>ping 192.168.7.253

正在 Ping 192.168.7.253 具有 32 字节的数据:

来自 192.168.7.253 的回复: 字节=32 时间=41ms TTL=59

来自 192.168.7.253 的回复: 字节=32 时间=37ms TTL=59

来自 192.168.7.253 的回复: 字节=32 时间=37ms TTL=59

来自 192.168.7.253 的回复: 字节=32 时间=37ms TTL=59

192.168.7.253 的 Ping 统计信息:

数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),

往返行程的估计时间(以毫秒为单位):

最短 = 37ms,最长 = 41ms,平均 = 38ms

相关文章