If I run ifconfig I can see that there are no ipv6 addresses assigned to any of the interfaces. I get an error telling that the address family is not supported if I try to create AF_INET6 socket. I do not have /proc/sys/net/inet6 folder. The machine runs Debian 10 (buster). In /etc/default/grub there is no lines about ipv6 disabling.
$ uname -r
4.19.52.1.amd64-smp
Could you, please, tell how can I enable ipv6? I find many articles on how to disable it but not how to enable it.
1 Answer 1
There are many ways to disable IPv6 in Linux, so you'll have to check for them all.
First, your kernel version does not quite look like Debian 10 standard AMD64 kernel. If you are using a custom kernel, IPv6 may be disabled at kernel compilation time, in which case you'll need to recompile the kernel (or switch to another kernel) to get it enabled.
Please run
grep CONFIG_IPV6= /boot/config-$(uname -r)
and see what it says. Or if the /boot/config-<kernel version>
file does not exist, run this command instead:
modprobe configs; zcat /proc/config.gz | grep CONFIG_IPV6=
If the response is nothing at all, or includes a line:
# CONFIG_IPV6 is not set
then your current kernel had its IPv6 support disabled at compilation time. In this case, you would have to install a new kernel package (or build and install a custom kernel) to enable IPv6.
If the response includes a line:
CONFIG_IPV6=m
then the IPv6 support is compiled as a kernel module.
If there is instead a line:
CONFIG_IPV6=y
then IPv6 support is compiled in to the main kernel. In this case, one way to disable IPv6 would be to add boot option ipv6.disable=1
to the kernel command line (in /etc/default/grub
if using GRUB bootloader, or in /boot/cmdline.txt
on a Raspberry Pi bootloader) but you said you've already checked for that.
IPv6 compiled as a module
Please run modprobe -c |grep "options ipv6"
as root. If the response includes a line:
options ipv6 disable=1
or
options ipv6 disable_ipv6=1
then IPv6 is disabled by kernel module configuration, and you should find that line in one of the files in /etc/modprobe.d
.
To re-enable IPv6 in this case, find that line, comment it out, and run update-initramfs -u
as root to make sure IPv6 does not get disabled at early boot, as this disabling strategy may require a reboot to re-enable.
(In theory, unloading and re-loading the ipv6
after commenting out the disable option should suffice, but because of dependencies between modules, it might be hard to actually do without rebooting.)
Methods applicable for both modular and compiled-in IPv6
You should also check the sysctl settings:
grep "disable_ipv6" /etc/sysctl.conf /etc/sysctl.d/*.conf
If the output includes lines like this, then IPv6 has been disabled through sysctl settings:
net.ipv6.conf.<something>.disable_ipv6 = 1
Here, <something>
might be the word all
or default
, or a name of a specific network interface. To re-enable, comment out the disable_ipv6
lines and run sysctl -p
as root, then reboot (or just reconfigure your network interfaces).
-
Thank you very much for such a great answer! For me, it turned out "CONFIG_IPV6=m" and "options ipv6 disable=1 disable_ipv6=1".JenyaKh– JenyaKh2019年08月31日 19:49:06 +00:00Commented Aug 31, 2019 at 19:49
-
What if none of these options work? I've got an old Raspberry Pi Model B that I've updated to Buster. I want to enable IPv6. There's no IPV6 in
/boot/config.txt
(only a single one on the Pi),modprobe -c
doesn't mention ipv6, and it isn't in sysctl config files.IBBoard– IBBoard2022年08月31日 10:20:39 +00:00Commented Aug 31, 2022 at 10:20 -
1@IBBoard You are looking at the Pi bootloader config (
/boot/config.txt
). The file I was referring to was the kernel build-time config file (/boot/config-$(uname -r)
), which still existed on x86 Debian 10, but RasPis apparently have moved on to use the in-kernel config information. Instead, runmodprobe configs; zcat /proc/config.gz | grep CONFIG_IPV6=
and you should see theCONFIG_IPV6
setting if the IPv6 support is built either as a module or in the main kernel. If you get nothing at all, then IPv6 was disabled at kernel build time.telcoM– telcoM2022年08月31日 14:14:52 +00:00Commented Aug 31, 2022 at 14:14 -
@IBBoard on a RasPi bootloader, the kernel boot options are defined in
/boot/cmdline.txt
.telcoM– telcoM2022年08月31日 14:28:37 +00:00Commented Aug 31, 2022 at 14:28 -
@telcoM Ah - I assumed the difference was just a Pi-ism rather than being a completely different config file. That's an unhelpful way for them to name it! My problem ended up being an ill-advised run of
rpi-update
that updated the kernel too far/used a bad build. I ignored the warning because new firmware seemed like a good idea when moving from Stretch to Bullseye and was in the blog post that I read on upgrading. Reinstalled the original Pi bootloader throughapt
and it all works now with no changes 🙂IBBoard– IBBoard2022年09月01日 16:23:49 +00:00Commented Sep 1, 2022 at 16:23