From e5c4ec7119ac725595f7fc3118a363c353375b7f Mon Sep 17 00:00:00 2001 From: graffen Date: Wed, 12 Sep 2018 06:41:25 +0000 Subject: [PATCH] Implement separate tables for BGP (v4/v6) and OSPF --- bird.conf | 17 +++++++++++++---- bird6.conf | 41 +++++++++++++++++++++++++++-------------- ospf.conf | 22 ++++++++++++++-------- 3 files changed, 54 insertions(+), 26 deletions(-) diff --git a/bird.conf b/bird.conf index 8709981..8b5fe9c 100644 --- a/bird.conf +++ b/bird.conf @@ -1,3 +1,6 @@ +table T_BGP4; +table T_OSPF; + protocol device { scan time 10; } @@ -38,7 +41,16 @@ template bgp dnpeers { path metric 1; # this lines allows debugging filter rules # filtered routes can be looked up in birdc using the "show route filtered" command - import keep filtered; + + table T_BGP4; + import all; + export all; + import limit 1000 action block; + #source address 172.20.170.192; +}; + +protocol pipe { + peer table T_BGP4; import filter { # accept every subnet, except our own advertised subnet # filtering is important, because some guys try to advertise routes like 0.0.0.0 @@ -55,9 +67,6 @@ template bgp dnpeers { } reject; }; - - import limit 1000 action block; - #source address 172.20.170.192; }; include "/etc/bird/peers4/*"; diff --git a/bird6.conf b/bird6.conf index b5b5d53..82f40c9 100644 --- a/bird6.conf +++ b/bird6.conf @@ -1,3 +1,5 @@ +table T_BGP6; + protocol device { scan time 10; } @@ -36,23 +38,34 @@ protocol static { } template bgp dnpeers { + table T_BGP6; local as 4242423934; path metric 1; - import keep filtered; - import filter { - if is_valid_network() && !is_self_net() then { - accept; - } - reject; - }; - - export filter { - if is_valid_network() then { - accept; - } - reject; - }; + import all; + export all; import limit 1000 action block; } +protocol pipe { + peer table T_BGP6; + import filter { + # accept every subnet, except our own advertised subnet + # filtering is important, because some guys try to advertise routes like 0.0.0$ + if is_valid_network() && !is_self_net() then { + accept; + } + reject; + }; + + export filter { + # here we export the whole net + if is_valid_network() then { + accept; + } + reject; + }; +}; + + + include "/etc/bird/peers6/*"; diff --git a/ospf.conf b/ospf.conf index 4833d53..6555ef2 100644 --- a/ospf.conf +++ b/ospf.conf @@ -1,13 +1,7 @@ -filter filter_OSPF { - ospf_metric1 = 1000; - if source = RTS_STATIC then accept; - else reject; -}; - - protocol ospf { + table T_OSPF; import all; - export filter filter_OSPF; + export all; area 0 { interface "wg-ospf-*" { @@ -18,3 +12,15 @@ protocol ospf { }; }; } + +filter filter_OSPF { + ospf_metric1 = 1000; + if source = RTS_STATIC then accept; + else reject; +}; + +protocol pipe { + peer table T_OSPF; + import all; + export filter filter_OSPF; +}