[BGP]使用Bird-BGP推静态路由给路由器

[toc]
最近御坂网络增加了新的结点,想把新节点所在地区的流量都转移过来,大概有几万条,OSPF还是RIP处理不了,动不动就BOOM了,所以就用了骚操作用两个私有ASN建立私有BGP网络来执行策略路由

新节点配置

vi bird.conf

log syslog all;
router id 0.0.0.233;
include "/etc/bird_static4.conf";
include "/etc/bird_static6.conf";
protocol device {
        scan time 10;
}
protocol bfd {
        interface "ens*" {
                min rx interval 200 ms;
                interval 200 ms;
                multiplier 5;
        };
}
protocol kernel {
        learn;
        merge paths;
        scan time 10;
        ipv4 {
                import filter{
                        if net = 0.0.0.0/0 then {
                                reject;
                        }
                        accept;
                };
                export filter{
                        if source = RTS_STATIC then {
                            reject;
                        }
                        accept;
                };
        };
}
protocol kernel {
        learn;
        merge paths;
        scan time 10;
        ipv6 {
                import filter{
                        if net = ::/0 then {
                                reject;
                        }
                        if net = ::/96 then {
                                reject;
                        }
                        accept;
                };
                export filter{
                        if source = RTS_STATIC then {
                            reject;
                        }
                        accept;
                };
        };
}
protocol bgp {
        local 192.0.0.233 as 65530;
        neighbor 192.168.0.1 as 65530;
        interface "ens*";
        direct;
        ipv4 {
                export all;
                import all;
                next hop self;
        };
        ipv6 {
                export all;
                import all;
                next hop self;
                missing lladdr self;
        };
}
protocol bgp {
        local 192.168.0.1 as 65530;
        neighbor 192.168.0.2 as 65530;
        interface "ens*";
        direct;
        ipv4 {
                export all;
                import all;
                next hop self;
        };
        ipv6 {
                export all;
                import all;
                next hop self;
                missing lladdr self;
        };
}


bird_static4

protocol static {
 ipv4{};
 route 8.0.0.0/16 via 192.168.2.1;//节点所在位置的网段走节点网关
 }

bird_static6

protocol static {
 ipv6{};
 route 2001:da8::/32 via 240c::aabb;//最好不要填本地链路地址
 }

边缘节点

要点

  • 与节点连接使用ASN1
  • 与本地接连链接使用ASN2推给本地路由
  • 记得开始转发其他BGP消息

Tips

  • 记得加NAT

《[BGP]使用Bird-BGP推静态路由给路由器》上有1条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注