OSPF缺省路由發佈

1.area1爲普通區域時:
[RTA]ip route-static 0.0.0.0 0 12.12.12.2
[RTA-ospf-1]dis th
#
ospf 1 router-id 1.1.1.1 
 default-route-advertise
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255
或者
[RTA-ospf-1]default-route-advertise always //aways表示強制
DIS OSPF LSDB查看每臺路由器的lsdb,發現每臺路由器都產生了一條五類的缺省路由
例如:<RTD>dis ospf lsdb 
         OSPF Process 1 with Router ID 4.4.4.4
                 Link State Database 
                         Area: 0.0.0.2
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    3.3.3.3         3.3.3.3            873  48    80000002       0
 Router    4.4.4.4         4.4.4.4            872  48    80000002       0
 Sum-Net   23.23.23.0      3.3.3.3            901  28    80000001    1562
 Sum-Net   12.12.12.0      3.3.3.3            901  28    80000001    3124
 Sum-Asbr  1.1.1.1         3.3.3.3            821  28    80000001    3124
                 AS External Database
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 External  0.0.0.0         1.1.1.1            828  36    80000001       1
2.area1stub區域時:
RTA,RTBarea1裏配置stub
[RTA-ospf-1]dis th
#
ospf 1 router-id 1.1.1.1 
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255 
  stub 
[RTB-ospf-1]dis th
#
ospf 1 router-id 2.2.2.2 
 import-route direct
 area 0.0.0.0 
  network 23.23.23.0 0.0.0.255 
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255 
  stub 
查看area1lsdb
[RTA-ospf-1]dis ospf lsdb 
         OSPF Process 1 with Router ID 1.1.1.1
                 Link State Database 
                         Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    1.1.1.1         1.1.1.1            230  48    80000003       0
 Router    2.2.2.2         2.2.2.2            305  48    80000002       0
 Sum-Net   0.0.0.0         2.2.2.2            311  28    80000001       1
 Sum-Net   34.34.34.0      2.2.2.2            306  28    80000001    3124
 Sum-Net   23.23.23.0      2.2.2.2            306  28    80000001    1562
發現只有stub區域裏的路由器存在一條三類的缺省路由
[RTB-ospf-1-area-0.0.0.1]stub no-summary //area1改成完全stub區域
可以通過查看ospf的鏈路狀態數據庫發現,現象與stub區域時一樣,完全stub區域內存在一條3類的缺省路由
3.area1nssa時:
[RTA]dis cu | in ip ro
 ip route-static 0.0.0.0 0.0.0.0 12.12.12.2
[RTA]dis cu conf ospf 
#
ospf 1 router-id 1.1.1.1
 area 0.0.0.1
  network 12.12.12.0 0.0.0.255
  nssa default-route-advertise
#
第一種情況,在asbr上配置,必須有一條默認路由,才能使nssa區域產生一條7類的缺省路由
[RTA]dis ospf lsdb 
         OSPF Process 1 with Router ID 1.1.1.1
                 Link State Database 
                         Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    1.1.1.1         1.1.1.1            231  48    80000003       0
 Router    2.2.2.2         2.2.2.2            260  48    80000002       0
 Sum-Net   34.34.34.0      2.2.2.2            262  28    80000001    3124
 Sum-Net   23.23.23.0      2.2.2.2            262  28    80000001    1562
 NSSA      0.0.0.0         1.1.1.1            197  36    80000001       1
第二種情況在abr上配置:
[RTB-ospf-1-area-0.0.0.1]dis th
#
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255 
  nssa default-route-advertise
這種情況無需先做出缺省路由,並且自動產生一條7類的缺省路由
現在加工下nssa變成完全nssa區域:
[RTB-ospf-1]dis th
#
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 23.23.23.0 0.0.0.255 
 area 0.0.0.1 
  network 12.12.12.0 0.0.0.255 
  nssa no-summary
可以發現,完全nssaasbr自動產生了三類的默認路由
[RTA]dis ip routing-table 
Routing Tables: Public
        Destinations : 7        Routes : 7
Destination/Mask    Proto  Pre  Cost         NextHop         Interface
0.0.0.0/0           OSPF   10   1563         12.12.12.2      S0/2/0
1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0
12.12.12.0/24       Direct 0    0            12.12.12.1      S0/2/0
12.12.12.1/32       Direct 0    0            127.0.0.1       InLoop0
12.12.12.2/32       Direct 0    0            12.12.12.2      S0/2/0
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
[RTA]dis ospf lsdb 
         OSPF Process 1 with Router ID 1.1.1.1
                 Link State Database 
                         Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    1.1.1.1         1.1.1.1             99  48    80000006       0
 Router    2.2.2.2         2.2.2.2            104  48    80000004       0
 Sum-Net   0.0.0.0         2.2.2.2            108  28    80000001       1
小結:1.普通區域產生的默認路由都是5類的lsa,在asbr上操作,可以分爲強制和手寫兩種
      2.特殊區域自動產生的都是默認路由都是三類lsa
      3.特殊區域只有nssa區域需要手動配置,產生7類的lsa的默認路由,分爲兩種情況
Asbr配置+默認路由或者abr配置
後記:默認路由在網絡中用處很大,往往擔當着重要角色,據統計,9成的路由設備都含有默認路由,ospf作爲igp王者,缺省路由的配置我們理所當然應該掌握!
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章