exit: determine uplink gateway address from interface address
So we can actually drop the gateway custom field from NetBox interfaces.
This commit is contained in:
parent
a2d7174829
commit
09eb030e32
|
@ -11,8 +11,16 @@ service integrated-vtysh-config
|
||||||
|
|
||||||
# Route to the outside world.
|
# Route to the outside world.
|
||||||
vrf outside
|
vrf outside
|
||||||
ip route 0.0.0.0/0 {{ (interfaces | selectattr('name', '==', iface_uplink) | first).custom_fields.gateway.address | ipaddr('address') }} {{ iface_uplink }}
|
{# Add default routes for IPv4 and IPv6. Both are over link-local addresses. #}
|
||||||
ipv6 route ::/0 fe80::2 {{ iface_uplink }}
|
{% set uplink = interfaces | selectattr('name', '==', iface_uplink) | first %}
|
||||||
|
{% for address in uplink.ip_addresses %}
|
||||||
|
{% set gateway = address.address | ipmath(1) %}
|
||||||
|
{% if address.family.value == 4 %}
|
||||||
|
ip route 0.0.0.0/0 {{ gateway }} {{ iface_uplink }}
|
||||||
|
{% else %}
|
||||||
|
ipv6 route ::/0 {{ gateway }} {{ iface_uplink }}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
# Route installation into kernel fails (rarely) without this option.
|
# Route installation into kernel fails (rarely) without this option.
|
||||||
# It is not documented anywhere and appears to be a Cumulus extension.
|
# It is not documented anywhere and appears to be a Cumulus extension.
|
||||||
|
|
Loading…
Reference in a new issue