Not every server is assigned a public IPv6 address, and on many Linux hosting environments IPv6 can cause unexpected routing issues, slow DNS lookups, or conflicts with certain applications. Disabling IPv6 on CentOS 6.x is a straightforward process that involves editing three configuration files, stopping the ip6tables service, and rebooting. Follow the steps below carefully.
Prerequisites
- CentOS 6.x server (for CentOS 7 / RHEL 7+, see our separate guide — the method differs)
- Root access via SSH
- A scheduled maintenance window — a reboot is required
Step 1: Disable IPv6 in the Kernel via sysctl
Open /etc/sysctl.conf in your preferred editor and add the following two lines at the bottom. The first disables IPv6 on all network interfaces; the second disables it specifically on the loopback interface:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
Apply the changes immediately without rebooting:
sysctl -p
Step 2: Disable IPv6 in the Network Configuration
Edit /etc/sysconfig/network and add or update the following line. This tells the CentOS network stack not to initialize IPv6 networking at boot:
NETWORKING_IPV6=no
Step 3: Disable IPv6 on the Network Interface
Edit the interface configuration file for your primary NIC. On most CentOS 6 systems this is /etc/sysconfig/network-scripts/ifcfg-eth0. If your interface is named differently (e.g. em1, ens3), adjust the filename accordingly. Add the following line:
IPV6INIT=no
Step 4: Stop and Disable the ip6tables Service
Stop the ip6tables firewall service and disable it from starting on boot. On CentOS 6, the service is named ip6tables (not iptables6 — that name causes a “service not found” error):
service ip6tables stop
chkconfig ip6tables --level 345 off
Note: If ip6tables is not installed, you will see a “No such file” error — this is harmless and simply means it was never active.
Step 5: Reboot the Server
A reboot is required for the kernel-level and network-script changes to take full effect:
reboot
Verification
After the server comes back online, confirm IPv6 is fully disabled:
# Should return 1 for both entries
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
cat /proc/sys/net/ipv6/conf/default/disable_ipv6
# Should show no inet6 addresses on any interface
ip addr | grep inet6
If ip addr | grep inet6 returns no output, IPv6 has been successfully disabled on your CentOS 6.x server.
Troubleshooting
- IPv6 still showing after reboot: Verify the
sysctl.confentries were saved correctly and re-runsysctl -pbefore rebooting. - Network interface not named eth0: Run
ip link showto list all interface names and update theifcfg-*file path accordingly. - Using CentOS 7 or RHEL 7+? Use
nmclior a kernel boot parameter (ipv6.disable=1in GRUB) instead — the SysV init approach above does not apply.
