|
| 1 | +{{- $ASN := .ASN -}}{{- $RouterId := .Loopback -}}! The frr version is not rendered since it seems to be optional. |
| 2 | +frr defaults datacenter |
| 3 | +# This is the only line changed from upstream: https://github.com/metal-stack/metal-core/blob/master/cmd/internal/switcher/templates/tpl/sonic_frr.tpl |
| 4 | +# Follow-up issue: https://github.com/metal-stack/metal-core/issues/199 |
| 5 | +fpm address 127.0.0.1 |
| 6 | +hostname {{ .Name }} |
| 7 | +password zebra |
| 8 | +enable password zebra |
| 9 | +! |
| 10 | +agentx |
| 11 | +log syslog {{ .LogLevel }} |
| 12 | +log facility local4 |
| 13 | +debug bgp updates |
| 14 | +debug bgp nht |
| 15 | +debug bgp update-groups |
| 16 | +debug bgp zebra |
| 17 | +debug zebra events |
| 18 | +debug zebra nexthop detail |
| 19 | +debug zebra rib detailed |
| 20 | +debug zebra nht detailed |
| 21 | +{{- range $vrf, $t := .Ports.Vrfs }} |
| 22 | +! |
| 23 | +vrf Vrf{{ $t.VNI }} |
| 24 | + vni {{ $t.VNI }} |
| 25 | + exit-vrf |
| 26 | +{{- end }} |
| 27 | +{{- range .Ports.Underlay }} |
| 28 | +! |
| 29 | +interface {{ . }} |
| 30 | + ipv6 nd ra-interval 6 |
| 31 | + no ipv6 nd suppress-ra |
| 32 | +{{- end }} |
| 33 | +{{- range .Ports.Firewalls }} |
| 34 | +! |
| 35 | +interface {{ .Port }} |
| 36 | + ipv6 nd ra-interval 6 |
| 37 | + no ipv6 nd suppress-ra |
| 38 | +{{- end }} |
| 39 | +{{- range $vrf, $t := .Ports.Vrfs }} |
| 40 | +{{- range $t.Neighbors }} |
| 41 | +! |
| 42 | +interface {{ . }} vrf {{ $vrf }} |
| 43 | + ipv6 nd ra-interval 6 |
| 44 | + no ipv6 nd suppress-ra |
| 45 | +{{- end }} |
| 46 | +{{- end }} |
| 47 | +! |
| 48 | +router bgp {{ $ASN }} |
| 49 | + bgp router-id {{ $RouterId }} |
| 50 | + bgp bestpath as-path multipath-relax |
| 51 | + neighbor FABRIC peer-group |
| 52 | + neighbor FABRIC remote-as external |
| 53 | + neighbor FABRIC timers 2 8 |
| 54 | + {{- range .Ports.Underlay }} |
| 55 | + neighbor {{ . }} interface peer-group FABRIC |
| 56 | + {{- end }} |
| 57 | + neighbor FIREWALL peer-group |
| 58 | + neighbor FIREWALL remote-as external |
| 59 | + neighbor FIREWALL timers 2 8 |
| 60 | + {{- range .Ports.Firewalls }} |
| 61 | + neighbor {{ .Port }} interface peer-group FIREWALL |
| 62 | + {{- end }} |
| 63 | + ! |
| 64 | + address-family ipv4 unicast |
| 65 | + redistribute connected route-map DENY_MGMT |
| 66 | + redistribute kernel route-map DENY_MGMT |
| 67 | + neighbor FIREWALL allowas-in 2 |
| 68 | + {{- range $k, $f := .Ports.Firewalls }} |
| 69 | + neighbor {{ $f.Port }} route-map fw-{{ $k }}-in in |
| 70 | + {{- end }} |
| 71 | + exit-address-family |
| 72 | + ! |
| 73 | + address-family ipv6 unicast |
| 74 | + redistribute connected route-map DENY_MGMT |
| 75 | + redistribute kernel route-map DENY_MGMT |
| 76 | + neighbor FIREWALL allowas-in 2 |
| 77 | + # see https://docs.frrouting.org/en/latest/bgp.html#clicmd-neighbor-A.B.C.D-activate |
| 78 | + # why activate is required |
| 79 | + neighbor FIREWALL activate |
| 80 | + {{- range $k, $f := .Ports.Firewalls }} |
| 81 | + neighbor {{ $f.Port }} route-map fw-{{ $k }}-in in |
| 82 | + {{- end }} |
| 83 | + exit-address-family |
| 84 | + ! |
| 85 | + address-family l2vpn evpn |
| 86 | + advertise-all-vni |
| 87 | + neighbor FABRIC activate |
| 88 | + neighbor FABRIC allowas-in 2 |
| 89 | + neighbor FIREWALL activate |
| 90 | + neighbor FIREWALL allowas-in 2 |
| 91 | + {{- range $k, $f := .Ports.Firewalls }} |
| 92 | + neighbor {{ $f.Port }} route-map fw-{{ $k }}-vni out |
| 93 | + {{- end }} |
| 94 | + exit-address-family |
| 95 | +! |
| 96 | +route-map DENY_MGMT deny 10 |
| 97 | + match interface eth0 |
| 98 | +route-map DENY_MGMT permit 20 |
| 99 | +! |
| 100 | +{{- range $k, $f := .Ports.Firewalls }} |
| 101 | +# route-maps for firewall@{{ $k }} |
| 102 | + {{- range $f.IPPrefixLists }} |
| 103 | +ip prefix-list {{ .Name }} {{ .Spec }} |
| 104 | + {{- end}} |
| 105 | + {{- range $f.RouteMaps }} |
| 106 | +route-map {{ .Name }} {{ .Policy }} {{ .Order }} |
| 107 | + {{- range .Entries }} |
| 108 | + {{ . }} |
| 109 | + {{- end }} |
| 110 | + {{- end }} |
| 111 | +! |
| 112 | +{{- end }} |
| 113 | +{{- if .Ports.Eth0.Gateway }} |
| 114 | +ip route 0.0.0.0/0 {{ .Ports.Eth0.Gateway }} nexthop-vrf mgmt |
| 115 | +{{- end }} |
| 116 | +! |
| 117 | +{{- range $vrf, $t := .Ports.Vrfs }} |
| 118 | +router bgp {{ $ASN }} vrf {{ $vrf }} |
| 119 | + bgp router-id {{ $RouterId }} |
| 120 | + bgp bestpath as-path multipath-relax |
| 121 | + neighbor MACHINE peer-group |
| 122 | + neighbor MACHINE remote-as external |
| 123 | + neighbor MACHINE timers 2 8 |
| 124 | + {{- range $t.Neighbors }} |
| 125 | + neighbor {{ . }} interface peer-group MACHINE |
| 126 | + {{- end }} |
| 127 | + ! |
| 128 | + {{- if $t.Has4 }} |
| 129 | + address-family ipv4 unicast |
| 130 | + redistribute connected |
| 131 | + neighbor MACHINE maximum-prefix 24000 |
| 132 | + {{- if gt (len $t.IPPrefixLists) 0 }} |
| 133 | + neighbor MACHINE route-map {{ $vrf }}-in in |
| 134 | + {{- end }} |
| 135 | + exit-address-family |
| 136 | + ! |
| 137 | + {{- end }} |
| 138 | + {{- if $t.Has6 }} |
| 139 | + address-family ipv6 unicast |
| 140 | + redistribute connected |
| 141 | + neighbor MACHINE maximum-prefix 24000 |
| 142 | + # see https://docs.frrouting.org/en/latest/bgp.html#clicmd-neighbor-A.B.C.D-activate |
| 143 | + # why activate is required |
| 144 | + neighbor MACHINE activate |
| 145 | + {{- if gt (len $t.IPPrefixLists) 0 }} |
| 146 | + neighbor MACHINE route-map {{ $vrf }}-in6 in |
| 147 | + {{- end }} |
| 148 | + exit-address-family |
| 149 | + ! |
| 150 | + {{- end }} |
| 151 | + address-family l2vpn evpn |
| 152 | + {{- if $t.Has4 }} |
| 153 | + advertise ipv4 unicast |
| 154 | + {{- end }} |
| 155 | + {{- if $t.Has6 }} |
| 156 | + advertise ipv6 unicast |
| 157 | + {{- end }} |
| 158 | + exit-address-family |
| 159 | +! |
| 160 | +{{- if gt (len $t.IPPrefixLists) 0 }} |
| 161 | +# route-maps for {{ $vrf }} |
| 162 | + {{- range $t.IPPrefixLists }} |
| 163 | +ip prefix-list {{ .Name }} {{ .Spec }} |
| 164 | + {{- end}} |
| 165 | + {{- range $t.RouteMaps }} |
| 166 | +route-map {{ .Name }} {{ .Policy }} {{ .Order }} |
| 167 | + {{- range .Entries }} |
| 168 | + {{ . }} |
| 169 | + {{- end }} |
| 170 | + {{- end }} |
| 171 | +!{{- end }}{{- end }} |
| 172 | +{{- if .SetSrcLoopback }} |
| 173 | +route-map RM_SET_SRC permit 10 |
| 174 | + set src {{ .Loopback }} |
| 175 | +exit |
| 176 | +! |
| 177 | +ip protocol bgp route-map RM_SET_SRC |
| 178 | +! |
| 179 | +{{- end }} |
| 180 | +line vty |
| 181 | +! |
0 commit comments