Home > Linux > How-To disable IPv6 on RHEL6 / CentOS 6 / etc

How-To disable IPv6 on RHEL6 / CentOS 6 / etc

Proper way of disabling IPv6 subsytem in RedHat Linux 6 / CentOS 6 (dont unload modules or so)

in /etc/sysctl.conf  :  net.ipv6.conf.all.disable_ipv6 = 1

in /etc/sysconfig/network  : NETWORKING_IPV6=no

in /etc/sysconfig/network-scripts/ifcfg-eth0 : IPV6INIT=”no”

disable iptables6 – chkconfig –level 345 ip6tables off

reboot

done 😉

PS: if you have more eth interfaces, use brain 😉

Categories: Linux Tags: ,
  1. peacengell
    June 11th, 2013 at 08:28 | #1

    Here is a little tips

    run this command

    echo “net.ipv6.conf.all.disable_ipv6=1” > /etc/sysctl.conf ; cat /etc/sysctl.conf ; reboot.

    EDIT by ADMIN : DO NOT USE > – it will make empty file. Instead use >> – it will add at the end of file !!

  2. June 14th, 2013 at 10:50 | #2

    Remember to use “>>” rather than “>” if using peacenell’s command above, to append (rather than overwrite) /etc/sysctl.conf 😉

  3. June 21st, 2013 at 13:24 | #3

    @peacengell
    Dude… that command will empty /etc/sysctl.conf from its previous contents…

  4. Amber
    June 24th, 2013 at 16:55 | #4

    @peacengell

    just say:

    echo “net.ipv6.conf.all.disable_ipv6=1” > /etc/sysctl.conf && sysctl -f /etc/sysctl.conf

    need no reboot 😉

  5. July 16th, 2013 at 10:54 | #5

    Yes, but use two “>” arrows, not one!

    echo “net.ipv6.conf.all.disable_ipv6=1″ >> /etc/sysctl.conf
    not
    echo “net.ipv6.conf.all.disable_ipv6=1″ > /etc/sysctl.conf

  6. CDSU
    August 9th, 2013 at 21:41 | #6

    all of this is WRONG!!!!!!!!!!!! The correct answer is as follows:
    echo “net.ipv6.conf.default.disable_ipv6=1” >> /etc/sysctl.conf
    echo “net.ipv6.conf.all.disable_ipv6 = 1” >> /etc/sysctl.conf
    then run the following command
    sysctl -p
    no reboot is required
    note the space before and after the =
    if you want to test the config on the fly without editing the sysctl.conf file execute the following commands

    sysctl -w net.ipv6.conf.default.disable_ipv6=1
    sysctl -w net.ipv6.conf.all.disable_ipv6=1

    in the command line you do not use any spaces around the =

    Good Luck !!

  7. September 15th, 2013 at 22:07 | #7

    @peacengell
    Please delete (or at least fix) this comment before somebody actually empties their sysctl.conf file

  8. wangyanfu
    December 21st, 2013 at 02:58 | #8

    thank you
    how about
    # echo “install ipv6 /bin/true” > /etc/modprobe.d/disable_ipv6.conf

  9. Víctor
    January 17th, 2014 at 13:30 | #9
  10. psrelated
    April 10th, 2014 at 13:39 | #10

    @CDSU
    Only one that works. Thank u so much. After 48 hours of mind numbing frustration, i finally have my new dedicated server working! 🙂 If u are a chick (i realize the chances are quite low, i would soooo take u out to a dinner dinner 🙂

  11. vb
    September 27th, 2014 at 20:13 | #11

    @CDSU

    [root@Adi openvpn-als]# echo “net.ipv6.conf.default.disable_ipv6=1″ >> /etc/sysctl.conf
    [root@Adi openvpn-als]# echo “net.ipv6.conf.all.disable_ipv6 = 1″ >> /etc/sysctl.conf
    [root@Adi openvpn-als]# sysctl -p
    sysctl: cannot stat /proc/sys/“net/ipv6/conf/default/disable_ipv6: No such file or directory
    sysctl: cannot stat /proc/sys/“net/ipv6/conf/all/disable_ipv6: No such file or directory
    [root@Adi openvpn-als]#

  12. Najim
    April 15th, 2015 at 14:46 | #12

    edit the file ; /etc/sysctl.conf and add :
    net.ipv6.conf.default.disable_ipv6 = 1
    net.ipv6.conf.all.disable_ipv6 = 1
    and save the fale; restart the network service
    #service network restart

  13. mrbusdriversir
    May 25th, 2015 at 14:17 | #13

    Just wondering why you didn’t disable the iptables6 in run level 2 and only in run levels 3,4, and 5.

    “disable iptables6 – chkconfig –level 345 ip6tables off”

    On my Centos 6.6 this service is on in levels 2, 3, 4, and 5. I am new in Linux and I am trying understand why things are done in a particular way so I don’t end up breaking the system.

    Thanks.

  14. DingoandtheBaby
    October 20th, 2015 at 22:55 | #14

    Much simpler option:

    # sysctl -w net.ipv6.conf.all.disable_ipv6=1
    # echo “net.ipv6.conf.all.disable_ipv6 = 1” >>/etc/sysctl.conf

    No reboot required, and yes, it will persist when reboot.

    Changing the active kernel parameter does not require rebooting the system to take effect.

  15. Bryon
    April 12th, 2016 at 12:43 | #15

    Admin, please edit and fix the multiple comments providing a stdout redirection that overwrites /etc/sysctl.conf without append!

    My tired morning eyes made the mistake on a test system and I’ve lost sysctl.conf.. Yes, it’s my own fault entirely (grumble grumble don’t paste commands from the internet…), but potentially countless others have done the same thing, without a resolution!

  1. No trackbacks yet.

%d bloggers like this: