• 全部
  • 經驗案例
  • 典型配置
  • 技術公告
  • FAQ
  • 漏洞說明
  • 全部
  • 全部
  • 大數據引擎
  • 知了引擎
產品線
搜索
取消
案例類型
發布者
是否解決
是否官方
時間
搜索引擎
匹配模式
高級搜索

需要ospf配置案例

2025-05-07提問
  • 0關注
  • 0收藏,997瀏覽
粉絲:0人 關注:0人

問題描述:

需要ospf配置案例

最佳答案

粉絲:42人 關注: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人 關注:7人

//www.yolosolive.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. 您是誰?(身份證明材料,可以是身份證或護照等證件)
我們認為知名企業應該坦然接受公眾討論,對於答案中不準確的部分,我們歡迎您以正式或非正式身份在根叔知了上進行澄清。

對根叔社區有害的內容

×

垃圾廣告信息
色情、暴力、血腥等違反法律法規的內容
政治敏感
不規範轉載 >
辱罵、歧視、挑釁等(不友善)
騷擾我
誘導投票

不規範轉載

×

舉報說明