Disable IPv6 within LCX container

Airw0lf

Active Member
Apr 11, 2021
83
5
28
it-visibility.net
I have read several topics on disabling IPv6 in a LCX container.
And made changes to /etc/sysctl.conf being:
sysctl net.ipv6.conf.all.disable_ipv6=1
sysctl net.ipv6.conf.default.disable_ipv6=1

This was done for the Proxmox hosts, the VM's and the LCX containers.

But still... within the LCX containers all interfaces have a local IPv6 address.
Which is not the case for the host- and the VM's.

How do I disable those local IPv6 addresses as well?

If relevant: I use ifupdown all the way.


Thank you - Will
 
Last edited:
Interesting. I have multiple lxc with that config and when doing
Code:
ip a
there are no inet6 results showing. I have also disabled ipv6 on the proxmox host as well with the same config and I have no inet6 results there. Seems you may have other issues that are forcing ipv6. I also remove any ipv6 lines from the /etc/hosts file.
 
Interesting. I have multiple lxc with that config and when doing
Code:
ip a
there are no inet6 results showing. I have also disabled ipv6 on the proxmox host as well with the same config and I have no inet6 results there. Seems you may have other issues that are forcing ipv6. I also remove any ipv6 lines from the /etc/hosts file.
Same here on both counts.
No inet6/IPv6 things on the host and VM's - just the LXC's.
 
Add these 3 lines to the end of /etc/sysctl.conf in your container and reboot.
Code:
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1

This only works in Debian lxc.
Also give a "sysctl -p" command after adding the 'disable' lines in sysctl.conf.

If you are using Ubuntu lxc these "disable" lines do not work.
Still looking for a solution myself for my Ubuntu containers.
 
If you are booting/using GRUB, try this (and run "update-grub" after editing) :

- edit "/etc/default/grub"
- this is without iommu enabled:
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Proxmox Virtual Environment"
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

mine looks like this with iommu enabled:
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Proxmox Virtual Environment"
GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet intel_iommu=on iommu=pt"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

Now I have another PVE host that uses/boots with systemd-boot.
This will be very similar, let me test and come back with an answer.
 
Last edited:
For systemd-boot :

add this to your line in /etc/kernel/cmdline: ipv6.disable=1
then run: proxmox-boot-tool refresh
restart PVE host

But beware that a lot of messages in your PVE host log will appear about ipv6 and iptables.
I disabled pve-firewall because I just run a simpel home lab.