天天看点

ospf多区域路由与rip区域的路由重发布

在现实的网络中,网络的连接是依靠链路协议链接的,可是协议却各不相同,没法直接连接使用,我们在现实中常见的协议是rip协议和ospf协议。今天的实验就是讲将这两个协议联合使用。

实验说明:本实验做的是ospf路由与rip路由的连接,因为两者是不同的协议,没法直连,假设ospf是一个大型的网络区域。rip是个很小的网络区域,那么我们可以把rip重发布到ospf,将rip直连到ospf。

<a href="http://blog.51cto.com/attachment/201307/211512571.png" target="_blank"></a>

按照上图配置相应的端口和路由协议

在r1

[Huawei]int eth 0/0/0

[Huawei-Ethernet0/0/0]ip add 192.168.1.1 24

[Huawei-Ethernet0/0/0]loopback local

[Huawei-Ethernet0/0/0]int s 0/0/0

[Huawei-Serial0/0/0]ip add 192.168.2.1 24

在r2

[Huawei]int s 0/0/0

[Huawei-Serial0/0/0]ip add 192.168.2.2 24

[Huawei-Serial0/0/0]int s 0/0/1

[Huawei-Serial0/0/1]ip add 192.168.3.1 24

[Huawei-Serial0/0/3]int s 0/0/2

[Huawei-Serial0/0/2]ip add 192.168.6.1 24

在r3

[Huawei-Serial0/0/2]int s 0/0/1

[Huawei-Serial0/0/1]ip add 192.168.3.2 24

[Huawei-Serial0/0/1]int s 0/0/0

[Huawei-Serial0/0/0]ip add 192.168.4.1 24

在r4

[Huawei-Serial0/0/0]ip add 192.168.4.2 24

[Huawei-Serial0/0/0]int eth 0/0/0

[Huawei-Ethernet0/0/0]ip add 192.168.5.1 24

在r5

[Huawei]int s 0/0/2

[Huawei-Serial0/0/2]ip add 192.168.6.2 24

[Huawei-Serial0/0/1]ip add 192.168.7.1 24

在r6

[Huawei]int s 0/0/1

[Huawei-Serial0/0/1]ip add 192.168.7.2 24

[Huawei-Serial0/0/1]int eth 0/0/0

[Huawei-Ethernet0/0/0]ip add 192.168.8.1 24

配置ospf区域与rip区域

ospf区域

[Huawei]ospf 1

[Huawei-ospf-1]area 1

[Huawei-ospf-1-area-0.0.0.1]network 192.168.1.0 0.0.0.255

[Huawei-ospf-1-area-0.0.0.1]network 192.168.2.0 0.0.0.255

[Huawei-ospf-1]area 1 

[Huawei-ospf-1]area 0

[Huawei-ospf-1-area-0.0.0.0]network 192.168.3.0 0.0.0.255

[Huawei]rip

[Huawei-rip-1]network 192.168.6.0(关键的一个,很多同学在实验是忘记了,导致最后出错)

[Huawei-ospf-1]area 0 

[Huawei-ospf-1]area 2

[Huawei-ospf-1-area-0.0.0.2]network 192.168.4.0 0.0.0.255

[Huawei-ospf-1]area 2 

[Huawei-ospf-1-area-0.0.0.2]network 192.168.5.0 0.0.0.255

都配置好后

[Huawei]dis ip routing-table

Route Flags: R - relay, D - download to fib

------------------------------------------------------------------------------

Routing Tables: Public

         Destinations : 8        Routes : 8        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      127.0.0.0/8   Direct  0    0           D   127.0.0.1       InLoopBack0

      127.0.0.1/32  Direct  0    0           D   127.0.0.1       InLoopBack0

    192.168.1.0/24  OSPF    10   4687        D   192.168.4.1     Serial0/0/0

    192.168.2.0/24  OSPF    10   4686        D   192.168.4.1     Serial0/0/0

    192.168.3.0/24  OSPF    10   3124        D   192.168.4.1     Serial0/0/0

    192.168.4.0/24  Direct  0    0           D   192.168.4.2     Serial0/0/0

    192.168.4.1/32  Direct  0    0           D   192.168.4.1     Serial0/0/0

    192.168.4.2/32  Direct  0    0           D   127.0.0.1       Serial0/0/0

[Huawei]ping 192.168.1.1

  PING 192.168.1.1: 56  data bytes, press CTRL_C to break

    Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=253 time=80 ms

    Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=253 time=70 ms

    Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=253 time=70 ms

    Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=253 time=90 ms

    Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=253 time=110 ms

  --- 192.168.1.1 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

    round-trip min/avg/max = 70/84/110 ms

rip区域

[Huawei-rip-1]net

[Huawei-rip-1]network 192.168.7.0

[Huawei-rip-1]network 192.168.6.0

[Huawei-rip-1]network 192.168.8.0

192.168.6.0/24  RIP     100  1           D   192.168.7.1     Serial0/0/1

    192.168.7.0/24  Direct  0    0           D   192.168.7.2     Serial0/0/1

    192.168.7.1/32  Direct  0    0           D   192.168.7.1     Serial0/0/1

    192.168.7.2/32  Direct  0    0           D   127.0.0.1       Serial0/0/1

    192.168.8.0/24  Direct  0    0           D   192.168.8.1     Ethernet0/0/0

    192.168.8.1/32  Direct  0    0           D   127.0.0.1       Ethernet0/0/0

在r6里

[Huawei]ping 192.168.6.2

  PING 192.168.6.2: 56  data bytes, press CTRL_C to break

    Reply from 192.168.6.2: bytes=56 Sequence=1 ttl=255 time=30 ms

    Reply from 192.168.6.2: bytes=56 Sequence=2 ttl=255 time=50 ms

    Reply from 192.168.6.2: bytes=56 Sequence=3 ttl=255 time=20 ms

    Reply from 192.168.6.2: bytes=56 Sequence=4 ttl=255 time=20 ms

    Reply from 192.168.6.2: bytes=56 Sequence=5 ttl=255 time=40 ms

现在rip和ospf都配置好了,只差把rip和ospf连接了

在r2里

进入ospf 1 对rip进行重发布

[Huawei-ospf-1]import-route rip 

进入rip 做一个默认路由与ospf连接

[Huawei-rip-1]default-route originate 

查看路由

[Huawei]dis ip routing-table 

         Destinations : 15       Routes : 15       

    192.168.1.0/24  OSPF    10   1563        D   192.168.2.1     Serial0/0/0

    192.168.2.0/24  Direct  0    0           D   192.168.2.2     Serial0/0/0

    192.168.2.1/32  Direct  0    0           D   192.168.2.1     Serial0/0/0

    192.168.2.2/32  Direct  0    0           D   127.0.0.1       Serial0/0/0

    192.168.3.0/24  Direct  0    0           D   192.168.3.1     Serial0/0/1

    192.168.3.1/32  Direct  0    0           D   127.0.0.1       Serial0/0/1

    192.168.3.2/32  Direct  0    0           D   192.168.3.2     Serial0/0/1

    192.168.4.0/24  OSPF    10   3124        D   192.168.3.2     Serial0/0/1

    192.168.6.0/24  Direct  0    0           D   192.168.6.1     Serial0/0/2

    192.168.6.1/32  Direct  0    0           D   127.0.0.1       Serial0/0/2

    192.168.6.2/32  Direct  0    0           D   192.168.6.2     Serial0/0/2

    192.168.7.0/24  RIP     100  1           D   192.168.6.2     Serial0/0/2

    192.168.8.0/24  RIP     100  2           D   192.168.6.2     Serial0/0/2

    Reply from 192.168.1.1: bytes=56 Sequence=1 ttl=253 time=70 ms

    Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=253 time=60 ms

[Huawei]ping 192.168.5.1

  PING 192.168.5.1: 56  data bytes, press CTRL_C to break

    Reply from 192.168.5.1: bytes=56 Sequence=1 ttl=252 time=90 ms

    Reply from 192.168.5.1: bytes=56 Sequence=2 ttl=252 time=90 ms

    Reply from 192.168.5.1: bytes=56 Sequence=3 ttl=252 time=100 ms

    Reply from 192.168.5.1: bytes=56 Sequence=4 ttl=252 time=90 ms

    Reply from 192.168.5.1: bytes=56 Sequence=5 ttl=252 time=110 ms

OK!证明我们的实验完全没有问题,rip和ospf已经形成了链路

    本文转自Tar0 51CTO博客,原文链接:http://blog.51cto.com/tar0cissp/1257595,如需转载请自行联系原作者

继续阅读