Debian

BIRD 中的 OSPF 路由成本

  • July 26, 2017

我正在將任播 OSPF 路由 BIND 冗餘設置從 Quagga 遷移到 BIRD。

我的困難之一是通過 BIRD 獲得幾條不同成本的路線,就像我在 quagga 中一樣。

就像在 Quagga 我正在做的那樣/etc/quagga/ospfd.conf

interface dummy0
ip ospf cost 100
!
interface dummy1
ip ospf cost 500
!
interface dummy2
ip ospf cost 1000
!
interface dummy3
ip ospf cost 900
!

我可以在birdc使用命令時show ospf state看到我的配置沒有賦予權重,儘管在/etc/bird.conf. 該怎麼辦?

protocol ospf {
       tick 2;
       rfc1583compat yes;

       area 0.0.0.0 {

       networks {
           1.1.1.0/22;
           2.2.2.2/32;
           3.3.3.3/32;
           4.4.4.4/32;
           5.5.5.5/32;
       };

               interface "eth0" {

                       cost 1000;
                       password "xxxxxxxxxx" {
                           id 5;
                       };
                       authentication cryptographic; 
               };

               interface "dummy0" {
                       stub;
                       cost 100;
               };
               interface "dummy1" {
                       stub;
                       cost 500;
               };
               interface "dummy2" {
                       stub;
                       cost 1000;
               };
               interface "dummy3" {
                       stub;
                       cost 900;
               };

       };
}

我最終從我在 BIRD 用語中show ospf state所指的輸出中學習,並在一個晦澀的問題中找到了正確的語法和位置。stubnet

因此,在這種情況下,OSPF 在最後為特定路由提供成本的配置是在 OSPF 區域定義中定義一個宣佈網路的 stubnet 完成的,如下所示:

protocol ospf {
    tick 2;
       rfc1583compat yes;

       area 0.0.0.0 {
       #stub;
       networks {
           1.1.1.0/22;
       };
               stubnet 2.2.2.2/32 {
                   cost 100;
               };
               stubnet 3.3.3.3/32 {
               cost 500;   
       };
               stubnet 4.4.4.4/32 {
           cost 1000;
       };
               stubnet 5.5.5.5/32 {
           cost 900;
       };
               interface "eth0" {

                       cost 1000;
                       password "xxxxxxxxxxxxxxxxxxxx" {
                          id 5;
                       };
                       authentication cryptographic; 
               };

               interface "dummy0" {
                       stub;
               };
               interface "dummy1" {
                       stub;
               };
               interface "dummy2" {
                       stub;
               };
               interface "dummy3" {
                       stub;
               };

       };
}

通過使用可以看出birdc,它起作用了:

dns:/etc/bird# birdc
BIRD 1.6.3 ready.
bird> show ospf state
bird> 
area 0.0.0.0
.....................

   router 1.1.1.1
       distance 1000
       network 1.1.1.0/22 metric 1000
       stubnet 4.4.4.4/32 metric 1000
       stubnet 5.5.5.5/32 metric 900
       stubnet 3.3.3.3/32 metric 500
       stubnet 2.2.2.2/32 metric 100

.................

dns:/etc/bird# exit

引用自:https://unix.stackexchange.com/questions/381905