bird/templates/bird.conf.j2

47 lines
1.4 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 {
}
protocol direct {
disabled; # Disable by default
ipv4; # Connect to default IPv4 table
ipv6; # ... and to default IPv6 table
}
protocol kernel KERNEL4 {
ipv4 { # Connect protocol to IPv4 table by channel
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; # Again, IPv4 channel with default options
{% for network in protocol_static['networks'][inventory_hostname] %}
route {{ network.ip }}/{{ network.mask_dash }} via "lo" { bgp_local_pref = {{ network.bgp_local_pref }}; };
{% endfor %}
}
{% endfor %}
{% for protocol_bgp in bird.bgp.bgp %}
protocol bgp {{ protocol_bgp.name }} {
2021-10-25 11:32:07 +00:00
{% if protocol_bgp.confederation is defined %}
2021-10-25 09:53:52 +00:00
confederation {{ protocol_bgp.confederation }};
confederation member yes;
2021-10-25 11:32:07 +00:00
{% endif %}
2021-10-25 09:53:52 +00:00
local as {{ protocol_bgp.local_asnum }};
neighbor {{ protocol_bgp.remote_addr }} as {{ protocol_bgp.remote_asnum }};
hold time 30;
ipv4 {
export filter {
{% for proto in protocol_bgp.export %}
if proto = "{{ proto }}" then accept;
{% endfor %}
else reject;
};
};
}
{% endfor %}