lixonet-ee/bird/bird.conf.tmpl

77 lines
3.0 KiB
Cheetah
Raw Normal View History

2020-05-20 23:12:03 +00:00
# Lixonet BIRD configuration
# This is a templated file that automatically generates values at configuration time
# If you edit this file, it will be overwritten. Changes to the general structure of
# this configuration file that should be persisted should be committed to Git.
# For BIRD 2.0 configuration reference, see:
# https://bird.network.cz/?get_doc&f=bird.html&v=20
# Global variables
# https://bird.network.cz/?get_doc&v=20&f=bird-3.html#ss3.2
2020-04-28 04:16:29 +00:00
log stderr all; # Using docker; defer logging to stderr
debug protocols all; # Enable debugging
2020-04-28 04:17:15 +00:00
router id ${address};
2020-04-28 04:16:29 +00:00
2020-05-20 23:12:03 +00:00
# Device
# See: https://bird.network.cz/?get_doc&v=20&f=bird-6.html#ss6.4
# This controls which interfaces BGP, etc. will bind to for communication
# This prevents BGP from listening on eth0/off-network
protocol device {
scan time 10; # Scan the interfaces often
interface "lixonet" {
preferred ${address};
};
};
# Direct (unnecessary for Lixonet)
# See: https://bird.network.cz/?get_doc&v=20&f=bird-6.html#ss6.5
2020-04-28 04:50:43 +00:00
# Disable automatically generating direct routes to all network interfaces.
protocol direct {
2020-05-20 23:12:03 +00:00
disabled; # Disable by default
2020-04-28 04:50:43 +00:00
};
2020-05-20 23:12:03 +00:00
# Kernel routing table
# See: https://bird.network.cz/?get_doc&v=20&f=bird.html#toc6.6
protocol kernel { # Primary routing table
learn; # Learn alien routes from the kernel
persist; # Don't remove routes on bird shutdown
scan time 10; # Scan kernel routing table every 10 seconds
ipv4 {
import none; # Don't try to import any routes from the kernel
export all; # Export everything we are told to the kernel
};
}
2020-05-20 22:22:17 +00:00
2020-05-20 23:12:03 +00:00
# BGP (primary Lixonet routing protocol)
# Define a template to use when connecting to other BGP clients on the EE network
template bgp lixonet_client {
2020-05-20 23:12:03 +00:00
local as ${asn}; # Local AS advertised to peers, read from lixonet.conf.
2020-04-28 04:43:11 +00:00
source address ${address}; # What local address we use for the TCP connection
path metric 1; # Prefer routes with shorter paths (like Cisco does)
2020-04-28 04:57:39 +00:00
2020-05-20 23:16:34 +00:00
# aigp (see: http://www.rfc-editor.org/info/rfc7311)
# Lixonet default: originate AIGP
# This ot only allows AIGP attribute propagation, but also new AIGP attributes are
# automatically attached to non-BGP routes with valid IGP metric (e.g. ospf_metric1)
# as they are exported to the BGP session.
# Thank-you, BIRD <3 - mane and nurd
2020-05-20 23:12:03 +00:00
aigp originate;
2020-05-20 23:16:34 +00:00
# BGP IPv4 settings
ipv4 {
# Always advertise our own local address as a next hop, even in cases where the
# current Next Hop attribute should be used unchanged.
# Reason: tinc NEEDS this, otherwise Layer3 inter-routing on the mesh will be broken
next hop self ebgp;
}
2020-04-28 04:48:05 +00:00
};
2020-04-28 04:16:29 +00:00
# Neighbors
2020-04-28 05:14:23 +00:00
{{ range files "bird/neighbors" }} {{ if ne . "${name}" }}
2020-04-28 05:10:33 +00:00
protocol bgp {{ . }} from lixonet_client {
2020-04-28 05:15:32 +00:00
description "Lixonet BGP link from ${address} (ASN: ${asn}) to {{ . }}";
{{ file (print "bird/neighbors/" .) }}
2020-04-28 05:14:23 +00:00
}; {{ end }} {{ end }}