Disable IPv6 in Ubuntu

IPv6 may not always be required and some administrators may elect to disable it on their servers. Here is how to disable IPv6 in Ubuntu Linux. To learn more about IPv6 please visit Wikipedia.

 

1. Open the “/etc/sysctl.conf” file for editing. To open the file for editing using nano type the following:

 

sudo nano /etc/sysctl.conf

 

2. Add the following 3 lines at the end of the “/etc/sysctl.conf” file.

 

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

 

It should look similar to the following:

 

Disable IPv6 in Ubuntu - update file

 

3. Run the following command to ensure the change is activated.

 

sudo sysctl -p

 

4. Validate IPv6 is disabled by running  the following command.

 

cat /proc/sys/net/ipv6/conf/all/disable_ipv6

 

If IPv6 is properly disabled, the command should return a result of 1.

 

Disable IPv6 in Ubuntu - validate command

 

A result of 0 would mean that IPv6 had not been properly disabled and the steps above should be repeated.

 

This is how to easily disable IPv6 in Ubuntu Linux!

Leave a Reply

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