Disable IPV6 in ubuntu

Here are few methods to disable IPV6 in UBUNTU

Edit Modprobe
You need to edit the aliases file using the following command

sudo vi  /etc/modprobe.d/aliases

Find the line: alias net-pf-10 ipv6
change to

alias net-pf-10 off

If the above change is not working you need to change the following one

alias net-pf-10 off ipv6

Save the file and reboot
Edit GRUB

Edit /etc/default/grub file

sudo vi  /etc/default/grub

Change

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”

to

GRUB_CMDLINE_LINUX_DEFAULT=”ipv6.disable=1 quiet splash”

Save and exit the file
Update the grub from the command line

sudo update-grub

Edit sysctl.conf


Edit sysctl.conf file

sudo vi /etc/sysctl.conf

Add following lines

# Disable IPV6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

 save and exit file