2017-01-19 22:56:26 -06:00
|
|
|
!
|
|
|
|
{% block banner %}
|
|
|
|
! =========== Managed by sonic-cfggen DO NOT edit manually! ====================
|
2017-09-12 16:13:27 -05:00
|
|
|
! generated by templates/quagga/bgpd.conf.j2 with config DB data
|
2017-01-19 22:56:26 -06:00
|
|
|
! file: bgpd.conf
|
|
|
|
!
|
|
|
|
{% endblock banner %}
|
|
|
|
!
|
|
|
|
{% block system_init %}
|
2017-09-12 16:13:27 -05:00
|
|
|
hostname {{ DEVICE_METADATA['localhost']['hostname'] }}
|
2017-01-19 22:56:26 -06:00
|
|
|
password zebra
|
|
|
|
log syslog informational
|
|
|
|
log facility local4
|
|
|
|
! enable password {# {{ en_passwd }} TODO: param needed #}
|
|
|
|
{% endblock system_init %}
|
|
|
|
!
|
|
|
|
{% block bgp_init %}
|
|
|
|
!
|
|
|
|
! bgp multiple-instance
|
|
|
|
!
|
2017-08-08 18:23:58 -05:00
|
|
|
router bgp {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
2017-01-19 22:56:26 -06:00
|
|
|
bgp log-neighbor-changes
|
|
|
|
bgp bestpath as-path multipath-relax
|
2017-08-23 04:50:39 -05:00
|
|
|
no bgp default ipv4-unicast
|
2017-01-19 22:56:26 -06:00
|
|
|
{# TODO: use lo[0] for backward compatibility, will revisit the case with multiple lo interfaces #}
|
2017-09-12 16:13:27 -05:00
|
|
|
bgp router-id {{ LOOPBACK_INTERFACE.keys()[0][1] }}
|
2017-01-19 22:56:26 -06:00
|
|
|
{# advertise loopback #}
|
2017-09-12 16:13:27 -05:00
|
|
|
{% for (name, prefix) in LOOPBACK_INTERFACE %}
|
|
|
|
{% if prefix | ipv4 %}
|
|
|
|
network {{ prefix | ip }}/32
|
|
|
|
{% elif prefix | ipv6 %}
|
2017-01-19 22:56:26 -06:00
|
|
|
address-family ipv6
|
2017-09-12 16:13:27 -05:00
|
|
|
network {{ prefix | ip }}/128
|
2017-01-19 22:56:26 -06:00
|
|
|
exit-address-family
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endblock bgp_init %}
|
|
|
|
{% block vlan_advertisement %}
|
2017-09-12 16:13:27 -05:00
|
|
|
{% for (name, prefix) in VLAN_INTERFACE %}
|
|
|
|
{% if prefix | ipv4 %}
|
|
|
|
network {{ prefix }}
|
|
|
|
{% elif prefix | ipv6 %}
|
2017-06-10 19:05:48 -05:00
|
|
|
address-family ipv6
|
2017-09-12 16:13:27 -05:00
|
|
|
network {{ prefix }}
|
2017-06-10 19:05:48 -05:00
|
|
|
exit-address-family
|
|
|
|
{% endif %}
|
2017-01-19 22:56:26 -06:00
|
|
|
{% endfor %}
|
|
|
|
{% endblock vlan_advertisement %}
|
|
|
|
{% block bgp_sessions %}
|
2017-08-08 18:23:58 -05:00
|
|
|
{% for neighbor_addr, bgp_session in BGP_NEIGHBOR.iteritems() %}
|
2017-09-13 23:23:06 -05:00
|
|
|
{% if bgp_session['asn'] | int != 0 %}
|
2017-08-08 18:23:58 -05:00
|
|
|
neighbor {{ neighbor_addr }} remote-as {{ bgp_session['asn'] }}
|
|
|
|
neighbor {{ neighbor_addr }} description {{ bgp_session['name'] }}
|
2017-10-11 17:31:38 -05:00
|
|
|
neighbor {{ neighbor_addr }} timers {{ bgp_session['keepalive'] }} {{ bgp_session['holdtime'] }}
|
2017-09-12 16:13:27 -05:00
|
|
|
{% if DEVICE_METADATA['localhost']['type'] == 'ToRRouter' %}
|
2017-08-08 18:23:58 -05:00
|
|
|
neighbor {{ neighbor_addr }} allowas-in 1
|
2017-02-07 02:28:30 -06:00
|
|
|
{% endif %}
|
2017-08-23 04:50:39 -05:00
|
|
|
{% if neighbor_addr | ipv4 %}
|
|
|
|
address-family ipv4
|
|
|
|
neighbor {{ neighbor_addr }} activate
|
2017-09-13 23:23:06 -05:00
|
|
|
{% if bgp_session['rrclient'] | int != 0 %}
|
2017-09-12 17:48:38 -05:00
|
|
|
neighbor {{ neighbor_addr }} route-reflector-client
|
2017-10-11 17:31:38 -05:00
|
|
|
{% endif %}
|
|
|
|
{% if bgp_session['nhopself'] | int != 0 %}
|
|
|
|
neighbor {{ neighbor_addr }} next-hop-self
|
2017-09-12 17:48:38 -05:00
|
|
|
{% endif %}
|
2017-08-23 04:50:39 -05:00
|
|
|
maximum-paths 64
|
|
|
|
exit-address-family
|
|
|
|
{% endif %}
|
2017-08-08 18:23:58 -05:00
|
|
|
{% if neighbor_addr | ipv6 %}
|
2017-01-19 22:56:26 -06:00
|
|
|
address-family ipv6
|
2017-08-08 18:23:58 -05:00
|
|
|
neighbor {{ neighbor_addr }} activate
|
2017-09-13 23:23:06 -05:00
|
|
|
{% if bgp_session['rrclient'] | int != 0 %}
|
2017-09-12 17:48:38 -05:00
|
|
|
neighbor {{ neighbor_addr }} route-reflector-client
|
2017-10-11 17:31:38 -05:00
|
|
|
{% endif %}
|
|
|
|
{% if bgp_session['nhopself'] | int != 0 %}
|
|
|
|
neighbor {{ neighbor_addr }} next-hop-self
|
|
|
|
{% endif %}
|
|
|
|
{% if bgp_session['asn'] != DEVICE_METADATA['localhost']['bgp_asn'] %}
|
|
|
|
neighbor {{ neighbor_addr }} route-map set-next-hop-global-v6 in
|
2017-09-12 17:48:38 -05:00
|
|
|
{% endif %}
|
2017-01-19 22:56:26 -06:00
|
|
|
maximum-paths 64
|
|
|
|
exit-address-family
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endfor %}
|
|
|
|
{% endblock bgp_sessions %}
|
|
|
|
!
|
|
|
|
maximum-paths 64
|
|
|
|
!
|
|
|
|
route-map ISOLATE permit 10
|
2017-08-08 18:23:58 -05:00
|
|
|
set as-path prepend {{ DEVICE_METADATA['localhost']['bgp_asn'] }}
|
2017-01-19 22:56:26 -06:00
|
|
|
!
|
2017-10-11 17:31:38 -05:00
|
|
|
route-map set-next-hop-global-v6 permit 10
|
|
|
|
set ipv6 next-hop prefer-global
|
|
|
|
!
|