2020-08-27 16:14:04 -05:00
|
|
|
{% from "common/functions.conf.j2" import get_ipv4_loopback_address, get_ipv6_loopback_address, get_vnet_interfaces %}
|
2020-04-23 11:42:22 -05:00
|
|
|
!
|
|
|
|
! template: bgpd/bgpd.main.conf.j2
|
|
|
|
!
|
|
|
|
! bgp multiple-instance
|
|
|
|
!
|
|
|
|
! BGP configuration
|
|
|
|
!
|
|
|
|
! TSA configuration
|
|
|
|
!
|
|
|
|
ip prefix-list PL_LoopbackV4 permit {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32
|
|
|
|
!
|
|
|
|
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") != 'None' %}
|
|
|
|
ipv6 prefix-list PL_LoopbackV6 permit {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | replace('/128', '/64') | ip_network }}/64
|
|
|
|
{% endif %}
|
|
|
|
!
|
2020-08-27 16:14:04 -05:00
|
|
|
{% if VLAN_INTERFACE is defined %}
|
|
|
|
{% set vnet_intfs = get_vnet_interfaces(VLAN_INTERFACE) %}
|
|
|
|
{% endif %}
|
2020-07-21 21:26:19 -05:00
|
|
|
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
2020-08-27 16:14:04 -05:00
|
|
|
{% if prefix | ipv4 and name not in vnet_intfs %}
|
2020-11-06 19:47:08 -06:00
|
|
|
ip prefix-list LOCAL_VLAN_IPV4_PREFIX seq {{ loop.index * 5 }} permit {{ prefix | ip_network }}/{{ prefix | prefixlen }}
|
2020-07-21 21:26:19 -05:00
|
|
|
!
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
2020-08-27 16:14:04 -05:00
|
|
|
{% if prefix | ipv6 and name not in vnet_intfs %}
|
2020-11-06 19:47:08 -06:00
|
|
|
ipv6 prefix-list LOCAL_VLAN_IPV6_PREFIX seq {{ loop.index * 5 }} permit {{ prefix | ip_network }}/{{ prefix | prefixlen }}
|
2020-07-21 21:26:19 -05:00
|
|
|
!
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
2020-04-23 11:42:22 -05:00
|
|
|
!
|
2020-07-06 00:22:31 -05:00
|
|
|
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' or DEVICE_METADATA['localhost']['sub_role'] == 'BackEnd' %}
|
2020-04-23 11:42:22 -05:00
|
|
|
route-map HIDE_INTERNAL permit 10
|
|
|
|
set community local-AS
|
|
|
|
!
|
|
|
|
{% endif %}
|
|
|
|
!
|
|
|
|
router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
|
|
|
!
|
|
|
|
{% block bgp_init %}
|
|
|
|
bgp log-neighbor-changes
|
|
|
|
no bgp default ipv4-unicast
|
|
|
|
!
|
|
|
|
{% if constants.bgp.multipath_relax.enabled is defined and constants.bgp.multipath_relax.enabled %}
|
|
|
|
bgp bestpath as-path multipath-relax
|
|
|
|
{% endif %}
|
|
|
|
!
|
|
|
|
{% if constants.bgp.graceful_restart.enabled is defined and constants.bgp.graceful_restart.enabled %}
|
|
|
|
bgp graceful-restart restart-time {{ constants.bgp.graceful_restart.restart_time | default(240) }}
|
|
|
|
bgp graceful-restart
|
|
|
|
bgp graceful-restart preserve-fw-state
|
|
|
|
{% endif %}
|
|
|
|
!
|
|
|
|
{# set router-id #}
|
2020-07-06 00:22:31 -05:00
|
|
|
{% if multi_asic() %}
|
|
|
|
bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}
|
|
|
|
{% else %}
|
2020-04-23 11:42:22 -05:00
|
|
|
bgp router-id {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}
|
2020-07-06 00:22:31 -05:00
|
|
|
{% endif %}
|
2020-04-23 11:42:22 -05:00
|
|
|
!
|
|
|
|
{# advertise loopback #}
|
|
|
|
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/32
|
2020-07-06 00:22:31 -05:00
|
|
|
{% if multi_asic() %}
|
|
|
|
network {{ get_ipv4_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/32 route-map HIDE_INTERNAL
|
|
|
|
{% endif %}
|
2020-04-23 11:42:22 -05:00
|
|
|
!
|
|
|
|
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") != 'None' %}
|
|
|
|
address-family ipv6
|
|
|
|
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback0") | ip }}/64
|
|
|
|
exit-address-family
|
|
|
|
{% endif %}
|
2020-07-06 00:22:31 -05:00
|
|
|
{% if multi_asic() %}
|
|
|
|
{% if get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") != 'None' %}
|
|
|
|
address-family ipv6
|
|
|
|
network {{ get_ipv6_loopback_address(LOOPBACK_INTERFACE, "Loopback4096") | ip }}/64 route-map HIDE_INTERNAL
|
|
|
|
exit-address-family
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
2020-04-23 11:42:22 -05:00
|
|
|
{% endblock bgp_init %}
|
|
|
|
!
|
|
|
|
{% block vlan_advertisement %}
|
|
|
|
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
2020-08-27 16:14:04 -05:00
|
|
|
{% if prefix | ipv4 and name not in vnet_intfs %}
|
2020-04-23 11:42:22 -05:00
|
|
|
network {{ prefix }}
|
2020-08-27 16:14:04 -05:00
|
|
|
{% elif prefix | ipv6 and name not in vnet_intfs %}
|
2020-04-23 11:42:22 -05:00
|
|
|
address-family ipv6
|
|
|
|
network {{ prefix }}
|
|
|
|
exit-address-family
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endblock vlan_advertisement %}
|
|
|
|
!
|
|
|
|
!
|
2020-05-13 10:56:01 -05:00
|
|
|
{% if DEVICE_METADATA['localhost']['sub_role'] == 'FrontEnd' %}
|
2020-06-16 08:45:45 -05:00
|
|
|
address-family ipv4
|
|
|
|
redistribute connected route-map HIDE_INTERNAL
|
|
|
|
exit-address-family
|
|
|
|
address-family ipv6
|
|
|
|
redistribute connected route-map HIDE_INTERNAL
|
|
|
|
exit-address-family
|
2020-04-23 11:42:22 -05:00
|
|
|
{% endif %}
|
|
|
|
!
|
|
|
|
{% if constants.bgp.maximum_paths.enabled is defined and constants.bgp.maximum_paths.enabled %}
|
|
|
|
{% block maximum_paths %}
|
|
|
|
address-family ipv4
|
|
|
|
maximum-paths {{ constants.bgp.maximum_paths.ipv4 | default(64) }}
|
|
|
|
exit-address-family
|
|
|
|
address-family ipv6
|
|
|
|
maximum-paths {{ constants.bgp.maximum_paths.ipv6 | default(64) }}
|
|
|
|
exit-address-family
|
|
|
|
{% endblock maximum_paths %}
|
|
|
|
{% endif %}
|
|
|
|
!
|
|
|
|
! end of template: bgpd/bgpd.main.conf.j2
|
|
|
|
!
|