ansible/roles/bird2/templates/bird/bird.conf.j2

96 lines
2.4 KiB
Django/Jinja

{{ ansible_header | comment }}
# This is a basic configuration file, which contains boilerplate options and
# some basic examples. It allows the BIRD daemon to start but will not cause
# anything else to happen.
#
# Please refer to the BIRD User's Guide documentation, which is also available
# online at http://bird.network.cz/ in HTML format, for more information on
# configuring BIRD and adding routing protocols.
# Configure logging
log syslog all;
# Set router ID. It is a unique identification of your router, usually one of
# IPv4 addresses of the router. It is recommended to configure it explicitly.
router id {{ bird.id }};
# Turn on global debugging of all protocols (all messages or just selected classes)
# debug protocols all;
# To get meaningful uptime information in the Prometheus exporter, BIRD needs to be
# configured to use ISO-format timestamps
timeformat protocol iso long;
# +----------------------+
# | CONSTANT DEFINITIONS |
# +----------------------+
{% for key,value in bird.asn.items() %}
define {{ key }}_asn = {{ value }};
{% endfor %}
# +---------------+
# | NOT PROTOCOLS |
# +---------------+
# The Device protocol is not a real routing protocol. It does not generate any
# routes and it only serves as a module for getting information about network
# interfaces from the kernel. It is necessary in almost any configuration.
protocol device {}
# The Kernel protocol is not a real routing protocol. Instead of communicating
# with other routers in the network, it performs synchronization of BIRD
# routing tables with the OS kernel. One instance per table.
protocol kernel {
ipv4 {
import none;
export all;
};
}
protocol kernel {
ipv6 {
import none;
export all;
};
}
protocol static {
ipv4;
{% for route in bird.static.ipv4 %}
{{ route }};
{% endfor %}
}
protocol static {
ipv6;
{% for route in bird.static.ipv6 %}
{{ route }};
{% endfor %}
}
# +---------------+
# | BGP PROTOCOLS |
# +---------------+
{% for protocol in bird.bgp %}
protocol bgp {{ protocol.name }} {
description "{{ protocol.description }}";
local {{ protocol.local.addr }} as {{ protocol.local.asn }}_asn;
neighbor {{ protocol.neighbor.addr }} as {{ protocol.neighbor.asn }}_asn;
strict bind;
{% if protocol.ipv4 is defined and protocol.ipv4 %}
ipv4 {
import all;
export where source ~ [ RTS_STATIC ];
};
{% endif %}{% if protocol.ipv6 is defined and protocol.ipv6 %}
ipv6 {
import all;
export where source ~ [ RTS_STATIC ];
};
{% endif %}
}
{% endfor %}