BIRD笔记

多路由表同步

bird版本:bird1.6

使用pipe可以将bird中的各个路由表的路由进行互导。配置示例中将bird中的master表路由同步到的3000这张内核表。

  • 首先新建一张bird内部路由表,默认是路由表为master;
  • 使用pipe协议将master表中的路由导入到新建的表中
  • 同步新增的bird路由表到系统内核表中

配置示例:

# 学习直连路由
protocol direct {
 interface "*";
}

# 默认的内核路由表
protocol kernel {
  scan time 20;
  import none;
  export filter {    
    if source = RTS_STATIC then reject;
    krt_prefsrc = OWNIP;
    accept;
  };
};
# 新增一个bird路由表名为mynet
table mynet;
# 配置路由同步到内核表汇总,这里将mynet表中的路由同步到内核表3000中
protocol kernel {
  # 开启直连路由同步
  device routes on;
  table mynet;
  kernel table 3000;
  scan time 20;
  export filter {
    if source = RTS_STATIC then reject;
    krt_prefsrc = OWNIP;
    accept;
  };
}
# 使用管道同步master表路由到mynet表中
protocol pipe {
  table master;
  peer table mynet;
  export all;
}

配置IBGP

设置下一跳属性为自身,因为IBGP从EBGP学习到的路由转发给其他IBGP时,默认没有更改下一跳属性,有的IBGP下一跳可能不可达;

配置direct直连,iBGP如果是直接连接的,要配置direct避免 multihop 被指定,造成路由unreachable

protocol bgp as64516_home_gw from dnpeers {
  next hop self; # 设置下一跳属性为自身,因为IBGP从EBGP学习到的路由转发给其他IBGP时,默认没有更改下一跳属性,有的IBGP下一跳可能不可达
  direct;  # 与peer建立IBGP连接时开启
  neighbor 10.10.4.2 as 64516;
};

输出多条等价路由

merge paths on;通常,只有最佳路由会导出到内核协议。启用路径合并后,最佳路由和等效非最佳路由会在导出期间合并,为每个网络生成一条 ECMP(等价多路径)路由。

protocol kernel {
  scan time 20;
  import none;
  merge paths on;
  export filter {
    if source = RTS_STATIC then reject;
    krt_prefsrc = OWNIP;
    accept;
  };
};
上一篇
下一篇