138

I am using Ubuntu 14.04. And I have done the following to disable ipv6.

I have open /etc/sysctl.conf using gedit and paste the following lines at the end of sysctl.conf.

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

But when I check it using following command,

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

I am getting result as '0'( i.e still Enabled). Please help me to disable ipv6, so that I can use hadoop.

I followed instructions from this link.

0

3 Answers 3

230

To disable ipv6, you have to open /etc/sysctl.conf using any text editor and insert the following lines at the end:

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

If ipv6 is still not disabled, then the problem is that sysctl.conf is still not activated.

To solve this, open a terminal(Ctrl+Alt+T) and type the command,

sudo sysctl -p

You will see this in the terminal:

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

After that, if you run:

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

It will report:

1

If you see 1, ipv6 has been successfully disabled.

8
  • 1
    will value 1 hold after reboot?
    – user334031
    Oct 3, 2014 at 1:32
  • 1
    @Georjia yes... after this ipv6 will disable permanently.... untill you enable it...
    – A J
    Oct 6, 2014 at 3:53
  • 7
    even with cat /proc/sys/net/ipv6/conf/all/disable_ipv6 reporting disabled (1), ubuntu x64 14.04 still manages to somehow autoconfig an a v6 ip on the main interface (ipv6 is set to auto in the network manager by default)
    – stackblow
    Jun 30, 2015 at 16:12
  • 1
    if ipv6 is disabled in kernel this dont work beacuse cant find /proc/sys/net/ipv6/ . There must be another way too.
    – obayhan
    Sep 17, 2015 at 13:58
  • 1
    I tried this (getting the 1), and the advice from Mostafa below - yet ipv6 still appears in my dmesg and slows down my boot - what can I do? [ 19.434645] IPv6: ADDRCONF(NETDEV_UP): eno1: link is not ready
    – FooBar
    Apr 15, 2017 at 11:21
18

You might want to disable it right from the boot. For this purpose, open /etc/default/grub with your favorite text editor with root access (maybe sudo vi /etc/default/grub.

In this file, find this line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

and change it to:

GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1 quiet splash"

Save the file and update grub by running:

sudo update-grub

=============================
Mint 19 and Ubuntu 18.04:

on Mint 19 it would be "xed admin:///etc/default/grub" and maybe on Ubuntu 18.04 "gedit admin:///etc/default/grub" to get a GUI editor for doing the edits to the file. The rest of the steps will be the same.

2
  • 1
    Why and when do we want to disable using GRUB instead of setting the sysctl?
    – txs
    Sep 8, 2020 at 16:46
  • There has been cases in which I failed to disable ipv6 using sysctl. I think last time it happened few month ago while I was configuring my Raspberry Pi. Sep 9, 2020 at 5:17
-2

In addition to Ross Rogers answer above you should add:

sudo nano /etc/init/scip.conf

# description "Start sysctl at boot"

description "sysctl"

start on runlevel [2345]
stop on runlevel [016]

console log

respawn
respawn limit unlimited

exec /sbin/sysctl -p
3
  • 2
    Why? What does it do?
    – GuiGS
    Sep 1, 2016 at 18:01
  • It looks like it runs sysctl -p when booting to runlevel 2,3,4, and 5. However there's this question askubuntu.com/questions/654291/… that implies this scip.conf thing doesn't really work. Nov 1, 2016 at 11:51
  • sysctl runs on its own at boot, so this is wrong..
    – Alex R
    Feb 2, 2017 at 14:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .