bird/templates/bird.conf.j2
2021-10-27 00:33:38 +03:00

52 lines
1.1 KiB
Django/Jinja

log syslog all;
router id {{ bird.bgp.common[inventory_hostname].routerid }};
protocol device {
}
protocol direct {
disabled;
ipv4;
ipv6;
}
protocol kernel KERNEL4 {
ipv4 {
export all; # Export to protocol. default is export none
};
}
protocol kernel KERNEL6 {
ipv6 { export all; };
}
{% for protocol_static in bird.bgp.static %}
protocol static {{ protocol_static.name }} {
ipv4;
{% for network in protocol_static['networks'][inventory_hostname] %}
route {{ network.ip }} via "{{ network.interface }}" { bgp_local_pref = {{ network.bgp_local_pref }}; };
{% endfor %}
}
{% endfor %}
{% for protocol_bgp in bird.bgp.bgp %}
protocol bgp {{ protocol_bgp.name }} {
{% if protocol_bgp.confederation is defined %}
confederation {{ protocol_bgp.confederation }};
confederation member yes;
{% endif %}
local as {{ protocol_bgp.local_asnum }};
neighbor {{ protocol_bgp.remote_addr }} as {{ protocol_bgp.remote_asnum }};
hold time 30;
ipv4 {
import none;
export filter {
{% for proto in protocol_bgp.export %}
if proto = "{{ proto }}" then accept;
{% endfor %}
else reject;
};
};
}
{% endfor %}