1

So, I'm building hadoop cluster with raspberry right now, I need to disable ipv6 connectivity, and need to know whether ipv6 has been disabled or not.
In some guide cat /proc/sys/net/ipv6/conf/all/disable_ipv6 is supposed to give the result I want, but for some reason if I enter it my terminal said "no such files or directory".
Do you have some suggestions?

nb : there is already a question about ipv6 in 'IPv6 connectivity', but i didn't find the answer, and what i ask is how to disable and check whether it's disabled or not, while the other question is about enabling it, thanks.

  • possible duplicate of [IPv6 connectivity](http://raspberrypi.stackexchange.com/questions/37/ipv6-connectivity) – mpromonet Apr 22 '15 at 17:42

1 Answers1

1

IPv6 functionality is part of the kernel, and it may be modular (or configured out completely). If the module is not loaded, then there is not even the option of enabling or disabling it -- first the module must be loaded:

sudo modprobe ipv6

Will either create that directory tree in /proc/sys, or else throw an error indicating there is no such module -- but if you are using raspbian, that's the set-up.

This module has options which are documented here; evidently you could load this way:

sudo modprobe ipv6 disable=1

Which will prevent it from functioning. It also seems you can do something similar with a kernel invocation parameter by adding:

disable_ipv6=1

To /boot/cmdline.txt. Remember that that file should only be one line, the various parameters are just separated by spaces. This is effective at boot.

goldilocks
  • 56,430
  • 17
  • 109
  • 217
  • thanks, so by default ipv6 is not functional unless i enable it with sudo modprobe ipv6, right? and i can check whether ipv6 fuctionality is enabled or disabled by checking /proc/sys folder, am i right? – kurniawan dwi septian Apr 22 '15 at 15:19
  • If that module is on your system (look in `/lib/modules/[uname -r]/kernel/net/ipv6`, or just try to load it), then yes. I think your best bet if you want to disable it is to actually load it, then disable it in `/proc/sys`, otherwise it could be automatically loaded and enabled for whatever reason. – goldilocks Apr 22 '15 at 15:23
  • thanks, i've loaded it, so there is /proc/sys/net/ipv6, and /lib/modules/3.18 7+/kernel/net/ipv6, now, how to disable it? – kurniawan dwi septian Apr 22 '15 at 16:06
  • Presumably just `echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6` -- however you have to be root (e.g., use `su`), `sudo` will not work because there is redirection (`>`). I've edited in some more stuff about controlling this along with some official kernel documentation links. – goldilocks Apr 22 '15 at 16:18
  • `/proc` and `/sys` are kernel interfaces; some things are just readable, other things can be read and written to. **Note they are not real files.** So things like that which are binary options are either 0 or 1; you can check them with `cat` and set them with `echo >`. – goldilocks Apr 22 '15 at 16:20
  • thanks, just want to make sure, so from the default condition i do -sudo modprobe ipv6 to load; -cat /proc/sys/net/ipv6/conf/all/disable_ipv6 to check and the result is 0 because it's not disabled yet; -su passwd; -su; -echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6; -cat /proc/sys/net/ipv6/conf/all/disable_ipv6, now the result is 1; am i doing it right? and btw, when i rebooted it, when i do cat /proc/sys/net/ipv6/conf/all/disable_ipv6, it gives 0 again – kurniawan dwi septian Apr 22 '15 at 17:33
  • It won't persist across reboots, no; this is an aspect of those "files" not being real files on disk -- they are just live conduits to the kernel. When you read them, it sends you information, when you write to them, you send it information. But the file nodes themselves are just symbolic (notice they have a size of 0). If you try that kernel param in `cmdline.txt` instead, it *should* mean you reboot with it disabled, although I have not tried so cannot say for sure. – goldilocks Apr 22 '15 at 17:49
  • Thanks, i already did the 'sudo modprobe ipv6 disable=1' and 'disable_ipv6=1' on '/boot/cmdline.txt', i hope it really disabled it. And i have a suggestions, how about i enabled ipv6 from boot with adding ' ipv6 ' at the end of '/etc/modules' , and disable it with 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6'. Do you think its a good idea? – kurniawan dwi septian Apr 22 '15 at 19:40