bird/templates/bird.conf.j2

51 lines
1.1 KiB
Plaintext
Raw Normal View History

2021-10-25 09:53:52 +00:00
log syslog all;
router id {{ bird.bgp.common[inventory_hostname].routerid }};
protocol device {
}
2021-10-25 11:40:26 +00:00
2021-10-25 09:53:52 +00:00
protocol direct {
2021-10-25 11:38:14 +00:00
disabled;
ipv4;
ipv6;
2021-10-25 09:53:52 +00:00
}
2021-10-25 11:40:26 +00:00
2021-10-25 09:53:52 +00:00
protocol kernel KERNEL4 {
2021-10-25 11:38:14 +00:00
ipv4 {
2021-10-25 11:35:28 +00:00
export all; # Export to protocol. default is export none
2021-10-25 11:38:14 +00:00
};
2021-10-25 09:53:52 +00:00
}
2021-10-25 11:40:26 +00:00
2021-10-25 09:53:52 +00:00
protocol kernel KERNEL6 {
2021-10-25 11:40:26 +00:00
ipv6 { export all; };
2021-10-25 09:53:52 +00:00
}
2021-10-25 11:40:26 +00:00
2021-10-25 09:53:52 +00:00
{% for protocol_static in bird.bgp.static %}
protocol static {{ protocol_static.name }} {
2021-10-25 11:38:14 +00:00
ipv4;
2021-10-25 09:53:52 +00:00
{% for network in protocol_static['networks'][inventory_hostname] %}
2021-10-25 11:35:28 +00:00
route {{ network.ip }}/{{ network.mask_dash }} via "lo" { bgp_local_pref = {{ network.bgp_local_pref }}; };
2021-10-25 09:53:52 +00:00
{% endfor %}
}
{% endfor %}
2021-10-25 11:40:26 +00:00
2021-10-25 09:53:52 +00:00
{% for protocol_bgp in bird.bgp.bgp %}
protocol bgp {{ protocol_bgp.name }} {
2021-10-25 11:38:14 +00:00
{% if protocol_bgp.confederation is defined %}
2021-10-25 11:35:28 +00:00
confederation {{ protocol_bgp.confederation }};
confederation member yes;
2021-10-25 11:38:14 +00:00
{% endif %}
2021-10-25 11:35:28 +00:00
local as {{ protocol_bgp.local_asnum }};
neighbor {{ protocol_bgp.remote_addr }} as {{ protocol_bgp.remote_asnum }};
hold time 30;
ipv4 {
export filter {
2021-10-25 09:53:52 +00:00
{% for proto in protocol_bgp.export %}
2021-10-25 11:35:28 +00:00
if proto = "{{ proto }}" then accept;
2021-10-25 09:53:52 +00:00
{% endfor %}
2021-10-25 11:35:28 +00:00
else reject;
};
};
2021-10-25 09:53:52 +00:00
}
{% endfor %}