HowTo Disable IPv6 on Centos 7 Simple Steps

Disable IPv6 on Centos 7 / RHEL 7. Why i am telling to disable IPv6 because still IPv6 is not in production use. If you enable it in production servers who knows how it impact vulnerability to hack into our system / servers. To avoid un-necessary headache simple keep in disabled mode until we use.

IPv6(Internet Protocol version 6) is the internet’s next-generation protocol and it is the most latest version of the internet protocol. IPv6 allows more users and devices to communicate on the Internet by using bigger numbers to create IP addresses.

Method 1:

Disable IPv6  – NO reboot required

To check “IPv6” enable or not by follow below command

# ifconfig |grep inet6
 inet6 fe80::8ee:33ff:feeb:44f0 prefixlen 64 scopeid 0x20<link>
 inet6 ::1 prefixlen 128 scopeid 0x10<host>

Edit the configuration file for disable IPv6

# vi /etc/sysctl.conf

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

:wq

If you want to disable IPv6 on specific interface network, add the below line into sysctl.conf file

# vi /etc/sysctl.conf

net.ipv6.conf.eth0.disable_ipv6 = 1

Restart the network

# systemctl restart network.service

(or)

# sysctl -p
 net.ipv6.conf.all.disable_ipv6 = 1
 net.ipv6.conf.default.disable_ipv6 = 1

Now check IPv6 is disabled?

# ifconfig |grep inet6

Method 2:

Disable IPv6  – reboot required

It requires reboot your server after disable the IPv6.

Add the word “ipv6.disable=1” in /etc/default/grub file

# vi /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=rhel/swap ipv6.disable=1 crashkernel=auto rd.lvm.lv=rhel/root rhgb quiet"
GRUB_DISABLE_RECOVERY="true"

:wq

To Regenerate  grub config file as followed by below command.

# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-22d1d7d01d88477b9bc2e044ccdca4f5
Found initrd image: /boot/initramfs-0-rescue-22d1d7d01d88477b9bc2e044ccdca4f5.img
done

Now reboot the server.

# reboot

After restart the server, to check ipv6 disabled or not by below command

# ifconfig -a |grep inet6

(or)

# ip addr show |grep inet6

Related Articles

HowTo Install RStudio Server Centos 7

R Shiny-Server Installation Centos 7

Linux Tutorial

Thanks for your wonderful Support and Encouragement

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

Leave a Reply

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