Created
November 25, 2025 19:16
-
-
Save Phineas/badc32456943b1668d9d580bbc95436e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {# Inputs expected: | |
| a_zone_name | |
| z_zone_name | |
| a_border_1_lo0_address | |
| a_border_2_lo0_address | |
| z_border_1_lo0_address | |
| z_border_2_lo0_address | |
| #} | |
| {% set a_borders = [ | |
| {"id": "1", "name": "border-sw-001", "lo0": a_border_1_lo0_address}, | |
| {"id": "2", "name": "border-sw-002", "lo0": a_border_2_lo0_address}, | |
| ] %} | |
| {% set z_borders = [ | |
| {"id": "1", "name": "border-sw-001", "lo0": z_border_1_lo0_address}, | |
| {"id": "2", "name": "border-sw-002", "lo0": z_border_2_lo0_address}, | |
| ] %} | |
| {# ======================= A-SIDE BORDERS ======================= #} | |
| {% for local in a_borders %} | |
| ! -------------------------------------------------------------- | |
| ! Paste this block into {{ a_zone_name }} {{ local.name }} | |
| ! This creates BGP sessions from: | |
| ! {{ a_zone_name }} {{ local.name }} -> all Z-side borders in {{ z_zone_name }} | |
| ! -------------------------------------------------------------- | |
| router bgp 400940 | |
| {% for remote in z_borders %} | |
| neighbor {{ remote.lo0 }} remote-as 400940 | |
| neighbor {{ remote.lo0 }} next-hop-self | |
| neighbor {{ remote.lo0 }} update-source Loopback0 | |
| neighbor {{ remote.lo0 }} description Backbone [{{ a_zone_name }}-{{ z_zone_name }}] {{ '%03d'|format(local.id|int) }}-{{ '%03d'|format(remote.id|int) }} | |
| neighbor {{ remote.lo0 }} route-map BORDER_ALLOW_BACKBONE_IN_V4 in | |
| neighbor {{ remote.lo0 }} route-map BORDER_ALLOW_BACKBONE_OUT_V4 out | |
| {% endfor %} | |
| address-family ipv4 | |
| {% for remote in z_borders %} | |
| neighbor {{ remote.lo0 }} activate | |
| {% endfor %} | |
| ! | |
| {% endfor %} | |
| {# ======================= Z-SIDE BORDERS ======================= #} | |
| {% for local in z_borders %} | |
| ! -------------------------------------------------------------- | |
| ! Paste this block into {{ z_zone_name }} {{ local.name }} | |
| ! This creates BGP sessions from: | |
| ! {{ z_zone_name }} {{ local.name }} -> all A-side borders in {{ a_zone_name }} | |
| ! -------------------------------------------------------------- | |
| router bgp 400940 | |
| {% for remote in a_borders %} | |
| neighbor {{ remote.lo0 }} remote-as 400940 | |
| neighbor {{ remote.lo0 }} next-hop-self | |
| neighbor {{ remote.lo0 }} update-source Loopback0 | |
| {# A-side ID must always be first in the pair: A-Z #} | |
| neighbor {{ remote.lo0 }} description Backbone [{{ a_zone_name }}-{{ z_zone_name }}] {{ '%03d'|format(remote.id|int) }}-{{ '%03d'|format(local.id|int) }} | |
| neighbor {{ remote.lo0 }} route-map BORDER_ALLOW_BACKBONE_IN_V4 in | |
| neighbor {{ remote.lo0 }} route-map BORDER_ALLOW_BACKBONE_OUT_V4 out | |
| {% endfor %} | |
| address-family ipv4 | |
| {% for remote in a_borders %} | |
| neighbor {{ remote.lo0 }} activate | |
| {% endfor %} | |
| ! | |
| {% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment