【理论准备】 H3C 设备 OSPF 支持多进程,一台路由器上启动的多个 OSPF 进程之间由不同的进程

号区分。OSPF 进程号在启动 OSPF 时进行设置,它只在本地有效,不影响其它路由器之
间的报文交换。在同一个设备上不同进程之间无法交流路由信息,形同 2 个完全不同的协议
一样。
 
【实验拓扑及软件】
 
 

 

 

本文实验采用的交换机是H3C模拟器,下载地址如下:http://forum.h3c.com/forum.php?mod=viewthread&tid=109740&highlight=H3C%E6%A8%A1%E6%8B%9F%E5%99%A8

有兴趣的朋友可以在论坛上去下载。 

 

 

 

 

 

【配置步骤】

 

R5:

ospf 100 router-id 10.1.1.1

 area 0.0.0.0

  network 2.2.2.0 0.0.0.3

  network 1.1.1.1 0.0.0.0

 

 

R1:

ospf 100 router-id 10.1.1.2

 area 0.0.0.0

  network 2.2.2.0 0.0.0.3

#               

ospf 200 router-id 10.1.1.2

 area 0.0.0.0

  network 3.3.3.0 0.0.0.3

#

 

 

R2:

 

ospf 200 router-id 10.1.1.3

 area 0.0.0.0   

  network 4.4.4.0 0.0.0.3

  network 3.3.3.0 0.0.0.3

 

 

R4:

ospf 200 router-id 10.1.1.4

 area 0.0.0.0

  network 4.4.4.0 0.0.0.3

  network 5.5.5.1 0.0.0.0

 

 

 

【测试结果】

配置完成以上步骤后我们来观察各路由表的路由情况

 

R5

 

<R5>DIS IP routing-table 

Routing Tables: Public

        Destinations : 7        Routes : 7

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0

2.2.2.0/30          Direct 0    0            2.2.2.2         S0/6/3

2.2.2.1/32          Direct 0    0            2.2.2.1         S0/6/3

2.2.2.2/32          Direct 0    0            127.0.0.1       InLoop0

10.1.1.1/32         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

 

 

 

R1

 

[R1] DIS IP RO

Routing Tables: Public

        Destinations : 12       Routes : 12

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.1.1.1/32          OSPF   10   1562         2.2.2.2         S0/6/3

2.2.2.0/30          Direct 0    0            2.2.2.1         S0/6/3

2.2.2.1/32          Direct 0    0            127.0.0.1       InLoop0

2.2.2.2/32          Direct 0    0            2.2.2.2         S0/6/3

3.3.3.0/30          Direct 0    0            3.3.3.1         S0/6/0

3.3.3.1/32          Direct 0    0            127.0.0.1       InLoop0

3.3.3.2/32          Direct 0    0            3.3.3.2         S0/6/0

4.4.4.0/30          OSPF   10   3124         3.3.3.2         S0/6/0

5.5.5.1/32          OSPF   10   3124         3.3.3.2         S0/6/0

10.1.1.2/32         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

 

[R1]dis ospf 100 ro

 

         OSPF Process 100 with Router ID 10.1.1.2

                  Routing Tables 

 

 Routing for Network 

 Destination        Cost     Type    NextHop         AdvRouter       Area

 2.2.2.0/30         1562     Stub    2.2.2.1         10.1.1.2        0.0.0.0

 1.1.1.1/32         1562     Stub    2.2.2.2         10.1.1.1        0.0.0.0

 

 Total Nets: 2  

 Intra Area: 2  Inter Area: 0  ASE: 0  NSSA: 0 

 

[R1]dis ospf 200 ro

 

         OSPF Process 200 with Router ID 10.1.1.2

                  Routing Tables 

 

 Routing for Network 

 Destination        Cost     Type    NextHop         AdvRouter       Area

 5.5.5.1/32         3124     Stub    3.3.3.2         10.1.1.4        0.0.0.0

 4.4.4.0/30         3124     Stub    3.3.3.2         10.1.1.3        0.0.0.0

 3.3.3.0/30         1562     Stub    3.3.3.1         10.1.1.2        0.0.0.0

 

 Total Nets: 3  

 Intra Area: 3  Inter Area: 0  ASE: 0  NSSA: 0 

 

[R1]dis ospf 100 lsdb

 

         OSPF Process 100 with Router ID 10.1.1.2

                 Link State Database 

 

                         Area: 0.0.0.0

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 Router    10.1.1.2        10.1.1.2          1171  48    80000002       0

 Router    10.1.1.1        10.1.1.1          1177  60    80000003       0

 

[R1]dis ospf 200 lsdb

 

         OSPF Process 200 with Router ID 10.1.1.2

                 Link State Database 

 

                         Area: 0.0.0.0

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 Router    10.1.1.4        10.1.1.4           890  60    80000003       0

 Router    10.1.1.3        10.1.1.3           894  72    80000009       0

 Router    10.1.1.2        10.1.1.2           958  48    80000007       0

 

 

R2

<R2>dis ip ro

Routing Tables: Public

        Destinations : 10       Routes : 10

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

3.3.3.0/30          Direct 0    0            3.3.3.2         S0/6/0

3.3.3.1/32          Direct 0    0            3.3.3.1         S0/6/0

3.3.3.2/32          Direct 0    0            127.0.0.1       InLoop0

4.4.4.0/30          Direct 0    0            4.4.4.1         S0/6/1

4.4.4.1/32          Direct 0    0            127.0.0.1       InLoop0

4.4.4.2/32          Direct 0    0            4.4.4.2         S0/6/1

5.5.5.1/32          OSPF   10   1562         4.4.4.2         S0/6/1

10.1.1.3/32         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

 

<R2>dis ospf ro

 

         OSPF Process 100 with Router ID 10.1.1.3

                  Routing Tables 

 

 Total Nets: 0  

 Intra Area: 0  Inter Area: 0  ASE: 0  NSSA: 0 

 

 

         OSPF Process 200 with Router ID 10.1.1.3

                  Routing Tables 

 

 Routing for Network 

 Destination        Cost     Type    NextHop         AdvRouter       Area

 5.5.5.1/32         1562     Stub    4.4.4.2         10.1.1.4        0.0.0.0

 4.4.4.0/30         1562     Stub    4.4.4.1         10.1.1.3        0.0.0.0

 3.3.3.0/30         1562     Stub    3.3.3.2         10.1.1.3        0.0.0.0

 

 Total Nets: 3  

 Intra Area: 3  Inter Area: 0  ASE: 0  NSSA: 0 

 

<R2>dis ospf lsdb

 

         OSPF Process 100 with Router ID 10.1.1.3

                 Link State Database 

 

 

         OSPF Process 200 with Router ID 10.1.1.3

                 Link State Database 

 

                         Area: 0.0.0.0

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 Router    10.1.1.4        10.1.1.4           927  60    80000003       0

 Router    10.1.1.3        10.1.1.3           931  72    80000009       0

 Router    10.1.1.2        10.1.1.2           998  48    80000007       

 

R4

 

<R4>dis ip ro

Routing Tables: Public

        Destinations : 8        Routes : 8

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

3.3.3.0/30          OSPF   10   3124         4.4.4.1         S0/6/1

4.4.4.0/30          Direct 0    0            4.4.4.2         S0/6/1

4.4.4.1/32          Direct 0    0            4.4.4.1         S0/6/1

4.4.4.2/32          Direct 0    0            127.0.0.1       InLoop0

5.5.5.1/32          Direct 0    0            127.0.0.1       InLoop0

10.1.1.4/32         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

 

<R4>dis ospf ro

 

         OSPF Process 200 with Router ID 10.1.1.4

                  Routing Tables 

 

 Routing for Network 

 Destination        Cost     Type    NextHop         AdvRouter       Area

 5.5.5.1/32         0        Stub    5.5.5.1         10.1.1.4        0.0.0.0

 4.4.4.0/30         1562     Stub    4.4.4.2         10.1.1.4        0.0.0.0

 3.3.3.0/30         3124     Stub    4.4.4.1         10.1.1.3        0.0.0.0

 

 Total Nets: 3  

 Intra Area: 3  Inter Area: 0  ASE: 0  NSSA: 0 

 

<R4>dis ospf lsdb

 

         OSPF Process 200 with Router ID 10.1.1.4

                 Link State Database 

 

                         Area: 0.0.0.0

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 Router    10.1.1.4        10.1.1.4           942  60    80000003       0

 Router    10.1.1.3        10.1.1.3           948  72    80000009       0

 Router    10.1.1.2        10.1.1.2          1015  48    80000007       0

 

<R4>

【进程互引配置】

进程引入配置:

[R1]ospf 100                                                                

[R1-ospf-100]import-route ospf 200 

[R1-ospf-100]import-route direct                                          

[R1-ospf-100]q                                                              

[R1]ospf 200                                                                                 

[R1-ospf-200]import-route ospf 100 

[R1-ospf-200]import-route direct

 

注;在引入路由的时候一定要携带进程号;

不管在什么时候引入路由一定要引入直连路由

 

 

测试:

R5:

<R5>dis ip ro

Routing Tables: Public

        Destinations : 12       Routes : 12

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0

2.2.2.0/30          Direct 0    0            2.2.2.2         S0/6/3

2.2.2.1/32          Direct 0    0            2.2.2.1         S0/6/3

2.2.2.2/32          Direct 0    0            127.0.0.1       InLoop0

3.3.3.0/30          O_ASE  150  1            2.2.2.1         S0/6/3

3.3.3.2/32          O_ASE  150  1            2.2.2.1         S0/6/3

4.4.4.0/30          O_ASE  150  1            2.2.2.1         S0/6/3

5.5.5.1/32          O_ASE  150  1            2.2.2.1         S0/6/3

10.1.1.1/32         Direct 0    0            127.0.0.1       InLoop0

10.1.1.2/32         O_ASE  150  1            2.2.2.1         S0/6/3

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

 

<R5>

<R5>

<R5>ping -a 1.1.1.1 5.5.5.1

  PING 5.5.5.1: 56  data bytes, press CTRL_C to break

    Reply from 5.5.5.1: bytes=56 Sequence=1 ttl=253 time=26 ms

    Reply from 5.5.5.1: bytes=56 Sequence=2 ttl=253 time=4 ms

    Reply from 5.5.5.1: bytes=56 Sequence=3 ttl=253 time=1 ms

    Request time out

    Reply from 5.5.5.1: bytes=56 Sequence=5 ttl=253 time=1 ms

 

  --- 5.5.5.1 ping statistics ---

    5 packet(s) transmitted

    4 packet(s) received

    20.00% packet loss

    round-trip min/avg/max = 1/8/26 ms

 

<R5>

 

R1:

[R1]dis ip ro

Routing Tables: Public

        Destinations : 12       Routes : 12

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.1.1.1/32          OSPF   10   1562         2.2.2.2         S0/6/3

2.2.2.0/30          Direct 0    0            2.2.2.1         S0/6/3

2.2.2.1/32          Direct 0    0            127.0.0.1       InLoop0

2.2.2.2/32          Direct 0    0            2.2.2.2         S0/6/3

3.3.3.0/30          Direct 0    0            3.3.3.1         S0/6/0

3.3.3.1/32          Direct 0    0            127.0.0.1       InLoop0

3.3.3.2/32          Direct 0    0            3.3.3.2         S0/6/0

4.4.4.0/30          OSPF   10   3124         3.3.3.2         S0/6/0

5.5.5.1/32          OSPF   10   3124         3.3.3.2         S0/6/0

10.1.1.2/32         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

 

[R1]

[R1]dis ospf lsdb

 

         OSPF Process 100 with Router ID 10.1.1.2

                 Link State Database 

 

                         Area: 0.0.0.0

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 Router    10.1.1.2        10.1.1.2           234  48    80000003       0

 Router    10.1.1.1        10.1.1.1           106  60    80000004       0

 

                 AS External Database

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 External  5.5.5.1         10.1.1.2           234  36    80000001       1

 External  4.4.4.0         10.1.1.2           234  36    80000001       1

 External  3.3.3.0         10.1.1.2           230  36    80000001       1

 External  3.3.3.2         10.1.1.2           230  36    80000001       1

 External  2.2.2.0         10.1.1.2           230  36    80000001       1

 External  2.2.2.2         10.1.1.2           230  36    80000001       1

 External  10.1.1.2        10.1.1.2           230  36    80000001       1

 

 

         OSPF Process 200 with Router ID 10.1.1.2

                 Link State Database 

 

                         Area: 0.0.0.0

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 Router    10.1.1.4        10.1.1.4          1513  60    80000003       0

 Router    10.1.1.3        10.1.1.3          1517  72    80000009       0

 Router    10.1.1.2        10.1.1.2           221  48    80000008       0

 

                 AS External Database

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 External  3.3.3.0         10.1.1.2           218  36    80000001       1

 External  3.3.3.2         10.1.1.2           218  36    80000001       1

 External  2.2.2.0         10.1.1.2           218  36    80000001       1

 External  2.2.2.2         10.1.1.2           218  36    80000001       1

 External  10.1.1.2        10.1.1.2           218  36    80000001       1

 External  1.1.1.1         10.1.1.2           221  36    80000001       1

 

 

 

R2:

<R2>DIS IP RO

<R2>DIS IP routing-table 

Routing Tables: Public

        Destinations : 14       Routes : 14

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.1.1.1/32          O_ASE  150  1            3.3.3.1         S0/6/0

2.2.2.0/30          O_ASE  150  1            3.3.3.1         S0/6/0

2.2.2.2/32          O_ASE  150  1            3.3.3.1         S0/6/0

3.3.3.0/30          Direct 0    0            3.3.3.2         S0/6/0

3.3.3.1/32          Direct 0    0            3.3.3.1         S0/6/0

3.3.3.2/32          Direct 0    0            127.0.0.1       InLoop0

4.4.4.0/30          Direct 0    0            4.4.4.1         S0/6/1

4.4.4.1/32          Direct 0    0            127.0.0.1       InLoop0

4.4.4.2/32          Direct 0    0            4.4.4.2         S0/6/1

5.5.5.1/32          OSPF   10   1562         4.4.4.2         S0/6/1

10.1.1.2/32         O_ASE  150  1            3.3.3.1         S0/6/0

10.1.1.3/32         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

 

<R2>DIS OSPF LSDB

 

         OSPF Process 100 with Router ID 10.1.1.3

                 Link State Database 

 

 

         OSPF Process 200 with Router ID 10.1.1.3

                 Link State Database 

 

                         Area: 0.0.0.0

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 Router    10.1.1.4        10.1.1.4          1485  60    80000003       0

 Router    10.1.1.3        10.1.1.3          1489  72    80000009       0

 Router    10.1.1.2        10.1.1.2           196  48    80000008       0

 

                 AS External Database

 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric

 External  3.3.3.0         10.1.1.2           193  36    80000001       1

 External  3.3.3.2         10.1.1.2           193  36    80000001       1

 External  2.2.2.0         10.1.1.2           193  36    80000001       1

 External  2.2.2.2         10.1.1.2           193  36    80000001       1

 External  10.1.1.2        10.1.1.2           193  36    80000001       1

 External  1.1.1.1         10.1.1.2           196  36    80000001       1

 

R4:

<R4>dis ip ro

Routing Tables: Public

        Destinations : 13       Routes : 13

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.1.1.1/32          O_ASE  150  1            4.4.4.1         S0/6/1

2.2.2.0/30          O_ASE  150  1            4.4.4.1         S0/6/1

2.2.2.2/32          O_ASE  150  1            4.4.4.1         S0/6/1

3.3.3.0/30          OSPF   10   3124         4.4.4.1         S0/6/1

3.3.3.2/32          O_ASE  150  1            4.4.4.1         S0/6/1

4.4.4.0/30          Direct 0    0            4.4.4.2         S0/6/1

4.4.4.1/32          Direct 0    0            4.4.4.1         S0/6/1

4.4.4.2/32          Direct 0    0            127.0.0.1       InLoop0

5.5.5.1/32          Direct 0    0            127.0.0.1       InLoop0

10.1.1.2/32         O_ASE  150  1            4.4.4.1         S0/6/1

10.1.1.4/32         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

 

<R4>

<R4>

<R4>ping -a 5.5.5.1 1.1.1.1

  PING 1.1.1.1: 56  data bytes, press CTRL_C to break

    Reply from 1.1.1.1: bytes=56 Sequence=1 ttl=253 time=19 ms

    Reply from 1.1.1.1: bytes=56 Sequence=2 ttl=253 time=25 ms

    Reply from 1.1.1.1: bytes=56 Sequence=3 ttl=253 time=5 ms

    Request time out

    Reply from 1.1.1.1: bytes=56 Sequence=5 ttl=253 time=10 ms

 

  --- 1.1.1.1 ping statistics ---

    5 packet(s) transmitted

    4 packet(s) received

    20.00% packet loss

    round-trip min/avg/max = 5/14/25 ms

 

<R4>

 

 

【配置文件】