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:
3. Run the following command to ensure the change is activated.
sudo sysctl -p
4. Validate IPv6 is disabled by running the following command.
If IPv6 is properly disabled, the command should return a result of 1.
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!