Implement separate tables for BGP (v4/v6) and OSPF

This commit is contained in:
graffen 2018-09-12 06:41:25 +00:00
parent 5dac863b90
commit e5c4ec7119
3 changed files with 54 additions and 26 deletions

View file

@ -1,3 +1,6 @@
table T_BGP4;
table T_OSPF;
protocol device { protocol device {
scan time 10; scan time 10;
} }
@ -38,7 +41,16 @@ template bgp dnpeers {
path metric 1; path metric 1;
# this lines allows debugging filter rules # this lines allows debugging filter rules
# filtered routes can be looked up in birdc using the "show route filtered" command # 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 { import filter {
# accept every subnet, except our own advertised subnet # accept every subnet, except our own advertised subnet
# filtering is important, because some guys try to advertise routes like 0.0.0.0 # filtering is important, because some guys try to advertise routes like 0.0.0.0
@ -55,9 +67,6 @@ template bgp dnpeers {
} }
reject; reject;
}; };
import limit 1000 action block;
#source address 172.20.170.192;
}; };
include "/etc/bird/peers4/*"; include "/etc/bird/peers4/*";

View file

@ -1,3 +1,5 @@
table T_BGP6;
protocol device { protocol device {
scan time 10; scan time 10;
} }
@ -36,23 +38,34 @@ protocol static {
} }
template bgp dnpeers { template bgp dnpeers {
table T_BGP6;
local as 4242423934; local as 4242423934;
path metric 1; path metric 1;
import keep filtered; import all;
import filter { export all;
if is_valid_network() && !is_self_net() then {
accept;
}
reject;
};
export filter {
if is_valid_network() then {
accept;
}
reject;
};
import limit 1000 action block; 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/*"; include "/etc/bird/peers6/*";

View file

@ -1,13 +1,7 @@
filter filter_OSPF {
ospf_metric1 = 1000;
if source = RTS_STATIC then accept;
else reject;
};
protocol ospf { protocol ospf {
table T_OSPF;
import all; import all;
export filter filter_OSPF; export all;
area 0 { area 0 {
interface "wg-ospf-*" { 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;
}