User Tools

Site Tools


linux:networking:disable_ipv6

Disable IPv6 on Ubuntu

Method 1: sysctl

sudo gedit /etc/sysctl.conf

Append to end of file

# IPv6 disabled
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

Save the file and close it. Restart sysctl with

sudo sysctl -p

Check the output of ifconfig again and there should be no ipv6 address

ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:5f:28:8b  
          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1346 errors:0 dropped:0 overruns:0 frame:0
          TX packets:965 errors:0 dropped:0 overruns:0 carrier:0
.....

If it does not work, then try rebooting the system and check ifconfig again.

Method 2: grub

sudo gedit /etc/default/grub

Look for the line containing “GRUB_CMDLINE_LINUX” and edit it as follows

GRUB_CMDLINE_LINUX="ipv6.disable=1"

The same can also be added to the value of the variable named “GRUB_CMDLINE_LINUX_DEFAULT” and either would work. Save the file, close it and regenerate the grub configuration

sudo update-grub2

Reboot. Now ipv6 should be disabled.

linux/networking/disable_ipv6.txt · Last modified: 2017/08/10 11:00 (external edit)