Disable ipv6 on ubuntu

nano /etc/sysctl.conf

add the following line at the end:

net.ipv6.conf.all.disable_ipv6 = 1

net.ipv6.conf.default.disable_ipv6 = 1

net.ipv6.conf.lo.disable_ipv6 = 1

issue the following command, if the output value shows 1, then ipv6 is disabled:

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