File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -310,10 +310,16 @@ if [ "${ADJUSTED_ID}" = "debian" ] && command -v update-ca-certificates > /dev/n
310310 update-ca-certificates
311311fi
312312
313- # Swap to legacy iptables for compatibility (Debian only)
314313if [ " ${ADJUSTED_ID} " = " debian" ] && type iptables-legacy > /dev/null 2>&1 ; then
315- update-alternatives --set iptables /usr/sbin/iptables-legacy
316- update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
314+ # Check if host kernel supports ip_tables/iptable_nat
315+ if iptables-legacy -t nat -L > /dev/null 2>&1 ; then
316+ update-alternatives --set iptables /usr/sbin/iptables-legacy
317+ update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
318+ else
319+ # first appeared in Ubuntu ≥ 26.04
320+ update-alternatives --set iptables /usr/sbin/iptables-nft
321+ update-alternatives --set ip6tables /usr/sbin/ip6tables-nft
322+ fi
317323fi
318324
319325# Set up the necessary repositories
You can’t perform that action at this time.
0 commit comments