log syslog all; {{ $node := (ds "node") }} {{ $bgp := (ds "common").bgp }} {{ $asn := (index $bgp $node.name).asn }} {{ $ipv4 := (index $bgp $node.name).ipv4 }} {{ $ipv4 := (index $bgp $node.name).ipv6 }} router id {{ $node.ipv4 }}; protocol device { scan time 10; # Scan interfaces every 10 seconds } protocol direct { interface "br-lan"; ipv4; ipv6; } protocol kernel { metric 0; learn; ipv4 { import none; export all; }; } protocol kernel { metric 0; learn; ipv6 { import none; export all; }; } protocol bgp lan4 { description "BGP4 for LAN"; local 10.0.0.1 port 179 as {{ $asn }}; neighbor range {{ $node.ipv4_subnet }} internal; direct; passive; ipv4 { import all; }; } protocol bgp lan6 { description "BGP6 for LAN"; local fd74:6a6f:0:f000::1 port 179 as {{ $asn }}; neighbor range {{ $node.ipv6_subnet }} internal; direct; passive; ipv6 { import all; }; } ## # BGP Peers ## {{- range $key, $value := $bgp }} {{ if ne $key $node.name }} protocol bgp uplink4_{{ $key }} { description "BGP4 uplink to {{ $key }}"; local as {{ $asn }}; neighbor {{ $value.ipv4 }} as {{ $value.asn }}; ipv4 { import all; export all; }; } protocol bgp uplink6_{{ $key }} { description "BGP6 uplink to {{ $key }}"; local as {{ $asn }}; neighbor {{ $value.ipv6 }} as {{ $value.asn }}; ipv6 { import all; export all; }; } {{ end }} {{- end }}