123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- # This file is managed by ansible, don't make changes here - they will be overwritten.
- log syslog { debug, trace, info, remote, warning, error, auth, fatal, bug };
- router id {{ vm_id }};
- table ffnet;
- filter freifunk {
- if net ~ {{ff_network.v6_network}} then accept;
- {% if not ffrl_tun is defined %}
- if net ~ [::/0] then accept;
- {% endif %}
- reject;
- }
- protocol kernel {
- scan time 20;
- import all;
- export all;
- table ffnet;
- kernel table 42;
- device routes;
- persist;
- };
- {% if domaenenliste is defined %}
- protocol radv {
- {% for domaene in domaenenliste|dictsort %}
- interface "bat{{domaene[0]}}" {
- max ra interval 20;
- link mtu 1280;
- prefix {{domaenen[domaene[0]].ffv6_network}} {
- };
- rdnss {
- ns {{domaenen[domaene[0]].ffv6_network | ipaddr(domaene[1].server_id) | ipaddr('address') }};
- };
- dnssl "{{freifunk.search_domain}}";
- };
- {% endfor %}
- };
- {% endif %}
- protocol bfd {
- table ffnet;
- interface "gre*";
- interface "bck*";
- multihop {
- passive;
- };
- };
- protocol device {
- scan time 10;
- };
- protocol ospf {
- table ffnet;
- import filter freifunk;
- export all;
- area 0.0.0.0 {
- interface "bat*" {
- stub;
- };
- {% for host in groups['supernodes'] %}
- {% if hostvars[host].hoster|default('unknown') != hoster|default('unknown') %}
- interface "bck-{{host}}" {
- cost 1000;
- };
- {% endif %}
- {% endfor %}
- interface "bck-*";
- {% if ffrl_tun is defined %}
- interface "lo" {
- stub;
- };
- {% endif %}
- };
- };
- function is_default() {
- return (net ~ [::/0]);
- };
- {% if ffrl_tun is defined %}
- filter export_to_upstream_filter {
- if source = RTS_STATIC then accept;
- reject;
- };
- {% endif %}
- protocol static static_Gesamtnetzwerk {
- table ffnet;
- route {{ff_network.v6_network}} reject;
- };
- {% if domaenenliste is defined %}
- {% for domaene in domaenenliste|dictsort %}
- protocol static static_domaene{{domaene[0]}} {
- table ffnet;
- route {{domaenen[domaene[0]].ffv6_network | regex_replace('..::/\d+$','00::/56')}} reject;
- };
- {% endfor %}
- {% endif %}
- {% if dhcp is defined %}
- protocol static 'static_{{inventory_hostname_short}}' {
- table ffnet;
- route {{ff_network.v6_network | regex_replace('..::/\d+$','00::/56')}} reject;
- };
- {% endif %}
- protocol kernel 'kernel_master' {
- scan time 20;
- table master;
- kernel table 254;
- import all;
- export all;
- persist;
- };
- protocol static {
- table master;
- import all;
- export none;
- };
- protocol direct {
- interface "lo";
- interface "tun-ffrl*";
- interface "gre-*";
- interface "bck-*";
- interface "bat*";
- table ffnet;
- }
- template bgp internal {
- table ffnet;
- local as {{ff_network.as_number}};
- import filter {
- if is_default() then
- preference = 99;
- else
- preference = 160;
- accept;
- };
- export filter {
- if source = RTS_BGP then accept;
- {% if ffrl_tun is not defined %}
- if source = RTS_STATIC then accept;
- {% endif %}
- else reject;
- };
- gateway direct;
- direct;
- next hop self;
- };
- {% for host in groups['supernodes'] %}
- {% if hostvars[host].vm_id != vm_id %}
- protocol bgp ibgp_{{host|regex_replace('-','_')}} from internal {
- {% if hostvars[host].vm_id < vm_id %}
- neighbor 2a03:2260:115:ffa1::{{hostvars[host].vm_id}}:{{vm_id}}:1 as {{ff_network.as_number}};
- {% else %}
- neighbor 2a03:2260:115:ffa1::{{vm_id}}:{{hostvars[host].vm_id}}:0 as {{ff_network.as_number}};
- {% endif %}
- {% if hostvars[host].hoster|default('unknown') != hoster|default('unknown') %}
- import filter {
- preference = 50;
- accept;
- };
- {% endif %}
- }
- {% endif %}
- {% endfor %}
- {% if ffrl_tun is defined %}
- template bgp uplink {
- table ffnet;
- local as {{ff_network.as_number}};
- import where is_default();
- export filter export_to_upstream_filter;
- gateway recursive;
- }
- {% for tun in ffrl_tun %}
- protocol bgp ffrl_{{tun.name}} from uplink {
- description "Rheinland Backbone";
- source address {{ tun.v6_remote | ipaddr('2') | ipaddr('address') }};
- neighbor {{tun.v6_remote | ipaddr('address')}} as 201701;
- };
- {% endfor %}
- {% endif %}
|