• Home
  • Disclaimer
  • Contact
  • Archives
  • About
  • Subscribe
  • Support
  • Advertise

Kernel Talks

Unix, Linux, & Cloud!

  • How-to guides
    • Howto
    • Disk management
    • Configurations
    • Troubleshooting
  • OS
    • HPUX
    • Linux
  • Miscellaneous
    • Software & Tools
    • Cloud Services
    • System services
    • Virtualization
  • Certification Preparations
    • AWS Certified Solutions Architect – Associate
    • AWS Certified Solutions Architect – Professional
    • AWS Certified SysOps Administrator – Associate
    • AWS Certified Cloud Practitioner
    • Certified Kubernetes Administrator
    • Hashicorp Certified Terraform Associate
    • Oracle Cloud Infrastructure Foundations 2020 – Associate
  • Tips & Tricks
  • Linux commands
You are here: Home / Howto

How to disable IPv6 on Linux

Published: November 13, 2018 | Modified: June 24, 2020



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.

⇠ Previous article
How to install and uninstall Sophos Antivirus in Linux
Next article ⇢
Install and configure checkmk server on Linux

Related stuff:

  • RHEL 8 BETA installation with screenshots
  • Running a pod in Kubernetes
  • lolcat: a tool to rainbow color Linux terminal
  • How to remove password expiry in HPUX HP Unix
  • Ulimit value : All you need to know
  • Hyperthreading in HPUX
  • How to add UUID entry in /etc/fstab in Linux
  • How to start, stop and reload postfix
  • How to run your script with system boot in HPUX
  • How to convert JKS file to KEY file for Apache
  • How to find the process using high memory in Linux
  • LVM commands tutorial : Part 1 : Physical Volume (pvchange, pvmove)

Filed Under: Howto, Linux Tagged With: check if ipv6 is disabled, disable ipv6 in rhel, disable ipv6 in suse, disable ipv6 in ubuntu

If you like my tutorials and if they helped you in any way, then

  • Consider buying me a cup of coffee via paypal!
  • Subscribe to our newsletter here!
  • Like KernelTalks Facebook page.
  • Follow us on Twitter.
  • Add our RSS feed to your feed reader.

Comments

  1. ayam says

    November 15, 2018 at 7:29 am

    ipv6.disable=1
    for sysv based system

    Reply
  2. Harri says

    November 15, 2018 at 10:59 am

    Why would you wanna do that? IPv6 works very well.

    Reply
    • Max says

      January 22, 2021 at 7:19 am

      my LG laptop has bizarre issues with IPV6. I used Manjaro and now I use Arch. Wi-Fi and cable connection kept turning on and off until I disabled IPV6

      Reply
  3. Daniel says

    November 15, 2018 at 5:08 pm

    You shouldn’t disable IPv6! Fix your actual networking issues instead.

    Reply
  4. Robert Wm Ruedisueli says

    November 16, 2018 at 2:15 pm

    Is there any way to hide the IPv6 (or IPv4) capability from an application to force it to use one or the other?

    Sometimes you have one program that still has bugs in it’s IPv6 application layer stack, and this might address said bugs.

    Reply

Share Your Comments & Feedback: Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get fresh content from KernelTalks

  • Email
  • Facebook
  • RSS
  • Twitter

Get Linux & Unix stuff right into your mailbox. Subscribe now!

* indicates required

This work is licensed under a CC-BY-NC license · Privacy Policy
© Copyright 2016-2023 KernelTalks · All Rights Reserved.
The content is copyrighted to Shrikant Lavhate & can not be reproduced either online or offline without prior permission.