Home / Server / Linux / CentOS / How to Disable IPv6 on CentOS/RHEL 7

How to Disable IPv6 on CentOS/RHEL 7

Post describes procedure to disable IPv6 on CentOS/RHEL 7. There are 2 ways to do this:
1. Disable IPv6 in kernel module (requires reboot)
2. Disable IPv6 using sysctl settings (no reboot required)

First check the ipv6 (enable or disable) on your system, execute:

# ifconfig -a | grep inet6
  inet6 fe43::123:afd:de6a:5db4 prefixlen 64 scopeid 0x20
  inet6 ::1 prefixlen 128 scopeid 0x10

1. Disable IPv6 in kernel module:

To disable ipv6 in kernet module, we needed to edit grub file and add ipv6.disable=1 in GRUB_CMDLINE_LINUX line.

# vim /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="ipv6.disable=1 crashkernel=auto rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
:wq!   (Save and Quit)

Regenerate a GRUB configuration file and overwrite existing one:

# grub2-mkconfig -o /boot/grub2/grub.cfg

Restart system and verify no line “inet6” in “ip addr show” command output.

# shutdown -r now
# ip addr show | grep net6

2. Disable IPv6 using sysctl settings:

Append below lines in /etc/sysctl.conf:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

About Shyamal

Avatar of Shyamal
Shyamal is our resident tutorial master. He has years of experience with WordPress Platform and is a professional blogger with a special interest in Social Media, Internet Marketing and Web Design. Actually, he is also working on a IT Company as a System Administrator in the fields of Linux and Windows Server, System Administration and Networking.

Check Also

rhel7 wmware configuration

VMware Workstation 11 Configuration before RHEL7 Installation

Hi Everyone. Again i come back with this new post. I’ve already got few email …

Leave a Reply

Your email address will not be published. Required fields are marked *

Advertisment ad adsense adlogger