Re: Dual-stack preseeding
Mer 10 sept 2025, à 21:37, Jonathan Leroy a écrit :
> Is there a way to configure a dual-stack network interface using
> preseeding whitout relying on things like a custom script run by
> preseed/late_command?
FWIW, I got around the issue by adding this script as preseed/late_command:
====================================================
fix_network() {
# Enable DHCPv4 on main interface if only IPv6 is enabled.
# Does the system have a default IPv4 route?
has_ipv4="$(ip -4 route show default)"
if [ -n "${has_ipv4}" ]
then
echo "This system already has an IPv4 route, skipping DHCPv4" \
"configuration."
return
fi
# shellcheck disable=SC2312
#
# "default via fe80::1 dev enp1s0 metric 1024 onlink pref medium"
# => "enp1s0"
main_iface="$(ip -6 route show default | cut -d ' ' -f 5)"
if [ -z "${main_iface}" ]
then
# Should never happen as we are doing a netinstall.
echo "Error: No IPv4 or IPv6 route found, this system network isn't" \
"correctly configured."
exit 1
fi
echo "Main network interface: ${main_iface}"
# "-e" enable interpretation of backslash escapes (disabled by default
# in BusyBox's sh).
echo -e "allow-hotplug ${main_iface}\niface ${main_iface} inet dhcp\n" \
> "/target/etc/network/interfaces.d/00-${main_iface}-dhcp"
echo "DHCPv4 enabled on ${main_iface} interface."
}
echo "Checking network configuration..."
fix_network
====================================================
--
Jonathan Leroy
Reply to: