initial commit for rpi.home.0l.de

This commit is contained in:
Steffen Vogel 2020-08-22 01:30:59 +01:00
commit f0134bf5a0
14 changed files with 565 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
icvpn-meta/
passwords.conf

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "icvpn-scripts"]
path = icvpn-scripts
url = https://github.com/freifunk/icvpn-scripts.git

27
bird.conf Normal file
View file

@ -0,0 +1,27 @@
log syslog all;
router id 172.23.157.3;
timeformat base iso long;
timeformat log iso long;
timeformat protocol iso long;
timeformat route iso long;
include "/etc/bird/constants.conf";
include "/etc/bird/passwords.conf";
include "/etc/bird/communities.conf";
include "/etc/bird/tables.conf";
include "/etc/bird/filters/*.conf";
include "/etc/bird/templates/*.conf";
include "/etc/bird/protocols/*.conf";
protocol device {
}
protocol direct {
ipv4;
ipv6;
interface "fritzbox", "home", "fritzbox", "wg-*";
}

54
communities.conf Normal file
View file

@ -0,0 +1,54 @@
define cymru_fullbogons = (65332, 888);
# Well-known: https://www.iana.org/assignments/bgp-well-known-communities/bgp-well-known-communities.xhtml
define wk_graceful_shutdown = (0xffff, 0x0000); # RFC8326
define wk_accept_own = (0xffff, 0x0001); # RFC7611
define wk_blackhole = (0xffff, 0x029a); # RFC7999
define wk_no_export = (0xffff, 0xff01); # RFC1997
define wk_no_advertise = (0xffff, 0xff02); # RFC1997
define wk_no_export_subconfed = (0xffff, 0xff03); # RFC1997
define wk_nopeer = (0xffff, 0xff04); # RFC3765
# See https://www.euro-ix.net/en/forixps/large-bgp-communities/
# Informational RS:1000-1999:*
## Informational tags RS:1000-1099:*
define informational_rpki_valid = (my_ripe_asn, 1000, 1);
define informational_rpki_unknown = (my_ripe_asn, 1000, 2);
define informational_rpki_not_checked = (my_ripe_asn, 1000, 3);
define informational_rpki_invalid = (my_ripe_asn, 1000, 4);
define informational_rpki_invalid_origin_as = (my_ripe_asn, 1000, 5);
define informational_rpki_invalid_max_length = (my_ripe_asn, 1000, 6);
define informational_irrdb_valid = (my_ripe_asn, 1001, 1);
define informational_irrdb_not_checked = (my_ripe_asn, 1001, 2);
define informational_irrdb_more_specific = (my_ripe_asn, 1001, 3);
define informational_irrdb_prefix_not_found_in_as_set = (my_ripe_asn, 1001, 4);
define informational_irrdb_invalid_origin_as = (my_ripe_asn, 1001, 5);
define informational_irrdb_invalid_prefix_for_origin_as = (my_ripe_asn, 1001, 6);
# Filtered reasons: RS:1100-1199:*
## Route was filtered on import RS:1101:*
define filtered_import_prefix_too_long = (my_ripe_asn, 1101, 1);
define filtered_import_prefix_too_short = (my_ripe_asn, 1101, 2);
define filtered_import_bogon_prefix = (my_ripe_asn, 1101, 3);
define filtered_import_bogon_as = (my_ripe_asn, 1101, 4);
define filtered_import_as_path_too_long = (my_ripe_asn, 1101, 5);
define filtered_import_as_path_too_short = (my_ripe_asn, 1101, 6);
define filtered_import_first_as_not_peer = (my_ripe_asn, 1101, 7);
define filtered_import_next_hop_not_peer = (my_ripe_asn, 1101, 8);
define filtered_import_irrdb_prefix_not_in_as_set = (my_ripe_asn, 1101, 9);
define filtered_import_origin_as_not_in_peer_as_set = (my_ripe_asn, 1101, 10);
define filtered_import_prefix_not_found_in_origin_as = (my_ripe_asn, 1101, 11);
define filtered_import_prefix_is_rpki_unknown = (my_ripe_asn, 1101, 12);
define filtered_import_prefix_is_rpki_invalid = (my_ripe_asn, 1101, 13);
define filtered_import_transit_free_asn_in_as_path = (my_ripe_asn, 1101, 14);
define filtered_import_too_many_bgp_communities = (my_ripe_asn, 1101, 15);
# Route was filtered on export RS:1102:*
define filtered_export_advertising_peer_declines_prefix = (my_ripe_asn, 1102, 1);
define filtered_export_declined_from_advertising_peer = (my_ripe_asn, 1102, 2);
define filtered_export_too_many_bgp_communities = (my_ripe_asn, 1102, 3);

4
constants.conf Normal file
View file

@ -0,0 +1,4 @@
define my_ripe_asn = 207613;
define my_dn42_asn = 4242422428;
define fb_gw = 172.23.156.193;

229
filters/common.conf Normal file
View file

@ -0,0 +1,229 @@
# Sources:
# http://www.us.ntt.net/support/policy/routing.cfm#bogon
# http://as2914.net/bogon_asns/configuration_examples.txt
# https://www.de-cix.net/en/locations/germany/frankfurt/routeserver-guide
# https://archive.nanog.org/sites/default/files/Snijders_Everyday_Practical_Bgp.pdf
# http://bgpfilterguide.nlnog.net/
# https://gitlab.labs.nic.cz/labs/bird/-/wikis/BGP_filtering
function is_mine_ripe() {
return net ~ [
2a09:11c0:200::/44+,
2a0e:97c7:100::/44+,
2a09:4c2:1b::/48+,
31.47.232.64/29+
];
}
function is_mine_dn42() {
return net ~ [
172.23.156.0/23+,
fd42:4dd0:ff00::/48+
];
}
function is_mine() {
return is_mine_dn42() || is_mine_ripe();
}
# Big transit / tier 1 ASNs for "peerlock"
function is_big_asn(int asnum) {
return asnum ~ [
174, # Cogent
209, # Qwest (HE carries this on IXPs IPv6 (Jul 12 2018))
701, # UUNET
702, # UUNET
1239, # Sprint
1299, # Telia
2914, # NTT Communications
3257, # GTT Backbone
3320, # Deutsche Telekom AG (DTAG)
3356, # Level3
3549, # Level3
3561, # Savvis / CenturyLink
4134, # Chinanet
5511, # Orange opentransit
6453, # Tata Communications
6461, # Zayo Bandwidth
6762, # Seabone / Telecom Italia
7018 # AT&T
];
}
# Source: https://wiki.freifunk.net/AS-Nummern
function is_freifunk_asn(int asnum) {
return asnum ~ [ 64856..65534 ];
}
# Source: https://dn42.net/services/Whois
function is_dn42_asn(int asnum) {
return asnum ~ [ 4242420000..4242429999 ];
}
function is_bogon_asn(int asnum) {
return asnum ~ [
0, # RFC7607: Codification of AS 0 Processing
23456, # RFC6793: AS_TRANS for 32bit extendend ASN range
64496..64511, # RFC5398: Reservation for Documentation Use 16bit ASN
64512..65534, # RFC6996: Reservation for Private Use 16bit ASN
65535, # RFC7300: Reservation of Last ASNs
65536..65551, # RFC5398: Reservation for Documentation Use 32bit ASN
65552..131071, # IANA reserved ASNs https://www.mail-archive.com/uknof@lists.uknof.org.uk/msg03395.html
4200000000..4294967294, # RFC6996: Reservation for Private Use 32bit ASN
4294967295 # RFC7300: Reservation of Last ASNs
];
}
# RFC 1918
function is_private_v4() {
return net ~ [
10.0.0.0/8+,
172.16.0.0/12+,
192.168.0.0/16+
];
}
function is_private_v6() {
return net ~ [
fc00::/7+ # RFC4193: Unique-Local
];
}
function is_peering_lan_v4() {
return net ~ [
185.1.119.0/24+, # LocIX Frankfurt
80.81.192.0/21+, # DE-CIX Frankfurt
185.1.125.0/24+, # 4IXP / 4b42
206.81.104.0/24+, # EVIX
193.189.82.0/23+ # KleyRex
];
}
function is_peering_lan_v6() {
return net ~ [
2a07:1c44:61f0::/64+, # LocIX Frankfurt
2001:7f8::/64+, # DE-CIX Frankfurt
2001:7f8:d0:b901::/64+, # 4IXP / 4b42
2001:7f8:d0:4b42::/64+, # 4IXP / 4b42
2602:fed2:fff:ffff::/64, # EVIX
2001:7f8:33::/48+ # KleyRex
];
}
function is_martian_v4() {
# See RFC6890
return is_private_v4() ||
net ~ [
0.0.0.0/8+, # RFC1122: This host on this network
100.64.0.0/10+, # RFC6598: IANA-Reserved IPv4 Prefix for Shared Address Space
127.0.0.0/8+, # RFC1122: Loopback
192.18.0.0/15+, # RFC2544: Benchmarking Methodology for Network Interconnect Devices
169.254.0.0/16+, # RFC3927: Dynamic Configuration of IPv4 Link-Local Addresses
192.0.0.0/24+, # RFC6890: IETF Protocol Assignments
192.0.0.0/29+, # RFC6333: DS-Lite
192.0.2.0/24+, # RFC5737: IPv4 Address Blocks Reserved for Documentation (TEST-NET-1)
198.51.100.0/24+, # RFC5737: IPv4 Address Blocks Reserved for Documentation (TEST-NET-2)
192.88.99.0/24+, # RFC3068: 6to4 Relay Anycast
203.0.113.0/24+, # RFC5737: IPv4 Address Blocks Reserved for Documentation (TEST-NET-3)
224.0.0.0/4+, # RFC5771: IPv4 Multicast
240.0.0.0/4+, # RFC1112: Reserved for Future Use
255.255.255.255/32 # RFC0919: Limited Broadcast
];
}
function is_martian_v6() {
# See RFC6890
return is_private_v6() ||
net ~ [
::ffff:0:0/96+, # RFC4291: IPv4-mapped Address
::ffff:0:0:0/96+, # IPv4 translated
::/128, # RFC4291: Unspecified Address
::1/128, # RFC4291: Loopback Address
64:ff9b::/96+, # RFC6052: IPv4-IPv6 Translated (NAT64)
100::/64+, # RFC6666: Discard-Only Address Block
2001::/23+, # RFC2928: IETF Protocol Assignments
2001::/32+, # RFC4380: TEREDO
2001:2::/48+, # RFC5180: Benchmarking
2001:10::/28+, # RFC4843: ORCHID
2001:db8::/32+, # RFC3849: Documentation
2002::/16+, # RFC3056: 6to4
fe80::/10+, # RFC4291: Linked-Scoped Unicast
ff00::/8+ # RFC2373/3306: IPv6 Multicast
];
}
function is_default_v4() {
return net = 0.0.0.0/0;
}
function is_default_v6() {
return net ~ ::/0;
}
function is_bogon_ebgp_v4() {
if net.len > 24 then { # RFC7454
bgp_large_community.add(filtered_import_prefix_too_long);
return true;
}
if is_martian_v4() then {
return true;
}
if is_peering_lan_v4() then {
return true;
}
if bgp_path.first != my_ripe_asn then {
return true;
}
if bgp_path.len > 32 then {
bgp_large_community.add(filtered_import_as_path_too_long);
return true;
}
if net.len < 8 then { # RFC7454
bgp_large_community.add(filtered_import_prefix_too_short);
return true;
}
return false;
}
function is_bogon_ebgp_v6() {
if net.len > 48 then { # RFC7454
bgp_large_community.add(filtered_import_prefix_too_long);
return true;
}
if is_martian_v6() then
return true;
if is_peering_lan_v6() then
return true;
#if is_bogon_asn() then
# return true;
if bgp_path.first != my_ripe_asn then {
bgp_large_community.add(filtered_import_first_as_not_peer);
return true;
}
if bgp_path.len > 32 then {
bgp_large_community.add(filtered_import_as_path_too_long);
return true;
}
if net.len < 19 then { # RFC7454
bgp_large_community.add(filtered_import_prefix_too_short);
return true;
}
return false;
}

44
filters/ibgp.conf Normal file
View file

@ -0,0 +1,44 @@
function ibgp_export_v4()
bool ok;
{
ok = true;
if net.len = 32 then
ok = false;
return ok;
}
function ibgp_export_v6()
bool ok;
{
ok = true;
if net.len = 128 then
ok = false;
return ok;
}
function ibgp_import_v4()
bool ok;
{
ok = true;
# if net = 0.0.0.0/0 then
# ok = false;
return ok;
}
function ibgp_import_v6()
bool ok;
{
ok = true;
# if ! is_mine() then
# ok = false;
return ok;
}

53
netflix_v4.conf Normal file
View file

@ -0,0 +1,53 @@
route 23.246.0.0/18 via fb_gw;
route 23.246.15.0/24 via fb_gw;
route 23.246.20.0/24 via fb_gw;
route 23.246.28.0/24 via fb_gw;
route 23.246.29.0/24 via fb_gw;
route 23.246.30.0/24 via fb_gw;
route 23.246.31.0/24 via fb_gw;
route 23.246.50.0/24 via fb_gw;
route 23.246.51.0/24 via fb_gw;
route 23.246.52.0/24 via fb_gw;
route 23.246.55.0/24 via fb_gw;
route 37.77.184.0/21 via fb_gw;
route 37.77.184.0/23 via fb_gw;
route 37.77.186.0/23 via fb_gw;
route 37.77.186.0/24 via fb_gw;
route 37.77.187.0/24 via fb_gw;
route 37.77.188.0/23 via fb_gw;
route 45.57.0.0/17 via fb_gw;
route 45.57.16.0/24 via fb_gw;
route 45.57.17.0/24 via fb_gw;
route 45.57.42.0/24 via fb_gw;
route 45.57.60.0/24 via fb_gw;
route 45.57.72.0/24 via fb_gw;
route 45.57.73.0/24 via fb_gw;
route 45.57.74.0/24 via fb_gw;
route 45.57.75.0/24 via fb_gw;
route 45.57.78.0/24 via fb_gw;
route 45.57.79.0/24 via fb_gw;
route 64.120.128.0/17 via fb_gw;
route 66.197.128.0/17 via fb_gw;
route 69.53.224.0/19 via fb_gw;
route 69.53.242.0/24 via fb_gw;
route 108.175.32.0/20 via fb_gw;
route 108.175.47.0/24 via fb_gw;
route 185.2.220.0/22 via fb_gw;
route 185.2.220.0/24 via fb_gw;
route 185.2.221.0/24 via fb_gw;
route 185.9.188.0/22 via fb_gw;
route 192.173.64.0/18 via fb_gw;
route 198.38.96.0/19 via fb_gw;
route 198.38.116.0/24 via fb_gw;
route 198.38.117.0/24 via fb_gw;
route 198.38.118.0/24 via fb_gw;
route 198.38.119.0/24 via fb_gw;
route 198.38.120.0/24 via fb_gw;
route 198.38.121.0/24 via fb_gw;
route 198.45.48.0/20 via fb_gw;
route 208.75.76.0/22 via fb_gw;
route 208.75.76.0/24 via fb_gw;
route 208.75.77.0/24 via fb_gw;
route 208.75.78.0/24 via fb_gw;
route 208.75.79.0/24 via fb_gw;

37
netflix_v6.conf Normal file
View file

@ -0,0 +1,37 @@
route 2607:fb10::/32 via fb_gw;
route 2620:10c:7000::/44 via fb_gw;
route 2a00:86c0::/32 via fb_gw;
route 2a00:86c0:4::/48 via fb_gw;
route 2a00:86c0:5::/48 via fb_gw;
route 2a00:86c0:116::/48 via fb_gw;
route 2a00:86c0:117::/48 via fb_gw;
route 2a00:86c0:118::/48 via fb_gw;
route 2a00:86c0:119::/48 via fb_gw;
route 2a00:86c0:120::/48 via fb_gw;
route 2a00:86c0:121::/48 via fb_gw;
route 2a00:86c0:126::/48 via fb_gw;
route 2a00:86c0:127::/48 via fb_gw;
route 2a00:86c0:1018::/48 via fb_gw;
route 2a00:86c0:1026::/48 via fb_gw;
route 2a00:86c0:1027::/48 via fb_gw;
route 2a00:86c0:1028::/48 via fb_gw;
route 2a00:86c0:1029::/48 via fb_gw;
route 2a00:86c0:1050::/48 via fb_gw;
route 2a00:86c0:1051::/48 via fb_gw;
route 2a00:86c0:1052::/48 via fb_gw;
route 2a00:86c0:2016::/48 via fb_gw;
route 2a00:86c0:2017::/48 via fb_gw;
route 2a00:86c0:2042::/48 via fb_gw;
route 2a00:86c0:2060::/48 via fb_gw;
route 2a00:86c0:2072::/48 via fb_gw;
route 2a00:86c0:2073::/48 via fb_gw;
route 2a00:86c0:2074::/48 via fb_gw;
route 2a00:86c0:2075::/48 via fb_gw;
route 2a00:86c0:2078::/48 via fb_gw;
route 2a00:86c0:2079::/48 via fb_gw;
route 2a00:86c0:a2a6::/48 via fb_gw;
route 2a00:86c0:a2a7::/48 via fb_gw;
route 2a00:86c0:d0b0::/48 via fb_gw;
route 2a00:86c0:d0b1::/48 via fb_gw;
route 2a03:5640::/32 via fb_gw;

7
protocols/bfd.conf Normal file
View file

@ -0,0 +1,7 @@
protocol bfd bfd1 {
interface "wg-*" {
};
}

58
protocols/ibgp.conf Normal file
View file

@ -0,0 +1,58 @@
template bgp rr_clients {
local as my_ripe_asn;
neighbor as my_ripe_asn;
rr client;
rr cluster id 172.23.156.3;
direct;
ipv4 {
import keep filtered;
import where ibgp_import_v4();
export where ibgp_export_v4();
next hop self;
};
ipv6 {
import keep filtered;
import where ibgp_import_v6();
export where ibgp_export_v6();
next hop self;
};
}
protocol bgp edgy from rr_clients {
description "iBGP: edgy.0l.de";
local 2a09:11c0:200::3;
neighbor 2a09:11c0:200::14;
ipv4 {
preference 90;
};
ipv6 {
preference 90;
};
bfd yes;
}
protocol bgp moon from rr_clients {
description "iBGP: moon.0l.de";
local 2a09:11c0:200::3;
neighbor 2a09:11c0:200::2;
bfd yes;
}
protocol bgp acs from rr_clients {
description "iBGP: acs.0l.de";
local 2a09:11c0:200::3;
neighbor 2a09:11c0:200::6;
bfd yes;
}

18
protocols/kernel.conf Normal file
View file

@ -0,0 +1,18 @@
protocol kernel kernel_v4 {
ipv4 {
import none;
export where proto !~ "direct*";
};
metric 0;
}
protocol kernel kernel_v6 {
ipv6 {
import none;
export where proto !~ "direct*";
};
metric 0;
}

24
protocols/static.conf Normal file
View file

@ -0,0 +1,24 @@
protocol static static_v4 {
ipv4 {
preference 90;
};
route 0.0.0.0/0
via fb_gw;
# route 141.98.137.33/32 # level66.network iDRAC VPN
# via fb_gw;
# Netflix
include "/etc/bird/netflix_v4.conf";
}
protocol static static_v6 {
ipv6;
# route ::/0
# via fe80::e228:6dff:fe64:7d3%br0; # Fritzbox
# Netflix
include "/etc/bird/netflix_v6.conf";
}

5
tables.conf Normal file
View file

@ -0,0 +1,5 @@
# Kernel routing tables
define krt_main = 254;
define krt_local = 255;
define krt_default = 253;