From 39fec47f876d6364926b99f8411761a44ab49888 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 7 May 2025 12:25:43 +0200 Subject: [PATCH] =?UTF-8?q?alpine:=20don=E2=80=99t=20set=20IPv6=20gateway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Will get it from RA. Also don’t disable SLAAC for IPv4‐only interfaces. --- roles/alpine/templates/interfaces.j2 | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/roles/alpine/templates/interfaces.j2 b/roles/alpine/templates/interfaces.j2 index 57568cb..2c883ed 100644 --- a/roles/alpine/templates/interfaces.j2 +++ b/roles/alpine/templates/interfaces.j2 @@ -4,15 +4,21 @@ iface lo inet loopback {% for iface in interfaces | selectattr('enabled') %} auto {{ iface.name }} iface {{ iface.name }} inet static -{% for ip in iface.ip_addresses %} - address {{ ip.address }} -{% set subnet = ip.address | ipaddr('subnet') %} +{% for address in iface.ip_addresses %} + address {{ address.address }} +{% if address.family.value == 4 %} +{% set subnet = address.address | ipaddr('subnet') %} {% set prefix = prefixes | selectattr('prefix', '==', subnet) | first %} {% set gateway = prefix.custom_fields.gateway.address %} -{% if gateway is defined and gateway != ip.address %} +{% if gateway is defined and gateway != address.address %} gateway {{ gateway | ipaddr('address') }} {% endif %} -{% endfor %} +{% endif %} +{% endfor -%} + +{# disable SLAAC if we have a manually set IPv6 address #} +{% if iface.ip_addresses | selectattr("family.value", "==", 6) %} pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf +{% endif %} {% endfor %}