Disable Ipv6 on Ubuntu 20.04
Simple Way That Worked for a Very Long Time Was Adding in /Etc/Sysctl. Conf Net. Ipv6. Conf. All. Disable_Ipv6 = 1 Net. Ipv6. Conf. Default. Disable_Ipv6 = 1...
Simple way that worked for a very long time was adding in /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Afterwards sysctl -p for activation of the setting.
It works for a while, but suddenly the IPv6 is enabled.
We are facing two things:
- IPv6 is randomly enabled
- After restart of the server, IPv6 is enabled again.
Checking the proc:
$ cat /proc/sys/net/ipv6/conf/eth0/disable_ipv6
1
I want this disabled, there is a postfix server and gmail is objecting while IPv6 is active.
1 Answer
To permanently disable ipv6, you can update your grub file. You'll need administrative rights.
Edit /etc/default/grub with your preferred text editor. Make sure ipv6.disable=1 is added to the GRUB_CMDLINE_LINUX lines as follows:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"
Then
sudo update-grub
And you should be good after a reboot.