Created
October 19, 2016 09:24
-
-
Save prauscher/d5767864338c632820395383c82ac899 to your computer and use it in GitHub Desktop.
2016-10-19: rajesh-bird6 config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
router id 172.22.120.2; | |
table prauscher; | |
table ext_dn42; | |
log syslog all; | |
protocol device { | |
scan time 10; | |
} | |
protocol kernel { | |
scan time 20; | |
import none; | |
export filter { krt_prefsrc = fdc1:31f:b14f:200::1; accept; }; | |
} | |
protocol pipe { | |
peer table prauscher; | |
import filter { if net ~ [ ::/0{0,2} ] then { reject; } accept; }; | |
export none; | |
} | |
protocol direct { | |
table prauscher; | |
import all; | |
interface "dummy0", "tun.server", "tun.vod"; | |
} | |
protocol static { | |
table prauscher; | |
import all; | |
route fc00::/7 unreachable; | |
route ::/0 blackhole; | |
} | |
protocol ospf { | |
table prauscher; | |
import all; | |
export all; | |
area 0.0.0.0 { | |
interface "tun.sheldon" { | |
hello 60; | |
dead 80; | |
}; | |
interface "tun.howard" { | |
hello 60; | |
dead 80; | |
}; | |
interface "tun.amy" { | |
hello 60; | |
dead 80; | |
}; | |
interface "tun.emily" { | |
hello 60; | |
dead 80; | |
}; | |
}; | |
} | |
include "/etc/bird/update.conf"; | |
function is_ula() { | |
return net ~ [ fc00::/7{48,64} ]; | |
} | |
function is_freifunk() { | |
return net ~ [ | |
2001:0bf7::/32+, # Foerderverein freie Netzwerke e.V. | |
2001:67c:2d50::/48+, # Freifunk Lübeck (via FF Rheinland) | |
2a03:2260::/29+ # Freifunk Rheinland e.V. | |
]; | |
} | |
protocol pipe { | |
peer table ext_dn42; | |
import filter { if dest = RTD_UNREACHABLE then { reject; } accept; }; | |
export none; | |
} | |
protocol static { | |
table ext_dn42; | |
export all; | |
route fdc1:31f:b14f::/48 reject; | |
} | |
template bgp dn42_peer { | |
table ext_dn42; | |
import none; | |
export all; | |
local as 64720; | |
} | |
#include "/etc/bird/bird6-dn42.d/*.conf"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is_valid_as(int asnum) { | |
return asnum = bgp_path.first; | |
} | |
function is_neighbor() { | |
if bgp_path.len > 1 then bgp_local_pref = 20; | |
return true; | |
# return bgp_path.len <= 1; | |
} | |
function update_latency(int link_latency) { | |
bgp_community.add((64511, link_latency)); | |
if (64511, 9) ~ bgp_community then bgp_community.delete([(64511, 1..8)]); | |
else if (64511, 8) ~ bgp_community then bgp_community.delete([(64511, 1..7)]); | |
else if (64511, 7) ~ bgp_community then bgp_community.delete([(64511, 1..6)]); | |
else if (64511, 6) ~ bgp_community then bgp_community.delete([(64511, 1..5)]); | |
else if (64511, 5) ~ bgp_community then bgp_community.delete([(64511, 1..4)]); | |
else if (64511, 4) ~ bgp_community then bgp_community.delete([(64511, 1..3)]); | |
else if (64511, 3) ~ bgp_community then bgp_community.delete([(64511, 1..2)]); | |
else if (64511, 2) ~ bgp_community then bgp_community.delete([(64511, 1..1)]); | |
} | |
function update_bandwidth(int link_bandwidth) { | |
bgp_community.add((64511, link_bandwidth)); | |
if (64511, 21) ~ bgp_community then bgp_community.delete([(64511, 22..29)]); | |
else if (64511, 22) ~ bgp_community then bgp_community.delete([(64511, 23..29)]); | |
else if (64511, 23) ~ bgp_community then bgp_community.delete([(64511, 24..29)]); | |
else if (64511, 24) ~ bgp_community then bgp_community.delete([(64511, 25..29)]); | |
else if (64511, 25) ~ bgp_community then bgp_community.delete([(64511, 26..29)]); | |
else if (64511, 26) ~ bgp_community then bgp_community.delete([(64511, 27..29)]); | |
else if (64511, 27) ~ bgp_community then bgp_community.delete([(64511, 28..29)]); | |
else if (64511, 28) ~ bgp_community then bgp_community.delete([(64511, 29..29)]); | |
} | |
function update_crypto(int link_crypto) { | |
bgp_community.add((64511, link_crypto)); | |
if (64511, 31) ~ bgp_community then bgp_community.delete([(64511, 32..34)]); | |
else if (64511, 32) ~ bgp_community then bgp_community.delete([(64511, 33..34)]); | |
else if (64511, 33) ~ bgp_community then bgp_community.delete([(64511, 34..34)]); | |
} | |
function update_flags(int link_latency; int link_bandwidth; int link_crypto) { | |
update_latency(link_latency); | |
update_bandwidth(link_bandwidth); | |
update_crypto(link_crypto); | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment