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 😉
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 !!
Remember to use “>>” rather than “>” if using peacenell’s command above, to append (rather than overwrite) /etc/sysctl.conf 😉
@peacengell
Dude… that command will empty /etc/sysctl.conf from its previous contents…
@peacengell
just say:
echo “net.ipv6.conf.all.disable_ipv6=1” > /etc/sysctl.conf && sysctl -f /etc/sysctl.conf
need no reboot 😉
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
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 !!
@peacengell
Please delete (or at least fix) this comment before somebody actually empties their sysctl.conf file
thank you
how about
# echo “install ipv6 /bin/true” > /etc/modprobe.d/disable_ipv6.conf
Recommended solution at: https://access.redhat.com/site/solutions/8709
@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 🙂
@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]#
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
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.
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.
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!