How to Disable IPv6 on CentOS

IPv6 may be undesirable in certain situations, for systems that can run without IPv6, and only running on IPv4, the IPv6 protocol can be disabled.

On Red Hat and CentOS 7 the IPv6 stack can be disabled as follows

If one interface should run without IPv6, e.g. ens160.

Save the sysctl.conf file and enable the setting.

If you want to deactivate IPv6 during operation, the following command applies.

IPv6 is now disabled, a reboot is not necessary.

If the removal of IPv6 for running daemons is a disaster, e.g. SSH Server, the configuration can be changed.

Then restart the SSH daemon.

Postfix may also require to customize the ipv4 loopback interface.

With CentOS 6, the kernel module can be customized.

Disable the IPv6 stack.

Server reboots.

Checking for IPv6 addresses.

Leave a Reply

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