Skip to content

Commit 3f2f29d

Browse files
authored
Refactor IPv6 disable logic and add 'disable' option (#9326)
Replaces previous IPv6 disabling method with a dedicated 'disable' option, storing sysctl settings in /etc/sysctl.d/99-disable-ipv6.conf. Updates build and install scripts to clarify the difference between 'none' (no assignment) and 'disable' (fully disables IPv6), adds user warnings, and disables IPv6 listeners in nginx if present.
1 parent 636b0d3 commit 3f2f29d

File tree

3 files changed

+33
-17
lines changed

3 files changed

+33
-17
lines changed

misc/alpine-install.func

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,17 @@ load_functions
1313
verb_ip6() {
1414
set_std_mode # Set STD mode based on VERBOSE
1515

16-
if [ "$IPV6_METHOD" == "none" ] || [ "$DISABLEIPV6" == "yes" ]; then
17-
msg_info "Disabling IPv6"
16+
if [ "$IPV6_METHOD" == "disable" ]; then
17+
msg_info "Disabling IPv6 (this may affect some services)"
1818
$STD sysctl -w net.ipv6.conf.all.disable_ipv6=1
1919
$STD sysctl -w net.ipv6.conf.default.disable_ipv6=1
2020
$STD sysctl -w net.ipv6.conf.lo.disable_ipv6=1
21-
echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf
22-
echo "net.ipv6.conf.default.disable_ipv6 = 1" >>/etc/sysctl.conf
23-
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >>/etc/sysctl.conf
21+
mkdir -p /etc/sysctl.d
22+
$STD tee /etc/sysctl.d/99-disable-ipv6.conf >/dev/null <<EOF
23+
net.ipv6.conf.all.disable_ipv6 = 1
24+
net.ipv6.conf.default.disable_ipv6 = 1
25+
net.ipv6.conf.lo.disable_ipv6 = 1
26+
EOF
2427
$STD rc-update add sysctl default
2528
msg_ok "Disabled IPv6"
2629
fi

misc/build.func

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,11 +627,12 @@ advanced_settings() {
627627
# IPv6 Address Management selection
628628
while true; do
629629
IPV6_METHOD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --menu \
630-
"Select IPv6 Address Management Type:" 15 58 4 \
631-
"auto" "SLAAC/AUTO (recommended, default)" \
632-
"dhcp" "DHCPv6" \
633-
"static" "Static (manual entry)" \
634-
"none" "Disabled" \
630+
"Select IPv6 Address Management Type:" 16 70 5 \
631+
"auto" "SLAAC/AUTO (recommended) - Dynamic IPv6 from network" \
632+
"dhcp" "DHCPv6 - DHCP-assigned IPv6 address" \
633+
"static" "Static - Manual IPv6 address configuration" \
634+
"none" "None - No IPv6 assignment (most containers)" \
635+
"disable" "Fully Disabled - (breaks some services)" \
635636
--default-item "auto" 3>&1 1>&2 2>&3)
636637
[ $? -ne 0 ] && exit_script
637638

@@ -680,7 +681,15 @@ advanced_settings() {
680681
break
681682
;;
682683
none)
683-
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}Disabled${CL}"
684+
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}None${CL}"
685+
IPV6_ADDR="none"
686+
IPV6_GATE=""
687+
break
688+
;;
689+
disable)
690+
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox \
691+
"⚠️ WARNING - FULLY DISABLE IPv6:\n\nThis will completely disable IPv6 inside the container via sysctl.\n\nSide Effects:\n • Services requiring IPv6 will fail\n • Localhost IPv6 (::1) will not work\n • Some applications may not start\n\nOnly use if you have a specific reason to completely disable IPv6.\n\nFor most use cases, select 'None' instead." 14 70
692+
echo -e "${NETWORK}${BOLD}${DGN}IPv6: ${BGN}Fully Disabled (IPv6 disabled via sysctl)${CL}"
684693
IPV6_ADDR="none"
685694
IPV6_GATE=""
686695
break

misc/install.func

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ load_functions
1515
verb_ip6() {
1616
set_std_mode # Set STD mode based on VERBOSE
1717

18-
if [ "$IPV6_METHOD" == "none" ] || [ "$DISABLEIPV6" == "yes" ]; then
19-
msg_info "Disabling IPv6"
20-
$STD echo "net.ipv6.conf.all.disable_ipv6 = 1" >>/etc/sysctl.conf
21-
$STD echo "net.ipv6.conf.default.disable_ipv6 = 1" >>/etc/sysctl.conf
22-
$STD echo "net.ipv6.conf.lo.disable_ipv6 = 1" >>/etc/sysctl.conf
23-
$STD sysctl -p
18+
if [ "$IPV6_METHOD" == "disable" ]; then
19+
msg_info "Disabling IPv6 (this may affect some services)"
20+
mkdir -p /etc/sysctl.d
21+
$STD tee /etc/sysctl.d/99-disable-ipv6.conf >/dev/null <<EOF
22+
# Disable IPv6 (set by community-scripts)
23+
net.ipv6.conf.all.disable_ipv6 = 1
24+
net.ipv6.conf.default.disable_ipv6 = 1
25+
net.ipv6.conf.lo.disable_ipv6 = 1
26+
EOF
27+
$STD sysctl -p /etc/sysctl.d/99-disable-ipv6.conf
2428
msg_ok "Disabled IPv6"
2529
fi
2630
}

0 commit comments

Comments
 (0)