How to disable IPv6 on Centos

There are times where you might need to disable IPv6 on your Centos Server. Below are the options that you can use:

Add kernel variable into /etc/sysctl.conf.

You can do this by editing /etc/sysctl.conf using your favourite editor.

for us, we use "nano /etc/sysctl.conf" and add below kernel variable:

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

Once done, you can run "sysctl -p" to force the changes.

OR

you do it by opening your command prompt and run below command.

echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
echo 1 > /proc/sys/net/ipv6/conf/default/disable_ipv6

OR

you do it by opening your command prompt and run below command.

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

All of the above will help you to disable the IPv6 features.

Was this answer helpful?

Also Read

How to solve PHP issue with " ini_set() has been disabled for security reasons"?

Issue: You may facing error saying that "ini_set() has been disabled for security reasons". You...

What are cron jobs?

Cron jobs are routines that execute a script on any given interval. For instance, you may have a...

What is SSH?

SSH (Secure Shell) is a secure method for logging into a server remotely and giving the server...

Files fail FTP transfer

When uploading many files at once (a CMS, for example), it is not uncommon for a few of the files...