How to disable IPv6 on Ubuntu

On some hosts I don’t have the ability to use IPv6, therefor I prefer to completely disable it.

 

To disable IPv6 you have to add the following lines to /etc/sysctl.conf.

Then simply reload the configuration

You can verify if it was successfully loaded with the contents of /proc.

This should result into 1 (one) if successfully loaded.

When done allright these settings should be persistent if the machine reboots.