Disable IPv6 on Debian installations and LXC containers

On LXC containers, you may also need to disable IPv6 at the host/container configuration level depending on your hypervisor, in Proxmox, uncheck the IPv6 DHCP/SLAAC option on the container’s network interface.

  1. Create the sysctl configuration file: sudo touch /etc/sysctl.d/99-disable-ipv6.conf
  2. Add the following: sudo vi /etc/sysctl.d/99-disable-ipv6.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
  1. Apply the changes: sudo sysctl --system Verify IPv6 is disabled:ip -6 addr, if the output is empty, IPv6 has been successfully disabled

Re-enable IPv6

  1. Remove the configuration file /rm /etc/sysctl.d/99-disable-ipv6.conf
  2. Apply the changes: sudo sysctl --system