• 全部
  • 经验案例
  • 典型配置
  • 技术公告
  • FAQ
  • 漏洞说明
  • 全部
  • 全部
  • 大数据引擎
  • 知了引擎
产品线
搜索
取消
案例类型
发布者
是否解决
是否官方
时间
搜索引擎
匹配模式
高级搜索

需要ospf配置案例

2025-05-07提问
  • 0关注
  • 0收藏,430浏览
粉丝:0人 关注:0人

问题描述:

需要ospf配置案例

最佳答案

粉丝:32人 关注:1人

你好,参考这个

1.22  OSPF典型配置举例

1.22.1  OSPF基本功能配置举例

1. 组网需求

·     所有的路由器都运行OSPF,并将整个自治系统划分为3个区域。

·     其中Router A和Router B作为ABR来转发区域之间的路由。

·     配置完成后,每台路由器都应学到AS内的到所有网段的路由。

2. 组网图

图1-15 OSPF基本功能配置组网图

3. 配置步骤

(1)     配置各接口的IP地址(略)

(2)     配置OSPF基本功能

# 配置Router A。

<RouterA> system-view

[RouterA] router id 10.2.1.1

[RouterA] ospf

[RouterA-ospf-1] area 0

[RouterA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[RouterA-ospf-1-area-0.0.0.0] quit

[RouterA-ospf-1] area 1

[RouterA-ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255

[RouterA-ospf-1-area-0.0.0.1] quit

[RouterA-ospf-1] quit

# 配置Router B。

<RouterB> system-view

[RouterB] router id 10.3.1.1

[RouterB] ospf

[RouterB-ospf-1] area 0

[RouterB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[RouterB-ospf-1-area-0.0.0.0] quit

[RouterB-ospf-1] area 2

[RouterB-ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255

[RouterB-ospf-1-area-0.0.0.2] quit

[RouterB-ospf-1] quit

# 配置Router C。

<RouterC> system-view

[RouterC] router id 10.4.1.1

[RouterC] ospf

[RouterC-ospf-1] area 1

[RouterC-ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255

[RouterC-ospf-1-area-0.0.0.1] network 10.4.1.0 0.0.0.255

[RouterC-ospf-1-area-0.0.0.1] quit

[RouterC-ospf-1] quit

# 配置Router D。

<RouterD> system-view

[RouterD] router id 10.5.1.1

[RouterD] ospf

[RouterD-ospf-1] area 2

[RouterD-ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255

[RouterD-ospf-1-area-0.0.0.2] network 10.5.1.0 0.0.0.255

[RouterD-ospf-1-area-0.0.0.2] quit

[RouterD-ospf-1] quit

4. 验证配置

# 查看Router A的OSPF邻居。

[RouterA] display ospf peer verbose

 

          OSPF Process 1 with Router ID 10.2.1.1

                  Neighbors

 

 Area 0.0.0.0 interface 10.1.1.1(GigabitEthernet1/0/1)'s neighbors

 Router ID: 10.3.1.1         Address: 10.1.1.2         GR State: Normal

   State: Full  Mode: Nbr is master  Priority: 1

   DR: 10.1.1.1  BDR: 10.1.1.2  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 37  sec

   Neighbor is up for 06:03:59

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 5

   BFD status: Disabled

 

 Area 0.0.0.1 interface 10.2.1.1(GigabitEthernet1/0/2)'s neighbors

 Router ID: 10.4.1.1         Address: 10.2.1.2         GR State: Normal

   State: Full  Mode: Nbr is master  Priority: 1

   DR: 10.2.1.1  BDR: 10.2.1.2  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 32  sec

   Neighbor is up for 06:03:12

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 5

   BFD status: Disabled

# 查看Router A的OSPF路由信息。

[RouterA] display ospf routing

 

          OSPF Process 1 with Router ID 10.2.1.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 10.2.1.0/24        1        Transit 10.2.1.1        10.2.1.1        0.0.0.1

 10.3.1.0/24        2        Inter   10.1.1.2        10.3.1.1        0.0.0.0

 10.4.1.0/24        2        Stub    10.2.1.2        10.4.1.1        0.0.0.1

 10.5.1.0/24        3        Inter   10.1.1.2        10.3.1.1        0.0.0.0

 10.1.1.0/24        1        Transit 10.1.1.1        10.2.1.1        0.0.0.0

 

 Total nets: 5

 Intra area: 3  Inter area: 2  ASE: 0  NSSA: 0

# 查看Router D的OSPF路由信息。

[RouterD] display ospf routing

 

          OSPF Process 1 with Router ID 10.5.1.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 10.2.1.0/24         3       Inter   10.3.1.1        10.3.1.1        0.0.0.2

 10.3.1.0/24         1       Transit 10.3.1.2        10.3.1.1        0.0.0.2

 10.4.1.0/24         4       Inter   10.3.1.1        10.3.1.1        0.0.0.2

 10.5.1.0/24         1       Stub    10.5.1.1        10.5.1.1        0.0.0.2

 10.1.1.0/24         2       Inter   10.3.1.1        10.3.1.1        0.0.0.2

 

 Total nets: 5

 Intra area: 2  Inter area: 3  ASE: 0  NSSA: 0

# 在Router D上使用Ping测试连通性。

[RouterD] ping 10.4.1.1

Ping 10.4.1.1 (10.4.1.1): 56 data bytes, press CTRL+C to break

56 bytes from 10.4.1.1: icmp_seq=0 ttl=253 time=1.549 ms

56 bytes from 10.4.1.1: icmp_seq=1 ttl=253 time=1.539 ms

56 bytes from 10.4.1.1: icmp_seq=2 ttl=253 time=0.779 ms

56 bytes from 10.4.1.1: icmp_seq=3 ttl=253 time=1.702 ms

56 bytes from 10.4.1.1: icmp_seq=4 ttl=253 time=1.471 ms

 

--- Ping statistics for 10.4.1.1 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

round-trip min/avg/max/std-dev = 0.779/1.408/1.702/0.323 ms

1.22.2  OSPF引入自治系统外部路由配置举例

1. 组网需求

·     所有的路由器都运行OSPF,整个自治系统划分为3个区域。

·     其中Router A和Router B作为ABR来转发区域之间的路由。

·     在Router C上配置为ASBR引入外部路由(静态路由),且路由信息可正确的在AS内传播。

2. 组网图

图1-16 OSPF引入自治系统外部路由配置组网图

3. 配置步骤

(1)     配置各接口的IP地址(略)

(2)     配置OSPF(同前例“1.22.1  OSPF基本功能配置举例

(3)     配置引入自治系统外部路由

# 在Router C上配置一条到目的网段3.1.2.0/24的静态路由。

<RouterC> system-view

[RouterC] ip route-static 3.1.2.1 24 10.4.1.2

# 在Router C上配置OSPF引入静态路由。

[RouterC] ospf 1

[RouterC-ospf-1] import-route static

4. 验证配置

# 查看Router D的ABR/ASBR信息。

<RouterD> display ospf abr-asbr

 

          OSPF Process 1 with Router ID 10.5.1.1

                  Routing Table to ABR and ASBR

 

 Type    Destination     Area            Cost     Nexthop         RtType

 Intra   10.3.1.1        0.0.0.2         10       10.3.1.1        ABR

 Inter   10.4.1.1        0.0.0.2         22       10.3.1.1        ASBR

# 查看Router D的OSPF路由信息。

<RouterD> display ospf routing

 

          OSPF Process 1 with Router ID 10.5.1.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 10.2.1.0/24        22       Inter   10.3.1.1        10.3.1.1        0.0.0.2

 10.3.1.0/24        10       Transit 10.3.1.2        10.3.1.1        0.0.0.2

 10.4.1.0/24        25       Inter   10.3.1.1        10.3.1.1        0.0.0.2

 10.5.1.0/24        10       Stub    10.5.1.1        10.5.1.1        0.0.0.2

 10.1.1.0/24        12       Inter   10.3.1.1        10.3.1.1        0.0.0.2

 

 Routing for ASEs

 Destination        Cost     Type    Tag         NextHop         AdvRouter

 3.1.2.0/24         1        Type2   1           10.3.1.1        10.4.1.1

 

 Total nets: 6

 Intra area: 2  Inter area: 3  ASE: 1  NSSA: 0

1.22.3  OSPF发布聚合路由配置举例

1. 组网需求

·     Router A和Router B位于AS200内,AS200内使用OSPF作为IGP协议。

·     Router C、Router D和Router E位于AS100内,AS100内使用OSPF作为IGP协议。

·     Router B和Router C之间建立EBGP连接,配置BGP引入OSPF和直连路由,配置OSPF进程引入BGP路由。

·     为了减小Router A的路由表规模,在Router B上配置路由聚合,只发布聚合后的路由10.0.0.0/8。

2. 组网图

图1-17 OSPF发布聚合路由配置组网图

3. 配置步骤

(1)     配置接口的IP地址(略)

(2)     配置OSPF

# 配置Router A。

<RouterA> system-view

[RouterA] router id 11.2.1.2

[RouterA] ospf

[RouterA-ospf-1] area 0

[RouterA-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255

[RouterA-ospf-1-area-0.0.0.0] quit

[RouterA-ospf-1] quit

# 配置Router B。

<RouterB> system-view

[RouterB] router id 11.2.1.1

[RouterB] ospf

[RouterB-ospf-1] area 0

[RouterB-ospf-1-area-0.0.0.0] network 11.2.1.0 0.0.0.255

[RouterB-ospf-1-area-0.0.0.0] quit

[RouterB-ospf-1] quit

# 配置Router C。

<RouterC> system-view

[RouterC] router id 11.1.1.2

[RouterC] ospf

[RouterC-ospf-1] area 0

[RouterC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[RouterC-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255

[RouterC-ospf-1-area-0.0.0.0] quit

[RouterC-ospf-1] quit

# 配置Router D。

<RouterD> system-view

[RouterD] router id 10.3.1.1

[RouterD] ospf

[RouterD-ospf-1] area 0

[RouterD-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[RouterD-ospf-1-area-0.0.0.0] network 10.3.1.0 0.0.0.255

[RouterD-ospf-1-area-0.0.0.0] quit

[RouterD-ospf-1] quit

# 配置Router E。

<RouterE> system-view

[RouterE] router id 10.4.1.1

[RouterE] ospf

[RouterE-ospf-1] area 0

[RouterE-ospf-1-area-0.0.0.0] network 10.2.1.0 0.0.0.255

[RouterE-ospf-1-area-0.0.0.0] network 10.4.1.0 0.0.0.255

[RouterE-ospf-1-area-0.0.0.0] quit

[RouterE-ospf-1] quit

(3)     配置BGP,引入OSPF和直连路由

# 配置Router B。

[RouterB] bgp 200

[RouterB-bgp-default] peer 11.1.1.2 as-number 100

[RouterB-bgp-default] address-family ipv4 unicast

[RouterB-bgp-default-ipv4] peer 11.1.1.2 enable

[RouterB-bgp-default-ipv4] import-route ospf

[RouterB-bgp-default-ipv4] import-route direct

[RouterB-bgp-default-ipv4] quit

[RouterB-bgp-default] quit

# 配置Router C。

[RouterC] bgp 100

[RouterC-bgp-default] peer 11.1.1.1 as-number 200

[RouterC-bgp-default] address-family ipv4 unicast

[RouterC-bgp-default-ipv4] peer 11.1.1.1 enable

[RouterC-bgp-default-ipv4] import-route ospf

[RouterC-bgp-default-ipv4] import-route direct

[RouterB-bgp-default-ipv4] quit

[RouterC-bgp-default] quit

(4)     在Router B和Router C上配置OSPF引入BGP路由

# 在Router B上配置OSPF引入BGP路由。

[RouterB] ospf

[RouterB-ospf-1] import-route bgp

# 在Router C上配置OSPF引入BGP路由。

[RouterC] ospf

[RouterC-ospf-1] import-route bgp

# 查看Router A的路由表信息。

[RouterA] display ip routing-table

 

Destinations : 16        Routes : 16

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

0.0.0.0/32          Direct 0    0            127.0.0.1       InLoop0

10.1.1.0/24         O_ASE2 150  1            11.2.1.1        GE1/0/1

10.2.1.0/24         O_ASE2 150  1            11.2.1.1        GE1/0/1

10.3.1.0/24         O_ASE2 150  1            11.2.1.1        GE1/0/1

10.4.1.0/24         O_ASE2 150  1            11.2.1.1        GE1/0/1

11.2.1.0/24         Direct 0    0            11.2.1.2        GE1/0/1

11.2.1.0/32         Direct 0    0            11.2.1.2        GE1/0/1

11.2.1.2/32         Direct 0    0            127.0.0.1       InLoop0

11.2.1.255/32       Direct 0    0            11.2.1.2        GE1/0/1

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/32        Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

127.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0

224.0.0.0/4         Direct 0    0            0.0.0.0         NULL0

224.0.0.0/24        Direct 0    0            0.0.0.0         NULL0

255.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0

(5)     在Router B上配置路由聚合,只发布聚合路由10.0.0.0/8。

[RouterB-ospf-1] asbr-summary 10.0.0.0 8

# 查看Router A的路由表信息。

[RouterA] display ip routing-table

 

Destinations : 13        Routes : 13

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

0.0.0.0/32          Direct 0    0            127.0.0.1       InLoop0

10.0.0.0/8          O_ASE2 150  1            11.2.1.1        GE1/0/1

11.2.1.0/24         Direct 0    0            11.2.1.2        GE1/0/1

11.2.1.0/32         Direct 0    0            11.2.1.2        GE1/0/1

11.2.1.2/32         Direct 0    0            127.0.0.1       InLoop0

11.2.1.255/32       Direct 0    0            11.2.1.2        GE1/0/1

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.0/32        Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

127.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0

224.0.0.0/4         Direct 0    0            0.0.0.0         NULL0

224.0.0.0/24        Direct 0    0            0.0.0.0         NULL0

255.255.255.255/32  Direct 0    0            127.0.0.1       InLoop0

可以看出,路由10.1.1.0/24、10.2.1.0/24、10.3.1.0/24、10.4.1.0/24已经聚合为一条路由10.0.0.0/8。

1.22.4  OSPF Stub区域配置举例

1. 组网需求

·     所有的路由器都运行OSPF,整个自治系统划分为3个区域。

·     其中Router A和Router B作为ABR来转发区域之间的路由,Router D作为ASBR引入了外部路由(静态路由)。

·     要求将Area1配置为Stub区域,减少通告到此区域内的LSA数量,但不影响路由的可达性。

2. 组网图

图1-18 OSPF Stub区域配置组网图

3. 配置步骤

(1)     配置接口的IP地址(略)

(2)     配置OSPF(同前例“1.22.1  OSPF基本功能配置举例

(3)     配置Router D引入静态路由

<RouterD> system-view

[RouterD] ip route-static 3.1.2.1 24 10.5.1.2

[RouterD] ospf

[RouterD-ospf-1] import-route static

[RouterD-ospf-1] quit

# 查看Router C的ABR/ASBR信息。

<RouterC> display ospf abr-asbr

 

          OSPF Process 1 with Router ID 10.4.1.1

                  Routing Table to ABR and ASBR

 

 Type        Destination     Area            Cost  Nexthop         RtType

 Intra       10.2.1.1        0.0.0.1         3     10.2.1.1        ABR

 Inter       10.5.1.1        0.0.0.1         7     10.2.1.1        ASBR

# 查看Router C的OSPF路由表,可以看到路由表中存在AS外部的路由。

<RouterC> display ospf routing

 

          OSPF Process 1 with Router ID 10.4.1.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 10.2.1.0/24        3        Transit 0.0.0.0         10.2.1.1        0.0.0.1

 10.3.1.0/24        7        Inter   10.2.1.1        10.2.1.1        0.0.0.1

 10.4.1.0/24        3        Stub    10.4.1.1        10.4.1.1        0.0.0.1

 10.5.1.0/24        17       Inter   10.2.1.1        10.2.1.1        0.0.0.1

 10.1.1.0/24        5        Inter   10.2.1.1        10.2.1.1        0.0.0.1

 

 Routing for ASEs

 Destination        Cost     Type    Tag         NextHop         AdvRouter

 3.1.2.0/24         1        Type2   1           10.2.1.1        10.5.1.1

 

 Total nets: 6

 Intra area: 2  Inter area: 3  ASE: 1  NSSA: 0

(4)     配置Area1为Stub区域

# 配置Router A。

<RouterA> system-view

[RouterA] ospf

[RouterA-ospf-1] area 1

[RouterA-ospf-1-area-0.0.0.1] stub

[RouterA-ospf-1-area-0.0.0.1] quit

[RouterA-ospf-1] quit

# 配置Router C。

<RouterC> system-view

[RouterC] ospf

[RouterC-ospf-1] area 1

[RouterC-ospf-1-area-0.0.0.1] stub

[RouterC-ospf-1-area-0.0.0.1] quit

[RouterC-ospf-1] quit

# 查看Router C的OSPF路由表,已经看不到AS外部的路由,取而代之的是一条缺省路由。

[RouterC] display ospf routing

 

          OSPF Process 1 with Router ID 10.4.1.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 0.0.0.0/0          4        Inter   10.2.1.1        10.2.1.1        0.0.0.1

 10.2.1.0/24        3        Transit 0.0.0.0         10.2.1.1        0.0.0.1

 10.3.1.0/24        7        Inter   10.2.1.1        10.2.1.1        0.0.0.1

 10.4.1.0/24        3        Stub    10.4.1.1        10.4.1.1        0.0.0.1

 10.5.1.0/24        17       Inter   10.2.1.1        10.2.1.1        0.0.0.1

 10.1.1.0/24        5        Inter   10.2.1.1        10.2.1.1        0.0.0.1

 

 Total nets: 6

 Intra area: 2  Inter area: 4  ASE: 0  NSSA: 0

# 配置Area1为Totally Stub区域。

[RouterA] ospf

[RouterA-ospf-1] area 1

[RouterA-ospf-1-area-0.0.0.1] stub no-summary

[RouterA-ospf-1-area-0.0.0.1] quit

# 查看Router C的OSPF路由表,可以看到路由表项进一步减少,只保留了一条通往区域外部的缺省路由。

[RouterC] display ospf routing

 

          OSPF Process 1 with Router ID 10.4.1.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 0.0.0.0/0          4        Inter   10.2.1.1        10.2.1.1        0.0.0.1

 10.2.1.0/24        3        Transit 0.0.0.0         10.4.1.1        0.0.0.1

 10.4.1.0/24        3        Stub    10.4.1.1        10.4.1.1        0.0.0.1

 

 Total nets: 3

 Intra area: 2  Inter area: 1  ASE: 0  NSSA: 0

1.22.5  OSPF NSSA区域配置举例

1. 组网需求

·     所有的路由器都运行OSPF,整个自治系统划分为3个区域。

·     其中Router A和Router B作为ABR来转发区域之间的路由。

·     要求将Area1配置为NSSA区域,同时将Router C配置为ASBR引入外部路由(静态路由),且路由信息可正确的在AS内传播。

2. 组网图

图1-19 OSPF NSSA区域配置组网图

3. 配置步骤

(1)     配置各接口的IP地址(略)

(2)     配置OSPF(同前例“1.22.1  OSPF基本功能配置举例

(3)     配置Area1区域为NSSA区域

# 配置Router A。

<RouterA> system-view

[RouterA] ospf

[RouterA-ospf-1] area 1

[RouterA-ospf-1-area-0.0.0.1] nssa

[RouterA-ospf-1-area-0.0.0.1] quit

[RouterA-ospf-1] quit

# 配置Router C。

<RouterC> system-view

[RouterC] ospf

[RouterC-ospf-1] area 1

[RouterC-ospf-1-area-0.0.0.1] nssa

[RouterC-ospf-1-area-0.0.0.1] quit

[RouterC-ospf-1] quit

# 查看Router C的OSPF路由表。

[RouterC] display ospf routing

 

          OSPF Process 1 with Router ID 10.4.1.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 10.2.1.0/24        3        Transit 10.2.1.2        10.4.1.1        0.0.0.1

 10.3.1.0/24        7        Inter   10.2.1.1        10.2.1.1        0.0.0.1

 10.4.1.0/24        3        Stub    10.4.1.1        10.4.1.1        0.0.0.1

 10.5.1.0/24        17       Inter   10.2.1.1        10.2.1.1        0.0.0.1

 10.1.1.0/24        5        Inter   10.2.1.1        10.2.1.1        0.0.0.1

 

 Total nets: 5

 Intra area: 2  Inter area: 3  ASE: 0  NSSA: 0

(4)     配置Router C引入静态路由

[RouterC] ip route-static 3.1.2.1 24 10.4.1.2

[RouterC] ospf

[RouterC-ospf-1] import-route static

[RouterC-ospf-1] quit

# 查看Router D的OSPF路由表,可以看到NSSA区域引入了一条AS外部路由。

<RouterD> display ospf routing

 

          OSPF Process 1 with Router ID 10.5.1.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 10.2.1.0/24        22       Inter   10.3.1.1        10.3.1.1        0.0.0.2

 10.3.1.0/24        10       Transit 10.3.1.2        10.3.1.1        0.0.0.2

 10.4.1.0/24        25       Inter   10.3.1.1        10.3.1.1        0.0.0.2

 10.5.1.0/24        10       Stub    10.5.1.1        10.5.1.1        0.0.0.2

 10.1.1.0/24        12       Inter   10.3.1.1        10.3.1.1        0.0.0.2

 

 Routing for ASEs

 Destination        Cost     Type    Tag         NextHop         AdvRouter

 3.1.2.0/24         1        Type2   1           10.3.1.1        10.2.1.1

 

 Total nets: 6

 Intra area: 2  Inter area: 3  ASE: 1  NSSA: 0

1.22.6  OSPF的DR选择配置举例

1. 组网需求

·     Router A、Router B、Router C、Router D在同一网段,运行OSPF协议后Router D为DR,Router C为BDR。

·     改变路由器接口的DR优先级使Router A成为DR,Router C成为BDR。

图1-20 OSPF的DR选择配置组网图

2. 配置步骤

(1)     配置各接口的IP地址(略)

(2)     分别在Router A、Router B、Router C和Router D上配置OSPF基本功能(请参见“1.22.1  OSPF基本功能配置举例”)

(3)     运行OSPF后Router D为DR,可在Router A上通过display ospf peer verbose命令查看其邻居信息。

[RouterA] display ospf peer verbose

 

          OSPF Process 1 with Router ID 1.1.1.1

                  Neighbors

 

 Area 0.0.0.0 interface 192.168.1.1(GigabitEthernet1/0/1)'s neighbors

 Router ID: 2.2.2.2          Address: 192.168.1.2      GR State: Normal

   State: 2-Way  Mode: None  Priority: 1

   DR: 192.168.1.4  BDR: 192.168.1.3  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 38  sec

   Neighbor is up for 00:01:31

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

 

 Router ID: 3.3.3.3          Address: 192.168.1.3      GR State: Normal

   State: Full  Mode: Nbr is master  Priority: 1

   DR: 192.168.1.4  BDR: 192.168.1.3  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 31  sec

   Neighbor is up for 00:01:28

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

 

 Router ID: 4.4.4.4          Address: 192.168.1.4      GR State: Normal

   State: Full  Mode: Nbr is master  Priority: 1

   DR: 192.168.1.4  BDR: 192.168.1.3  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 31  sec

   Neighbor is up for 00:01:28

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

可以看到Router D为DR,Router C为BDR。

(4)     配置接口的DR优先级

# 配置Router A。

[RouterA] interface gigabitethernet 1/0/1

[RouterA-GigabitEthernet1/0/1] ospf dr-priority 100

[RouterA-GigabitEthernet1/0/1] quit

[RouterA] quit

# 配置Router B。

[RouterB] interface gigabitethernet 1/0/1

[RouterB-GigabitEthernet1/0/1] ospf dr-priority 0

[RouterB-GigabitEthernet1/0/1] quit

[RouterB] quit

# 配置Router C。

[RouterC] interface gigabitethernet 1/0/1

[RouterC-GigabitEthernet1/0/1] ospf dr-priority 2

[RouterC-GigabitEthernet1/0/1] quit

[RouterC] quit

# 查看Router D的邻居信息。

<RouterD> display ospf peer verbose

 

          OSPF Process 1 with Router ID 4.4.4.4

                  Neighbors

 

 Area 0.0.0.0 interface 192.168.1.4(GigabitEthernet1/0/1)'s neighbors

 Router ID: 1.1.1.1      Address: 192.168.1.1      GR State: Normal

   State: Full  Mode:Nbr is  slave  Priority: 100

   DR: 192.168.1.4  BDR: 192.168.1.3  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 31  sec

   Neighbor is up for 00:11:17

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

 

 Router ID: 2.2.2.2      Address: 192.168.1.2      GR State: Normal

   State: Full  Mode:Nbr is  slave  Priority: 0

   DR: 192.168.1.4  BDR: 192.168.1.3  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 35  sec

   Neighbor is up for 00:11:19

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

 

 Router ID: 3.3.3.3      Address: 192.168.1.3      GR State: Normal

   State: Full  Mode:Nbr is  slave  Priority: 2

   DR: 192.168.1.4  BDR: 192.168.1.3  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 33  sec

   Neighbor is up for 00:11:15

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

可以看到,网络中DR/BDR并没有改变。

说明

网络中DR/BDR已经存在的情况下,接口上的路由器优先级的配置并不会立即生效。

 

(5)     同时重启Router A、Router B、Router C和Router D上的OSPF进程

# 重启Router A的进程。

<RouterA> reset ospf 1 process

Warning : Reset OSPF process? [Y/N]:y

# 重启Router B的进程。

<RouterB> reset ospf 1 process

Warning : Reset OSPF process? [Y/N]:y

# 重启Router C的进程。

<RouterC> reset ospf 1 process

Warning : Reset OSPF process? [Y/N]:y

# 重启Router D的进程。

<RouterD> reset ospf 1 process

Warning : Reset OSPF process? [Y/N]:y

# 查看Router D的邻居信息。

<RouterD> display ospf peer verbose

 

          OSPF Process 1 with Router ID 4.4.4.4

                  Neighbors

 

 Area 0.0.0.0 interface 192.168.1.4(GigabitEthernet1/0/1)'s neighbors

 Router ID: 1.1.1.1          Address: 192.168.1.1      GR State: Normal

   State: Full  Mode: Nbr is slave  Priority: 100

   DR: 192.168.1.1  BDR: 192.168.1.3  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 39  sec

   Neighbor is up for 00:01:40

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

 

 Router ID: 2.2.2.2          Address: 192.168.1.2      GR State: Normal

   State: 2-Way  Mode: None  Priority: 0

   DR: 192.168.1.1  BDR: 192.168.1.3  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 35  sec

   Neighbor is up for 00:01:44

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

 

 Router ID: 3.3.3.3          Address: 192.168.1.3      GR State: Normal

   State: Full  Mode: Nbr is slave  Priority: 2

   DR: 192.168.1.1  BDR: 192.168.1.3  MTU: 0

   Options is 0x02 (-|-|-|-|-|-|E|-)

   Dead timer due in 39  sec

   Neighbor is up for 00:01:41

   Authentication Sequence: [ 0 ]

   Neighbor state change count: 6

   BFD status: Disabled

可以看到Router A成为DR,Router C为BDR。

说明

当路由器的邻居关系稳定后:

·     如果邻居的状态是Full,这说明它和邻居之间形成了邻接关系;

·     如果邻居的状态是2-Way,则说明它们都不是DR或BDR,两者之间不需要交换LSA。

 

# 查看OSPF接口的状态。

<RouterA> display ospf interface

 

          OSPF Process 1 with Router ID 1.1.1.1

                  Interfaces

 

 Area: 0.0.0.0

 IP Address      Type      State   Cost  Pri   DR             BDR

 192.168.1.1     Broadcast DR      1     100   192.168.1.1    192.168.1.3

[RouterB] display ospf interface

 

          OSPF Process 1 with Router ID 2.2.2.2

                  Interfaces

 

 Area: 0.0.0.0

 IP Address      Type      State    Cost  Pri   DR            BDR

 192.168.1.2     Broadcast DROther  1     0     192.168.1.1   192.168.1.3

说明

如果OSPF接口的状态是DROther,则说明它既不是DR,也不是BDR。

 

1.22.7  OSPF虚连接配置举例

1. 组网需求

·     Area2没有与Area0直接相连。Area1被用作传输区域(Transit Area)来连接Area2和Area0。Router B和Router C之间配置一条虚连接。

·     配置完成后,Router B能够学到Area2中的路由。

2. 组网图

图1-21 OSPF虚连接配置组网图

3. 配置步骤

(1)     配置各接口的IP地址(略)

(2)     配置OSPF基本功能

# 配置 Router A。

<RouterA> system-view

[RouterA] ospf 1 router-id 1.1.1.1

[RouterA-ospf-1] area 0

[RouterA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[RouterA-ospf-1-area-0.0.0.0] quit

[RouterA-ospf-1] quit

# 配置Router B。

<RouterB> system-view

[RouterB] ospf 1 router-id 2.2.2.2

[RouterB-ospf-1] area 0

[RouterB-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[RouterB-ospf-1-area-0.0.0.0] quit

[RouterB-ospf-1] area 1

[RouterB–ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255

[RouterB–ospf-1-area-0.0.0.1] quit

[RouterB-ospf-1] quit

# 配置Router C。

<RouterC> system-view

[RouterC] ospf 1 router-id 3.3.3.3

[RouterC-ospf-1] area 1

[RouterC-ospf-1-area-0.0.0.1] network 10.2.1.0 0.0.0.255

[RouterC-ospf-1-area-0.0.0.1] quit

[RouterC-ospf-1] area 2

[RouterC–ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255

[RouterC–ospf-1-area-0.0.0.2] quit

[RouterC-ospf-1] quit

# 配置Router D。

<RouterD> system-view

[RouterD] ospf 1 router-id 4.4.4.4

[RouterD-ospf-1] area 2

[RouterD-ospf-1-area-0.0.0.2] network 10.3.1.0 0.0.0.255

[RouterD-ospf-1-area-0.0.0.2] quit

[RouterD-ospf-1] quit

# 查看Router B的OSPF路由表。

[RouterB] display ospf routing

 

          OSPF Process 1 with Router ID 2.2.2.2

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 10.2.1.0/24        2        Transit 10.2.1.1        3.3.3.3         0.0.0.1

 10.1.1.0/24        2        Transit 10.1.1.2        2.2.2.2         0.0.0.0

 Total nets: 2

 Intra area: 2  Inter area: 0  ASE: 0  NSSA: 0

说明

由于Area0没有与Area2直接相连,所以Router B的路由表中没有Area 2的路由。

 

(3)     配置虚连接

# 配置Router B。

[RouterB] ospf

[RouterB-ospf-1] area 1

[RouterB-ospf-1-area-0.0.0.1] vlink-peer 3.3.3.3

[RouterB-ospf-1-area-0.0.0.1] quit

[RouterB-ospf-1] quit

# 配置Router C。

[RouterhC] ospf

[RouterC-ospf-1] area 1

[RouterC-ospf-1-area-0.0.0.1] vlink-peer 2.2.2.2

[RouterC-ospf-1-area-0.0.0.1] quit

[RouterC-ospf-1] quit

# 查看Router B的OSPF路由表。

[RouterB] display ospf routing

 

          OSPF Process 1 with Router ID 2.2.2.2

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 10.2.1.0/24        2        Transit 10.2.1.1        3.3.3.3         0.0.0.1

 10.3.1.0/24        5        Inter   10.2.1.2        3.3.3.3         0.0.0.0

 10.1.1.0/24        2        Transit 10.1.1.2        2.2.2.2         0.0.0.0

 

 Total nets: 3

 Intra area: 2  Inter area: 1  ASE: 0  NSSA: 0

可以看到,Router B已经学到了Area2的路由10.3.1.0/24。

1.22.8  OSPF GR配置举例

1. 组网需求

·     Router A、Router B和Router C既属于同一自治系统,也属于同一OSPF域,通过OSPF协议实现网络互连,并提供GR机制。

·     Router A作为非IETF标准GR Restarter,Router B和Router C作为GR Helper并且通过GR机制与Router A保持带外同步。

2. 组网图

图1-22 OSPF GR配置组网图

3. 配置步骤

(1)     配置各接口的IP地址(略)

(2)     配置OSPF基本功能

# 配置Router A。

<RouterA> system-view

[RouterA] router id 1.1.1.1

[RouterA] ospf 100

[RouterA-ospf-100] area 0

[RouterA-ospf-100-area-0.0.0.0] network 192.1.1.0 0.0.0.255

[RouterA-ospf-100-area-0.0.0.0] quit

[RouterA-ospf-100] quit

# 配置Router B。

<RouterB> system-view

[RouterB] router id 2.2.2.2

[RouterB] ospf 100

[RouterB-ospf-100] area 0

[RouterB-ospf-100-area-0.0.0.0] network 192.1.1.0 0.0.0.255

[RouterB-ospf-100-area-0.0.0.0] quit

[RouterB-ospf-100] quit

# 配置Router C。

<RouterC> system-view

[RouterC] router id 3.3.3.3

[RouterC] ospf 100

[RouterC-ospf-100] area 0

[RouterC-ospf-100-area-0.0.0.0] network 192.1.1.0 0.0.0.255

[RouterC-ospf-100-area-0.0.0.0] quit

[RouterC-ospf-100] quit

(3)     配置OSPF GR

# 配置Router A作为非IETF标准GR Restarter,即使能OSPF进程100的本地链路信令能力、OSPF带外同步能力和非IETF标准GR能力。

[RouterA-ospf-100] enable link-local-signaling

[RouterA-ospf-100] enable out-of-band-resynchronization

[RouterA-ospf-100] graceful-restart

[RouterA-ospf-100] quit

# 配置Router B作为GR Helper,即使能OSPF进程100的本地链路信令能力和OSPF带外同步能力。

[RouterB-ospf-100] enable link-local-signaling

[RouterB-ospf-100] enable out-of-band-resynchronization

# 配置Router C作为GR Helper,即使能OSPF进程100的本地链路信令能力和OSPF带外同步能力。

[RouterC-ospf-100] enable link-local-signaling

[RouterC-ospf-100] enable out-of-band-resynchronization

4. 验证配置

# 打开Router A的OSPF平滑启动事件调试信息开关。在Router A上以GR方式重启OSPF进程。

<RouterA> debugging ospf event graceful-restart

<RouterA> terminal monitor

<RouterA> terminal logging level 7

<RouterA> reset ospf 100 process graceful-restart

Reset OSPF process? [Y/N]:y

%Oct 21 15:29:28:727 2011 RouterA OSPF/5/OSPF_NBR_CHG: OSPF 100 Neighbor 192.1.1.2(GigabitEthernet1/0/1) from Full to Down.

%Oct 21 15:29:28:729 2011 RouterA OSPF/5/OSPF_NBR_CHG: OSPF 100 Neighbor 192.1.1.3(GigabitEthernet1/0/1) from Full to Down.

*Oct 21 15:29:28:735 2011 RouterA OSPF/7/DEBUG:

OSPF 100 nonstandard GR Started for OSPF Router

*Oct 21 15:29:28:735 2011 RouterA OSPF/7/DEBUG:

OSPF 100 created GR wait timer,timeout interval is 40(s).

*Oct 21 15:29:28:735 2011 RouterA OSPF/7/DEBUG:

OSPF 100 created GR Interval timer,timeout interval is 120(s).

*Oct 21 15:29:28:758 2011 RouterA OSPF/7/DEBUG:

OSPF 100 created OOB Progress timer for neighbor 192.1.1.3.

*Oct 21 15:29:28:766 2011 RouterA OSPF/7/DEBUG:

OSPF 100 created OOB Progress timer for neighbor 192.1.1.2.

%Oct 21 15:29:29:902 2011 RouterA OSPF/5/OSPF_NBR_CHG: OSPF 100 Neighbor 192.1.1.2(GigabitEthernet1/0/1) from Loading to Full.

*Oct 21 15:29:29:902 2011 RouterA OSPF/7/DEBUG:

OSPF 100 deleted OOB Progress timer for neighbor 192.1.1.2.

%Oct 21 15:29:30:897 2011 RouterA OSPF/5/OSPF_NBR_CHG: OSPF 100 Neighbor 192.1.1.3(GigabitEthernet1/0/1) from Loading to Full.

*Oct 21 15:29:30:897 2011 RouterA OSPF/7/DEBUG:

OSPF 100 deleted OOB Progress timer for neighbor 192.1.1.3.

*Oct 21 15:29:30:911 2011 RouterA OSPF/7/DEBUG:

OSPF GR: Process 100 Exit Restart,Reason : DR or BDR change,for neighbor : 192.1.1.3.

*Oct 21 15:29:30:911 2011 RouterA OSPF/7/DEBUG:

OSPF 100 deleted GR Interval timer.

*Oct 21 15:29:30:912 2011 RouterA OSPF/7/DEBUG:

OSPF 100 deleted GR wait timer.

%Oct 21 15:29:30:920 2011 RouterA OSPF/5/OSPF_NBR_CHG: OSPF 100 Neighbor 192.1.1.2(GigabitEthernet1/0/1) from Full to Down.

%Oct 21 15:29:30:921 2011 RouterA OSPF/5/OSPF_NBR_CHG: OSPF 100 Neighbor 192.1.1.3(GigabitEthernet1/0/1) from Full to Down.

%Oct 21 15:29:33:815 2011 RouterA OSPF/5/OSPF_NBR_CHG: OSPF 100 Neighbor 192.1.1.3(GigabitEthernet1/0/1) from Loading to Full.

%Oct 21 15:29:35:578 2011 RouterA OSPF/5/OSPF_NBR_CHG: OSPF 100 Neighbor 192.1.1.2(GigabitEthernet1/0/1) from Loading to Full.

从上面的信息可以看出Router A完成了GR。

1.22.9  OSPF NSR配置举例

1. 组网需求

Router S、Router A、Router B属于同一OSPF区域,通过OSPF协议实现网络互连。要求对Router S进行主备倒换时,Router A和Router B到Route S的邻居没有中断,Router A到Router B的流量没有中断。

2. 组网图

图1-23 OSPF NSR配置组网图

3. 配置步骤

(1)     配置各路由器接口的IP地址和OSPF协议

请按照上面组网图配置各接口的IP地址和子网掩码,具体配置过程略。

配置各路由器之间采用OSPF协议进行互连,确保Router S、Router A和Router B之间能够在网络层互通,并且各路由器之间能够借助OSPF协议实现动态路由更新。具体配置过程略。

(2)     配置OSPF NSR

# 使能Router S的OSPF NSR功能。

<RouterS> system-view

[RouterS] ospf 100

[RouterS-ospf-100] non-stop-routing

[RouterS-ospf-100] quit

4. 验证配置

# Router S进行主备倒换。

[RouterS] placement reoptimize

Predicted changes to the placement

Program                           Current location       New location

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

rib                               0/0                    0/0

staticroute                       0/0                    0/0

ospf                              0/0                    1/0

Continue? [y/n]:y

Re-optimization of the placement start. You will be notified on completion.

Re-optimization of the placement complete. Use 'display placement' to view the new placement.

# 查看Router A上OSPF协议的邻居和路由。

<RouterA> display ospf peer

 

          OSPF Process 1 with Router ID 2.2.2.1

               Neighbor Brief Information

 

 Area: 0.0.0.0

 Router ID       Address         Pri Dead-Time  State             Interface

 3.3.3.1         12.12.12.2      1   37         Full/BDR          GE1/0/1

<RouterA> display ospf routing

 

          OSPF Process 1 with Router ID 2.2.2.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 44.44.44.44/32     2        Stub    12.12.12.2      4.4.4.1         0.0.0.0

 14.14.14.0/24      2        Transit 12.12.12.2      4.4.4.1         0.0.0.0

 22.22.22.22/32     0        Stub    22.22.22.22     2.2.2.1         0.0.0.0

 12.12.12.0/24      1        Transit 12.12.12.1      2.2.2.1         0.0.0.0

 

 Total nets: 4

 Intra area: 4  Inter area: 0  ASE: 0  NSSA: 0

# 查看Router B上OSPF协议的邻居和路由。

<RouterB> display ospf peer

 

          OSPF Process 1 with Router ID 4.4.4.1

               Neighbor Brief Information

 

 Area: 0.0.0.0

 Router ID       Address         Pri Dead-Time  State             Interface

 3.3.3.1         14.14.14.2      1   39         Full/BDR          GE1/0/1

<RouterB> display ospf routing

 

          OSPF Process 1 with Router ID 4.4.4.1

                   Routing Table

 

 Routing for network

 Destination        Cost     Type    NextHop         AdvRouter       Area

 44.44.44.44/32     0        Stub    44.44.44.44     4.4.4.1         0.0.0.0

 14.14.14.0/24      1        Transit 14.14.14.1      4.4.4.1         0.0.0.0

 22.22.22.22/32     2        Stub    14.14.14.2      2.2.2.1         0.0.0.0

 12.12.12.0/24      2        Transit 14.14.14.2      2.2.2.1         0.0.0.0

 

 Total nets: 4

 Intra area: 4  Inter area: 0  ASE: 0  NSSA: 0

通过上面信息可以看出在Router S发生主备倒换的时候,Router A和Router B的邻居和路由信息保持不变,从Router A到Router B的流量转发没有受到主备倒换的影响。

1.22.10  OSPF与BFD联动配置举例

1. 组网需求

·     Router A、Router B和Router C上运行OSPF,网络层相互可达。

·     当Router A和Router B通过L2 Switch通信的链路出现故障时BFD能够快速感知通告OSPF协议,并且切换到Router C进行通信。

2. 组网图

图1-24 OSPF与BFD联动配置组网图

设备

接口

IP地址

设备

接口

IP地址

Router A

GE1/0/1

192.168.0.102/24

Router B

GE1/0/1

192.168.0.100/24

 

GE1/0/2

10.1.1.102/24

 

GE1/0/2

13.1.1.1/24

 

Loop0

121.1.1.1/32

 

Loop0

120.1.1.1/32

Router C

GE1/0/1

10.1.1.100/24

 

 

 

 

GE1/0/2

13.1.1.2/24

 

 

 

 

3. 配置步骤

(1)     配置各接口的IP地址(略)

(2)     配置OSPF基本功能

# 配置Router A。

<RouterA> system-view

[RouterA] ospf

[RouterA-ospf-1] area 0

[RouterA-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255

[RouterA-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[RouterA-ospf-1-area-0.0.0.0] network 121.1.1.1 0.0.0.0

[RouterA-ospf-1-area-0.0.0.0] quit

[RouterA-ospf-1] quit

# 配置Router B。

<RouterB> system-view

[RouterB] ospf

[RouterB-ospf-1] area 0

[RouterB-ospf-1-area-0.0.0.0] network 192.168.0.0 0.0.0.255

[RouterB-ospf-1-area-0.0.0.0] network 13.1.1.0 0.0.0.255

[RouterB-ospf-1-area-0.0.0.0] network 120.1.1.1 0.0.0.0

[RouterB-ospf-1-area-0.0.0.0] quit

[RouterB-ospf-1] quit

# 配置Router C。

<RouterC> system-view

[RouterC] ospf

[RouterC-ospf-1] area 0

[RouterC-ospf-1-area-0.0.0.0] network 10.1.1.0 0.0.0.255

[RouterC-ospf-1-area-0.0.0.0] network 13.1.1.0 0.0.0.255

[RouterC-ospf-1-area-0.0.0.0] quit

[RouterC-ospf-1] quit

(3)     配置BFD功能

# 在Router A上使能BFD检测功能,并配置BFD参数。

[RouterA] bfd session init-mode active

[RouterA] interface gigabitethernet 1/0/1

[RouterA-GigabitEthernet1/0/1] ospf bfd enable

[RouterA-GigabitEthernet1/0/1] bfd min-transmit-interval 500

[RouterA-GigabitEthernet1/0/1] bfd min-receive-interval 500

[RouterA-GigabitEthernet1/0/1] bfd detect-multiplier 7

[RouterA-GigabitEthernet1/0/1] quit

# 在Router B上使能BFD检测功能,并配置BFD参数。

[RouterB] bfd session init-mode active

[RouterB] interface gigabitethernet 1/0/1

[RouterB-GigabitEthernet1/0/1] ospf bfd enable

[RouterB-GigabitEthernet1/0/1] bfd min-transmit-interval 500

[RouterB-GigabitEthernet1/0/1] bfd min-receive-interval 500

[RouterB-GigabitEthernet1/0/1] bfd detect-multiplier 6

[RouterB-GigabitEthernet1/0/1] quit

4. 验证配置

下面以Router A为例,Router B和Router A类似,不再赘述。

# 查看BFD信息。

<RouterA> display bfd session

 Total sessions: 1        Up sessions: 1        Init mode: Active

 

 IPv4 session working in control packet mode:

 

 LD/RD           SourceIP        DestinationIP   State   Holdtime    Interface

 3/1             192.168.0.102   192.168.0.100   Up      1700ms      GE1/0/1

# 在Router A上查看120.1.1.1/32的路由信息,可以看出Router A和Router B是通过L2 Switch进行通信的。

<RouterA> display ip routing-table 120.1.1.1 verbose

 

Summary Count : 1

 

Destination: 120.1.1.1/32

    Protocol: O_INTRA

  Process ID: 1

   SubProtID: 0x1                       Age: 04h20m37s

        Cost: 1                  Preference: 10

       IpPre: N/A                QosLocalID: N/A

         Tag: 0                       State: Active Adv

   OrigTblID: 0x0                   OrigVrf: default-vrf

     TableID: 0x2                    OrigAs: 0

       NibID: 0x26000002             LastAs: 0

      AttrID: 0xffffffff           Neighbor: 0.0.0.0

       Flags: 0x1008c           OrigNextHop: 192.168.0.100

       Label: NULL              RealNextHop: 192.168.0.100

     BkLabel: NULL                BkNextHop: N/A

     SRLabel: NULL                Interface: GigabitEthernet1/0/1

   BkSRLabel: NULL              BkInterface: N/A

    SIDIndex: NULL                  InLabel: NULL

   Tunnel ID: Invalid           IPInterface: GigabitEthernet1/0/1

 BkTunnel ID: Invalid        BkIPInterface: N/A

    FtnIndex: 0x0            ColorInterface: N/A

TrafficIndex: N/A          BkColorInterface: N/A

   Connector: N/A                 VpnPeerId: N/A

        Dscp: N/A                       Exp: N/A

  SRTunnelID: Invalid             StatFlags: 0x0

    SID Type: N/A                       SID: N/A

       BkSID: N/A                       NID: Invalid

    FlushNID: Invalid                 BkNID: Invalid

  BkFlushNID: Invalid                PathID: 0x0

CommBlockLen: 0

  OrigLinkID: 0x0                RealLinkID: 0x0

当Router A和Router B通过L2 Switch通信的链路出现故障时:

# 查看120.1.1.1/32的路由信息,可以看出Router A和Router B已经切换到Router C进行通信。

<RouterA> display ip routing-table 120.1.1.1 verbose

 

Summary Count : 1

 

Destination: 120.1.1.1/32

    Protocol: O_INTRA

  Process ID: 1

   SubProtID: 0x1                       Age: 04h20m37s

        Cost: 2                  Preference: 10

       IpPre: N/A                QosLocalID: N/A

         Tag: 0                       State: Active Adv

   OrigTblID: 0x0                   OrigVrf: default-vrf

     TableID: 0x2                    OrigAs: 0

       NibID: 0x26000002             LastAs: 0

      AttrID: 0xffffffff           Neighbor: 0.0.0.0

       Flags: 0x1008c           OrigNextHop: 10.1.1.100

       Label: NULL              RealNextHop: 10.1.1.100

     BkLabel: NULL                BkNextHop: N/A

     SRLabel: NULL                Interface: GigabitEthernet1/0/2

   BkSRLabel: NULL              BkInterface: N/A

    SIDIndex: NULL                  InLabel: NULL

   Tunnel ID: Invalid           IPInterface: GigabitEthernet1/0/2

 BkTunnel ID: Invalid         BkIPInterface: N/ A

    FtnIndex: 0x0            ColorInterface: N/A

TrafficIndex: N/A          BkColorInterface: N/A

   Connector: N/A                 VpnPeerId: N/A

        Dscp: N/A                       Exp: N/A

  SRTunnelID: Invalid             StatFlags: 0x0

    SID Type: N/A                       SID: N/A

       BkSID: N/A                       NID: Invalid

    FlushNID: Invalid                 BkNID: Invalid

  BkFlushNID: Invalid                PathID: 0x0

CommBlockLen: 0

  OrigLinkID: 0x0                RealLinkID: 0x0

1.22.11  OSPF快速重路由配置举例

1. 组网需求

图1-25所示,Router A、Router B和Router C属于同一OSPF区域,通过OSPF协议实现网络互连。要求当Router A和Router B之间的链路出现故障时,业务可以快速切换到链路B上。

2. 组网图

图1-25 OSPF快速重路由配置组网图

设备

接口

IP地址

设备

接口

IP地址

Router A

GE1/0/1

12.12.12.1/24

Router B

GE1/0/1

24.24.24.4/24

 

GE1/0/2

13.13.13.1/24

 

GE1/0/2

13.13.13.2/24

 

Loop0

1.1.1.1/32

 

Loop0

4.4.4.4/32

Router C

GE1/0/1

12.12.12.2/24

 

 

 

 

GE1/0/2

24.24.24.2/24

 

 

 

 

3. 配置步骤

(1)     配置各路由器接口的IP地址和OSPF协议

请按照上面组网图配置各接口的IP地址和子网掩码,具体配置过程略。

配置各路由器之间采用OSPF协议进行互连,确保Router A、Router B和Router C之间能够在网络层互通,并且各路由器之间能够借助OSPF协议实现动态路由更新。

具体配置过程略。

(2)     配置OSPF快速重路由

OSPF支持快速重路由配置有两种配置方法,可以任选一种。

方法一:使能Router A和Router B的OSPF快速重路由功能(通过LFA算法选取备份下一跳信息)

# 配置Router A。

<RouterA> system-view

[RouterA] ospf 1

[RouterA-ospf-1] fast-reroute lfa

[RouterA-ospf-1] quit

# 配置Router B。

<RouterB> system-view

[RouterB] ospf 1

[RouterB-ospf-1] fast-reroute lfa

[RouterB-ospf-1] quit

方法二:使能Router A和Router B的OSPF快速重路由功能(通过路由策略指定备份下一跳)

# 配置Router A。

<RouterA> system-view

[RouterA] ip prefix-list abc index 10 permit 4.4.4.4 32

[RouterA] route-policy frr permit node 10

[RouterA-route-policy-frr-10] if-match ip address prefix-list abc

[RouterA-route-policy-frr-10] apply fast-reroute backup-interface gigabitethernet 1/0/1 backup-nexthop 12.12.12.2

[RouterA-route-policy-frr-10] quit

[RouterA] ospf 1

[RouterA-ospf-1] fast-reroute route-policy frr

[RouterA-ospf-1] quit

# 配置Router B。

<RouterB> system-view

[RouterB] ip prefix-list abc index 10 permit 1.1.1.1 32

[RouterB] route-policy frr permit node 10

[RouterB-route-policy-frr-10] if-match ip address prefix-list abc

[RouterB-route-policy-frr-10] apply fast-reroute backup-interface gigabitethernet 1/0/1 backup-nexthop 24.24.24.2

[RouterB-route-policy-frr-10] quit

[RouterB] ospf 1

[RouterB-ospf-1] fast-reroute route-policy frr

[RouterB-ospf-1] quit

4. 验证配置

# 在Router A上查看4.4.4.4/32路由,可以看到备份下一跳信息。

[RouterA] display ip routing-table 4.4.4.4 verbose

 

Summary Count : 1

 

Destination: 4.4.4.4/32

    Protocol: O_INTRA

  Process ID: 1

   SubProtID: 0x1                       Age: 04h20m37s

        Cost: 1                  Preference: 10

       IpPre: N/A                QosLocalID: N/A

         Tag: 0                       State: Active Adv

   OrigTblID: 0x0                   OrigVrf: default-vrf

     TableID: 0x2                    OrigAs: 0

       NibID: 0x26000002             LastAs: 0

      AttrID: 0xffffffff           Neighbor: 0.0.0.0

       Flags: 0x1008c           OrigNextHop: 13.13.13.2

       Label: NULL              RealNextHop: 13.13.13.2

     BkLabel: NULL                BkNextHop: 12.12.12.2

     SRLabel: NULL                Interface: GigabitEthernet1/0/2

    BkSRLabel: NULL             BkInterface: N/A

    SIDIndex: NULL                  InLabel: NULL

   Tunnel ID: Invalid           IPInterface: GigabitEthernet1/0/2

 BkTunnel ID: Invalid         BkIPInterface: GigabitEthernet1/0/1

    FtnIndex: 0x0            ColorInterface: N/A

TrafficIndex: N/A          BkColorInterface: N/A

   Connector: N/A                 VpnPeerId: N/A

        Dscp: N/A                       Exp: N/A

  SRTunnelID: Invalid             StatFlags: 0x0

    SID Type: N/A                       SID: N/A

       BkSID: N/A                       NID: Invalid

    FlushNID: Invalid                 BkNID: Invalid

  BkFlushNID: Invalid                PathID: 0x0

CommBlockLen: 0

  OrigLinkID: 0x0                RealLinkID: 0x0

# 在Router B上查看1.1.1.1/32路由,可以看到备份下一跳信息。

[RouterB] display ip routing-table 1.1.1.1 verbose

 

Summary Count : 1

 

Destination: 1.1.1.1/32

    Protocol: O_INTRA

  Process ID: 1

   SubProtID: 0x1                       Age: 04h20m37s

        Cost: 1                  Preference: 10

       IpPre: N/A                QosLocalID: N/A

         Tag: 0                       State: Active Adv

   OrigTblID: 0x0                   OrigVrf: default-vrf

     TableID: 0x2                    OrigAs: 0

       NibID: 0x26000002             LastAs: 0

      AttrID: 0xffffffff           Neighbor: 0.0.0.0

       Flags: 0x1008c           OrigNextHop: 13.13.13.1

       Label: NULL              RealNextHop: 13.13.13.1

     BkLabel: NULL                BkNextHop: 24.24.24.2

     SRLabel: NULL                Interface: GigabitEthernet1/0/2

    SIDIndex: NULL                  InLabel: NULL

   Tunnel ID: Invalid           IPInterface: GigabitEthernet1/0/2

 BkTunnel ID: Invalid         BkIPInterface: GigabitEthernet1/0/1

    FtnIndex: 0x0            ColorInterface: N/A

TrafficIndex: N/A          BkColorInterface: N/A

   Connector: N/A                 VpnPeerId: N/A

        Dscp: N/A                       Exp: N/A

  SRTunnelID: Invalid             StatFlags: 0x0

    SID Type: N/A                       SID: N/A

       BkSID: N/A                       NID: Invalid

    FlushNID: Invalid                 BkNID: Invalid

  BkFlushNID: Invalid                PathID: 0x0

CommBlockLen: 0

  OrigLinkID: 0x0                RealLinkID: 0x0


暂无评论

1 个回答
粉丝:2人 关注:6人

https://www.h3c.com/cn/d_202503/2386601_30005_0.htm

暂无评论

编辑答案

你正在编辑答案

如果你要对问题或其他回答进行点评或询问,请使用评论功能。

分享扩散:

提出建议

    +

亲~登录后才可以操作哦!

确定

亲~检测到您登陆的账号未在http://hclhub.h3c.com进行注册

注册后可访问此模块

跳转hclhub

你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作

举报

×

侵犯我的权益 >
对根叔社区有害的内容 >
辱骂、歧视、挑衅等(不友善)

侵犯我的权益

×

泄露了我的隐私 >
侵犯了我企业的权益 >
抄袭了我的内容 >
诽谤我 >
辱骂、歧视、挑衅等(不友善)
骚扰我

泄露了我的隐私

×

您好,当您发现根叔知了上有泄漏您隐私的内容时,您可以向根叔知了进行举报。 请您把以下内容通过邮件发送到pub.zhiliao@h3c.com 邮箱,我们会尽快处理。
  • 1. 您认为哪些内容泄露了您的隐私?(请在邮件中列出您举报的内容、链接地址,并给出简短的说明)
  • 2. 您是谁?(身份证明材料,可以是身份证或护照等证件)

侵犯了我企业的权益

×

您好,当您发现根叔知了上有关于您企业的造谣与诽谤、商业侵权等内容时,您可以向根叔知了进行举报。 请您把以下内容通过邮件发送到 pub.zhiliao@h3c.com 邮箱,我们会在审核后尽快给您答复。
  • 1. 您举报的内容是什么?(请在邮件中列出您举报的内容和链接地址)
  • 2. 您是谁?(身份证明材料,可以是身份证或护照等证件)
  • 3. 是哪家企业?(营业执照,单位登记证明等证件)
  • 4. 您与该企业的关系是?(您是企业法人或被授权人,需提供企业委托授权书)
我们认为知名企业应该坦然接受公众讨论,对于答案中不准确的部分,我们欢迎您以正式或非正式身份在根叔知了上进行澄清。

抄袭了我的内容

×

原文链接或出处

诽谤我

×

您好,当您发现根叔知了上有诽谤您的内容时,您可以向根叔知了进行举报。 请您把以下内容通过邮件发送到pub.zhiliao@h3c.com 邮箱,我们会尽快处理。
  • 1. 您举报的内容以及侵犯了您什么权益?(请在邮件中列出您举报的内容、链接地址,并给出简短的说明)
  • 2. 您是谁?(身份证明材料,可以是身份证或护照等证件)
我们认为知名企业应该坦然接受公众讨论,对于答案中不准确的部分,我们欢迎您以正式或非正式身份在根叔知了上进行澄清。

对根叔社区有害的内容

×

垃圾广告信息
色情、暴力、血腥等违反法律法规的内容
政治敏感
不规范转载 >
辱骂、歧视、挑衅等(不友善)
骚扰我
诱导投票

不规范转载

×

举报说明