ripv2&ospf路由重发布

拓扑图

要求

     如上拓扑图,左侧路由使用ospf协议,右侧使用ripv2协议,让网络全网互通。

1. 在各个路由器上配置网络ip

 AR0

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

[Huawei-Ethernet0/0/0]ip address 192.168.1.1 255.255.255.0

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

[Huawei-Ethernet0/0/0]ip address 192.168.1.1 255.255.255.0

AR1

<Huawei>system

Enter system view, return user view with Ctrl+Z.

[Huawei]int s0/0/0

[Huawei-Serial0/0/0]ip address 192.168.2.2 255.255.255.0

<Huawei>system

Enter system view, return user view with Ctrl+Z.

[Huawei]int s0/0/0

[Huawei-Serial0/0/0]ip address 192.168.2.2 255.255.255.0

AR2

[Huawei]int s0/0/1

[Huawei-Serial0/0/1]ip address 192.168.3.2 255.255.255.0

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

[Huawei-Serial0/0/2]ip address 192.168.4.1 255.255.255.0

AR3

[Huawei]int s0/0/2

[Huawei-Serial0/0/2]ip address 192.168.4.2 255.255.255.0

[Huawei-Serial0/0/2]int e0/0/0

[Huawei-Ethernet0/0/0]ip address 192.168.5.1 255.255.255.0

2.在客户机CLIENT配置IP

 CLIENT0

   IP : 192.168.1.2

  掩码:255.255.255.0

  网关:192.168.1.1

CLIENT1

  IP :192.168.5.2

  掩码:255.255.255.0

  网关:192.168.5.1

3.在左区域路由器上配置ospf

AR0

在做的时候在实机上做的步骤和在虚拟机上做的步骤是不同的,可能是版本的不同,实机的步骤如下

 [Huawei]int e0/0/0

[Huawei-Ethernet0/0/0]ospf enable area 0

[Huawei-Ethernet0/0/0]quit

[Huawei]int s0/0/0

[Huawei-Serial0/0/0]ospf enable area 0

[Huawei-Serial0/0/0]quit

因为现在是用虚拟机做的,所以以下全是虚拟机的步骤。

虚拟机步骤如下

[Huawei]ospf

[Huawei-ospf-1]area 0

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

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

AR1

[Huawei]ospf

[Huawei-ospf-1]area 0

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

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

AR2

[Huawei]ospf

[Huawei-ospf-1]area  0

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

4.在右侧区域路由器配置ripv2

AR2

[Huawei]

[Huawei]int s0/0/2

[Huawei-Serial0/0/2]rip version 2

[Huawei]rip

[Huawei-rip-1]network 192.168.4.0

AR3

[Huawei]

[Huawei]int s0/0/2

[Huawei-Serial0/0/2]rip version 2

[Huawei-Serial0/0/2]int e0/0/0

[Huawei-Ethernet0/0/0]rip version 2

[Huawei-Ethernet0/0/0]quit

[Huawei]rip

[Huawei-rip-1]network 192.168.4.0

[Huawei-rip-1]network 192.168.5.0

5.AR1上查看路由

[Huawei]dis ip rout

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

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

Routing Tables: Public

         Destinations : 9        Routes : 9        

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   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

可以看到学习到了1.0网段,但并没有学习到5.0与4.0的网段,我们可以在1.0

网段的主机ping 一下5.0网段的主机,看下结果

PC>ping 192.168.5.2

Ping 192.168.5.2: 32 data bytes, Press Ctrl_C to break

Request timeout!

Request timeout!

Request timeout!

Request timeout!

Request timeout!

6.要想在不同协议下相互学习到路由,需要进行路由重发布

现在我们要在路由器AR2上配置路由重发布

[Huawei]ospf

[Huawei-ospf-1]import-route rip

[Huawei]rip

[Huawei-rip-2]import-route ospf 

现在可以在AR2上查看一下路由信息

[Huawei]dis ip rout

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

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

Routing Tables: Public

         Destinations : 11   Routes : 11 

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   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  O_ASE   150  1 D   192.168.3.2     Serial0/0/1

    192.168.5.0/24  O_ASE   150  1 D   192.168.3.2     Serial0/0/1

可以看到已经都学习到4.05.0网段,现在可以使用1.0网段的主机ping 5.0网段的主机,测试连通性。

PC>ping 192.168.5.2

Ping 192.168.5.2: 32 data bytes, Press Ctrl_C to break

From 192.168.5.2: bytes=32 seq=1 ttl=124 time=78 ms

From 192.168.5.2: bytes=32 seq=2 ttl=124 time=47 ms

From 192.168.5.2: bytes=32 seq=3 ttl=124 time=78 ms

From 192.168.5.2: bytes=32 seq=4 ttl=124 time=79 ms

From 192.168.5.2: bytes=32 seq=5 ttl=124 time=62 ms