2017-09-10 23:56:34 +02:00
|
|
|
#
|
|
|
|
# {{ ansible_managed }}
|
|
|
|
#
|
|
|
|
|
|
|
|
# Variables
|
|
|
|
define router_id = {{ bgp_loopback_net | ipaddr('net') | ipaddr(magic) | ipaddr('address') }};
|
|
|
|
define mwu_address = {{ bgp_ipv6_transfer_net | ipaddr('net') | ipaddr(magic) | ipaddr('address') }};
|
2019-03-02 18:10:48 +01:00
|
|
|
define mwu_as = {{ as_private }};
|
2017-09-10 23:56:34 +02:00
|
|
|
|
|
|
|
# General
|
|
|
|
timeformat protocol iso long;
|
|
|
|
router id router_id;
|
|
|
|
|
|
|
|
# Functions
|
|
|
|
function is_default() {
|
|
|
|
return net ~ [
|
|
|
|
::/0
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
function is_ula() {
|
|
|
|
return net ~ [
|
|
|
|
fc00::/7{48,64}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2018-10-31 20:58:56 +01:00
|
|
|
function is_mwu_self_nets_loose() {
|
2017-09-10 23:56:34 +02:00
|
|
|
return net ~ [
|
2019-03-02 18:10:48 +01:00
|
|
|
{% for prefix in internal_prefixes %}
|
2018-10-31 20:58:56 +01:00
|
|
|
{{ prefix.ipv6 | ipaddr('net') }}+{{ "," if not loop.last else "" }}
|
2018-10-31 20:58:56 +01:00
|
|
|
{% endfor %}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2018-10-31 20:58:56 +01:00
|
|
|
function is_mwu_self_nets_strict() {
|
|
|
|
return net ~ [
|
2019-03-02 18:10:48 +01:00
|
|
|
{% for prefix in internal_prefixes %}
|
2018-10-31 20:58:56 +01:00
|
|
|
{{ prefix.ipv6 | ipaddr('net') }}{{ "," if not loop.last else "" }}
|
|
|
|
{% endfor %}
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
function is_mwu_loopback() {
|
|
|
|
return net ~ [
|
2019-03-02 18:10:48 +01:00
|
|
|
{{ loopback_net_ipv6 }}+
|
2018-10-31 20:58:56 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
function is_mwu_anycast() {
|
|
|
|
return net ~ [
|
2019-03-02 18:10:48 +01:00
|
|
|
{{ anycast_ipv6 }}+
|
2018-10-31 20:58:56 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2017-09-10 23:56:34 +02:00
|
|
|
# Protocols
|
|
|
|
protocol device {
|
|
|
|
scan time 30;
|
|
|
|
};
|
|
|
|
|
|
|
|
protocol direct mwu_subnets {
|
2017-10-06 22:58:00 +02:00
|
|
|
{% for mesh in meshes %}
|
2017-11-06 21:24:56 +01:00
|
|
|
interface "{{ mesh.id }}br";
|
2017-09-10 23:56:34 +02:00
|
|
|
{% endfor %}
|
2018-10-31 20:58:56 +01:00
|
|
|
import where is_mwu_self_nets_loose();
|
|
|
|
};
|
|
|
|
|
|
|
|
protocol direct mwu_loopback {
|
|
|
|
interface "loopback";
|
|
|
|
import where is_mwu_loopback();
|
|
|
|
};
|
|
|
|
|
2019-03-02 18:10:48 +01:00
|
|
|
{% if server_type == "gateway" %}
|
2018-10-31 20:58:56 +01:00
|
|
|
protocol direct mwu_anycast {
|
|
|
|
interface "anycast";
|
|
|
|
import where is_mwu_anycast();
|
|
|
|
};
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
protocol static {
|
2019-03-02 18:10:48 +01:00
|
|
|
{% for prefix in internal_prefixes %}
|
2018-10-31 20:58:56 +01:00
|
|
|
route {{ prefix.ipv6 }} reject;
|
|
|
|
{% endfor %}
|
|
|
|
};
|
|
|
|
|
|
|
|
protocol kernel kernel_mwu {
|
|
|
|
scan time 30;
|
|
|
|
import none;
|
|
|
|
export filter {
|
2019-03-02 18:10:48 +01:00
|
|
|
{% if server_type == "gateway" %}
|
2018-10-31 20:58:56 +01:00
|
|
|
if is_mwu_anycast() then reject;
|
2018-11-30 18:18:25 +01:00
|
|
|
{% else %}
|
|
|
|
if is_mwu_anycast() then accept;
|
|
|
|
{% endif %}
|
2018-10-31 20:58:56 +01:00
|
|
|
if is_mwu_loopback() then accept;
|
|
|
|
reject;
|
|
|
|
};
|
|
|
|
kernel table ipt_mwu;
|
2017-09-10 23:56:34 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
# Templates
|
|
|
|
template bgp ibgp_mwu {
|
|
|
|
local mwu_address as mwu_as;
|
|
|
|
import keep filtered on;
|
2018-10-31 20:58:56 +01:00
|
|
|
import filter {
|
2019-03-02 18:10:48 +01:00
|
|
|
{% if server_type == "gateway" %}
|
2018-10-31 20:58:56 +01:00
|
|
|
if is_mwu_anycast() then reject;
|
2018-11-30 18:18:25 +01:00
|
|
|
{% endif %}
|
2018-10-31 20:58:56 +01:00
|
|
|
if is_mwu_self_nets_loose() then accept;
|
|
|
|
if is_ula() then accept;
|
|
|
|
reject;
|
|
|
|
};
|
|
|
|
export filter {
|
|
|
|
if is_mwu_self_nets_loose() then accept;
|
|
|
|
if source = RTS_BGP then accept;
|
|
|
|
reject;
|
|
|
|
};
|
2017-09-10 23:56:34 +02:00
|
|
|
direct;
|
|
|
|
gateway direct;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Include IPv6 MWU peers
|
|
|
|
include "mwu_ipv6_peers.con?";
|
2019-03-02 18:10:48 +01:00
|
|
|
{% if server_type == "gateway" %}
|
2017-09-10 23:56:34 +02:00
|
|
|
|
|
|
|
# Include IPv6 ICVPN configuration
|
|
|
|
include "icvpn_ipv6.con?";
|
|
|
|
|
|
|
|
# Include IPv6 FFRL configuration
|
|
|
|
include "ffrl_ipv6.con?";
|
2018-11-09 13:25:26 +01:00
|
|
|
|
|
|
|
# Include IPv6 Router Advertisement configuration
|
|
|
|
include "radv.con?";
|
2018-10-04 19:30:37 +02:00
|
|
|
{% endif %}
|