Tag Archives: disable ipv6 in rhel

How to disable IPv6 on Linux

Short post on how to disable IPv6 in RHEL, Suse or Ubuntu Linux.

Disable IPv6 on RHEL, SUSE, Ubuntu Linux

How to disable IPv6 in RHEL 7

Edit /etc/default/grub and append ipv6.disable=1 to GRUB_CMDLINE_LINUXline like below :

GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/swap crashkernel=auto rd.lvm.lv=rhel/root ipv6.disable=1"

Now, you need to regenerate the grub.cfg file by running the grub2-mkconfig command :

root@kerneltalks # grub2-mkconfig -o /boot/grub2/grub.cfg

That’s it. Reboot and it will disable IPv6 on your system.

Another method is to disable it using /etc/sysctl.d/ipv6.conf file.

Add below entry in file :

# To disable for all interfaces
net.ipv6.conf.all.disable_ipv6 = 1
#Disable default
net.ipv6.conf.default.disable_ipv6 = 1
#Disable on loopback
net.ipv6.conf.lo.disable_ipv6 = 1

Now, reload sysctl file,

root@kerneltalks # sysctl -p /etc/sysctl.d/ipv6.conf

You need to re-build the Initial RAM Disk as well. You can do it using :

root@kerneltalks # dracut -f

That’s it. You are done.

Disable IPv6 in RHEL 6

Create a new file /etc/modprobe.d/ipv6.conf with below one liner –

root@kerneltalks # echo "options ipv6 disable=1" >/etc/modprobe.d/ipv6.conf

Stop ip6tables service from loading at boot by using chkconfig

root@kerneltalks # chkconfig ip6tables off

And you are done Reboot the system to run it without IPv6.

Disable IPv6 in Suse Linux

Add below lines 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

Reload file with sysctl -p and you are done.

If you are having GUI access of server then  you can do it under network settings. Navigate to Applications > System Tools > YaST > Network Settings . Goto Global Options tab and uncheck Enable IPv6.

Disable ipv6 in suse

You will require to reboot server to take this effect.

Disable IPv6 in Ubuntu Linux

Above process of Suse Linux applies to ubuntu as well. You need to edit /etc/sysctl.conf and add above lines. Reload the file with sysctl -p and you are done.

To verify if IPv6 is disabled on server use below command –

root@kerneltalks # cat /proc/sys/net/ipv6/conf/all/disable_ipv6

If output is 1 then IPv6 is disabled. If output is 0 then IPv6 is enabled.