Compare commits

...

4 Commits

Author SHA1 Message Date
graffen efb3c3506d Remove some commented-out lines 2018-09-12 09:16:29 +00:00
graffen d447df80a6 Typo in the local net definition 2018-09-12 09:13:49 +00:00
graffen 60e88aac72 Move BGP-specific config to separate file 2018-09-12 06:56:34 +00:00
graffen e5c4ec7119 Implement separate tables for BGP (v4/v6) and OSPF 2018-09-12 06:41:25 +00:00
5 changed files with 85 additions and 54 deletions

37
bgp.conf Normal file
View File

@ -0,0 +1,37 @@
template bgp dnpeers {
local as OWNAS;
table T_BGP4;
# metric is the number of hops between us and the peer
path metric 1;
# this line allows debugging filter rules
# filtered routes can be looked up in birdc using the "show route filtered" command
import keep filtered on;
import all;
export all;
#source address 172.20.170.192;
};
protocol pipe {
table master;
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$
if is_valid_network() && !is_self_net() then {
accept;
}
reject;
};
# import limit 1000 action block;
export filter {
# here we export the whole net
if is_valid_network() then {
accept;
}
reject;
};
};

View File

@ -1,9 +1,12 @@
log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug };
table T_BGP4;
table T_OSPF;
protocol device {
scan time 10;
}
protocol static {
route 172.20.0.0/14 via 172.20.170.192;
route 172.20.170.192/27 reject;
import all;
export none;
@ -21,8 +24,8 @@ protocol kernel {
scan time 20;
metric 64; # Use explicit kernel route metric to avoid collisions
# with non-BIRD routes in the kernel routing table
import keep filtered;
import none;
#export all; # Actually insert routes into the kernel routing table
export filter {
if source = RTS_STATIC then reject;
krt_prefsrc = OWNIP;
@ -31,33 +34,5 @@ protocol kernel {
}
include "/etc/bird/ospf.conf";
template bgp dnpeers {
local as OWNAS;
# metric is the number of hops between us and the peer
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;
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
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;
};
import limit 1000 action block;
#source address 172.20.170.192;
};
include "/etc/bird/bgp.conf";
include "/etc/bird/peers4/*";

View File

@ -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/*";

View File

@ -5,7 +5,7 @@ define OWNIP = 172.20.170.192;
define DN42_REGION = 41;
function is_self_net() {
return net ~ [172.20.170.192/27+];
return net ~ [172.20.170.192/27];
}
function is_valid_network() {

View File

@ -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;
}