How To disable IPv6 on RHEL6 CentOS 6

On most of the Linux distribution IPv6 is enabled by default, which may cause your internet is slow working. you should better to disable IPv6 protocal in linux system and it maybe increase your web browsing speed or network security.

What Is IPv6?

Internet Protocol version 6 (IPv6) is the latest version of the Internet Protocol (IP), the communications protocol that provides an identification and location system for computers on networks and routes traffic across the Internet. IPv6 was developed by the Internet Engineering Task Force (IETF) to deal with the long-anticipated problem of IPv4 address exhaustion.

How To Check If IPv6 is Enable Or Disable

There are two ways to check if IPv6 is disabled shown as below:
[23:36:33][root@servermox:~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 04:01:3D:AD:61:01
          inet addr:192.168.1.22  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: 1100:1180:0:d0::22:2001/64 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:48804698 errors:0 dropped:0 overruns:0 frame:0
          TX packets:40747086 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:51379710551 (47.8 GiB)  TX bytes:9427197744 (8.7 GiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1092103 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1092103 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:127922114 (121.9 MiB)  TX bytes:127922114 (121.9 MiB)

You can check the above line if containing “inet6 addr”, If yes, you machine is running IPv6 service.

2.check “disable_ipv6″ file to check if IPv6 is disabled,enter:
[23:36:38][root@servermox:~]# cat /proc/sys/net/ipv6/conf/all/disable_ipv6
0

if you get “0” value, it means that IPv6 is enabled and “1” means it is disabled.

How To disable IPv6 on RHEL6 CentOS 6



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

You need to add the following lines at the end of /etc/sysctl.conf file:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1



and edit /etc/sysconfig/network file

NETWORKING_IPV6=no

your /etc/sysconfig/network file must be like this below

NETWORKING=yes
GATEWAY=192.168.1.254
NETWORKING_IPV6=no
HOSTNAME=servermox.servermox.com
DOMAINNAME=servermox.com


add this line to /etc/sysconfig/network-scripts/ifcfg-eth0

IPV6INIT=no



disable iptables6

[23:36:39][root@servermox:~]# chkconfig --level 345 ip6tables off


restart your network service

[23:36:41][root@servermox:~]# service network restart


and then verify your ipv6 no longer active with ifconfig command

PS: if you have more eth interfaces, use brain ;)
Previous
Next Post »