Ubuntu- disabling IPv6

There are various reasons why it may be necessary to disable IPv6 on Ubuntu.
To determine whether IPv6 is enabled already the following helps:

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

A returnvalue of 0 means that IPv6 is active- 1 means it is deactivated.

Disabling is done in the shell with:

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

Settings are active immediately but don't survive a reboot. To disable IPv6 even after a reboot the following lines need to be put to /etc/sysctl.conf:

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