Add granular IPv6 disable option to setup scripts

Expanded IPv6 configuration in build.func to include a 'disable' option with clearer descriptions. Updated install.func to use IPV6_METHOD for disabling IPv6 via sysctl.d, improving clarity and control over IPv6 management.
This commit is contained in:
CanbiZ 2025-12-02 11:13:11 +01:00
parent d148e28592
commit 9f36d3fac0
2 changed files with 24 additions and 10 deletions

View File

@ -1445,11 +1445,12 @@ advanced_settings() {
if result=$(whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \ if result=$(whiptail --backtitle "Proxmox VE Helper Scripts [Step $STEP/$MAX_STEP]" \
--title "IPv6 CONFIGURATION" \ --title "IPv6 CONFIGURATION" \
--ok-button "Next" --cancel-button "Back" \ --ok-button "Next" --cancel-button "Back" \
--menu "\nSelect IPv6 Address Management:" 16 58 4 \ --menu "\nSelect IPv6 Address Management:" 16 70 5 \
"auto" "SLAAC/AUTO (recommended)" \ "auto" "SLAAC/AUTO (recommended) - Dynamic IPv6 from network" \
"dhcp" "DHCPv6" \ "dhcp" "DHCPv6 - DHCP-assigned IPv6 address" \
"static" "Static (manual entry)" \ "static" "Static - Manual IPv6 address configuration" \
"none" "Disabled" \ "none" "None - No IPv6 assignment (most containers)" \
"disable" "Fully Disabled - (breaks some services)" \
3>&1 1>&2 2>&3); then 3>&1 1>&2 2>&3); then
_ipv6_method="$result" _ipv6_method="$result"
@ -1478,6 +1479,11 @@ advanced_settings() {
_ipv6_gate="" _ipv6_gate=""
((STEP++)) ((STEP++))
;; ;;
disable)
_ipv6_addr=""
_ipv6_gate=""
((STEP++))
;;
none) none)
_ipv6_addr="none" _ipv6_addr="none"
_ipv6_gate="" _ipv6_gate=""

View File

@ -45,16 +45,24 @@ catch_errors
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# verb_ip6() # verb_ip6()
# #
# - Configures IPv6 based on DISABLEIPV6 variable # - Configures IPv6 based on IPV6_METHOD variable
# - If DISABLEIPV6=yes: disables IPv6 via sysctl # - If IPV6_METHOD=disable: disables IPv6 via sysctl
# - Sets verbose mode via set_std_mode() # - Sets verbose mode via set_std_mode()
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
verb_ip6() { verb_ip6() {
set_std_mode # Set STD mode based on VERBOSE set_std_mode # Set STD mode based on VERBOSE
if [ "$DISABLEIPV6" == "yes" ]; then if [ "$IPV6_METHOD" == "disable" ]; then
echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf msg_info "Disabling IPv6 (this may affect some services)"
$STD sysctl -p mkdir -p /etc/sysctl.d
$STD tee /etc/sysctl.d/99-disable-ipv6.conf >/dev/null <<EOF
# Disable IPv6 (set by community-scripts)
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
EOF
$STD sysctl -p /etc/sysctl.d/99-disable-ipv6.conf
msg_ok "Disabled IPv6"
fi fi
} }