Bosse_B
Posts: 631
Joined: Thu Jan 30, 2014 9:53 am

How to switch off IPv6 on RPi3?

Sun Mar 06, 2016 11:41 am

I have seen that my Pi creates sockets on IPv6, which makes no sense since it is not in an environment where this protocol is in use (home network using IPv4).
Seems like a waste of space and capacity.
How can I disable IPv6?
Running Raspbian Jessie 2016-02-26
Bo Berglund
Sweden

User avatar
DougieLawson
Posts: 30430
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: How to switch off IPv6 on RPi3?

Sun Mar 06, 2016 11:44 am

Raspbian has IPv6 switched off by default. I have to update /etc/modprobe.d/ipv6.conf to get IPv6 working.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Bosse_B
Posts: 631
Joined: Thu Jan 30, 2014 9:53 am

Re: How to switch off IPv6 on RPi3?

Sun Mar 06, 2016 4:57 pm

Strange,
I made a clean install from the Jessie image on a Pi3 and then when I use netstat I get this response:

Code: Select all

pi@rpi3-jessie:~ $ netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:2947            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN      662/Xtightvnc
tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN      662/Xtightvnc
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      -
tcp6       0      0 :::2947                 :::*                    LISTEN      -
tcp6       0      0 :::139                  :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 :::445                  :::*                    LISTEN      -
As you can see there are 4 open TCP ports on IPv6....
Bo Berglund
Sweden

User avatar
DougieLawson
Posts: 30430
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: How to switch off IPv6 on RPi3?

Sun Mar 06, 2016 5:48 pm

Try adding

Code: Select all

blacklist ipv6
to /etc/modprobe.d/ipv6.conf
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Bosse_B
Posts: 631
Joined: Thu Jan 30, 2014 9:53 am

Re: How to switch off IPv6 on RPi3?

Sun Mar 06, 2016 10:12 pm

My /etc/modprobe.d/ipv6.conf file contains the following:

Code: Select all

# Don't load ipv6 by default
alias net-pf-10 off
#alias ipv6 off
If I un-commented the last line wouldn't that have the effect of not starting IPv6?
Blacklist sounds like a strange way to control hardware interfaces, are you sure about that?
Bo Berglund
Sweden

User avatar
DougieLawson
Posts: 30430
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: How to switch off IPv6 on RPi3?

Sun Mar 06, 2016 10:23 pm

Just add it to your file and reboot.
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Bosse_B
Posts: 631
Joined: Thu Jan 30, 2014 9:53 am

Re: How to switch off IPv6 on RPi3?

Mon Mar 07, 2016 4:35 pm

DougieLawson wrote:Just add it to your file and reboot.
Didn't work...

Code: Select all

pi@rpi3-jessie:~ $ netstat -lnpt
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:2947            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN      662/Xtightvnc
tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN      662/Xtightvnc
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN      -
tcp6       0      0 :::2947                 :::*                    LISTEN      -
tcp6       0      0 :::139                  :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 :::445                  :::*                    LISTEN      -
and

Code: Select all

pi@rpi3-jessie:~ $ ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:e2:6b:1f
          inet addr:192.168.0.148  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::1aa3:82a1:acdd:d00d/64 Scope:Link
Bo Berglund
Sweden

User avatar
PeterO
Posts: 3641
Joined: Sun Jul 22, 2012 4:14 pm

Re: How to switch off IPv6 on RPi3?

Mon Mar 07, 2016 4:42 pm

DougieLawson wrote:Raspbian has IPv6 switched off by default. I have to update /etc/modprobe.d/ipv6.conf to get IPv6 working.
Maybe it's changed Dougie. My PI3 here has ipv6 enabled by default.

PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),Aeromodelling,1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

hippy
Posts: 2344
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: How to switch off IPv6 on RPi3?

Mon Mar 07, 2016 7:32 pm

PeterO wrote:My PI3 here has ipv6 enabled by default.
So does my Jessie Pi 1 B+

JimmyN
Posts: 1109
Joined: Wed Mar 18, 2015 7:05 pm
Location: Virginia, USA

Re: How to switch off IPv6 on RPi3?

Mon Mar 07, 2016 9:12 pm

I turned it off using "/etc/sysctl.conf", by adding the line "net.ipv6.conf.all.disable_ipv6 = 1"

That resulted in no ipv6 address:

Code: Select all

eth0      Link encap:Ethernet  HWaddr b8:27:eb:4f:95:d6
          inet addr:192.168.0.6  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:75072 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4621 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4554883 (4.3 MiB)  TX bytes:801499 (782.7 KiB)
But netstat still shows it

Code: Select all

>$ netstat -lnpt
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -

User avatar
DougieLawson
Posts: 30430
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: How to switch off IPv6 on RPi3?

Tue Mar 08, 2016 6:45 am

I have IPv6 enabled on my network, on my Ubuntu system I have to remove the IPv6 blacklist to enable it. It may be that the RPF kernel now has IPv6 built in rather than as a loadable module.

Go and read the kernel config and the kernel docs to see how it's built.

It very easy to get IPv6 running with a Hurricane Electric tunnel http://tunnelbroker.net
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

Rascas
Posts: 324
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: How to switch off IPv6 on RPi3?

Tue Mar 08, 2016 9:03 am

Yes, it is built into the kernel, not as a module.

To disable it completely just add this to /boot/cmdline.txt

Code: Select all

ipv6.disable=1

User avatar
Gerd
Posts: 65
Joined: Wed Mar 16, 2016 10:48 am
Location: Europe

Re: How to switch off IPv6 on RPi3?

Sat Apr 30, 2016 9:12 am

Rascas wrote:Yes, it is built into the kernel, not as a module.

To disable it completely just add this to /boot/cmdline.txt

Code: Select all

ipv6.disable=1
Now IPv6 is again a module by this commit 18 day ago: https://github.com/raspberrypi/linux/co ... 2e1b988919
I did a add iv6.disable=1 to cmdline.txt and it works, no more IPv6 stuff in dmesg. So I try

Code: Select all

pi@raspberrypi:~ $ lsmod
Module                  Size  Used by
bcm2835_gpiomem         3040  0
bcm2835_wdt             3225  0
uio_pdrv_genirq         3164  0
uio                     8000  1 uio_pdrv_genirq
i2c_dev                 5859  0
fuse                   83461  1
ipv6                  347530  0
and see it it still loaded, but not used anywhere. But when I try

Code: Select all

pi@raspberrypi:~ $ sudo modprobe -r ipv6
modprobe: ERROR: ../libkmod/libkmod-module.c:777 kmod_module_remove_module() could not remove 'ipv6': Device or resource busy
I can't unload it to reclaim the memory which works with all other unused modules.

What's wrong here or what do I not understand?

DirkS
Posts: 7717
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: How to switch off IPv6 on RPi3?

Sat Apr 30, 2016 10:31 am

Gerd wrote:What's wrong here or what do I not understand?
Which kernel / firmware version do you run on (use 'uname -a')?

User avatar
Gerd
Posts: 65
Joined: Wed Mar 16, 2016 10:48 am
Location: Europe

Re: How to switch off IPv6 on RPi3?

Sat Apr 30, 2016 3:34 pm

Code: Select all

pi@raspberrypi:~ $ uname -a && vcgencmd version
Linux raspberrypi 4.4.8-v7+ #880 SMP Fri Apr 22 21:55:04 BST 2016 armv7l GNU/Linux
Apr 27 2016 11:06:18
Copyright (c) 2012 Broadcom
version 9b52ab7b475f4a056658fd2d95d2440b32167390 (clean) (release)

lbog
Posts: 82
Joined: Sun Mar 06, 2016 9:44 am

Re: How to switch off IPv6 on RPi3?

Sat Apr 30, 2016 8:41 pm

Gerd wrote: I did a add iv6.disable=1 to cmdline.txt and it works, no more IPv6 stuff in dmesg. So I try
Try with:

Code: Select all

# Don't load ipv6 by default
alias net-pf-10 off
alias ipv6 off
options ipv6 disable_ipv6=1
in "/etc/modprobe.d/ipv6.conf".

Code: Select all

:~ $ modinfo ipv6 | grep -i parm
parm:           disable:Disable IPv6 module such that it is non-functional (int)
parm:           disable_ipv6:Disable IPv6 on all interfaces (int)
parm:           autoconf:Enable IPv6 address autoconfiguration on all interfaces (int)

User avatar
Gerd
Posts: 65
Joined: Wed Mar 16, 2016 10:48 am
Location: Europe

Re: How to switch off IPv6 on RPi3?

Sat Apr 30, 2016 10:05 pm

no error no more after reboot, but:

Code: Select all

pi@raspberrypi:~ $ cat /etc/modprobe.d/ipv6.conf
# Don't load ipv6 by default
alias net-pf-10 off
#uncommented by Gerd: alias ipv6 off
alias ipv6 off
#added by Gerd: options ipv6 disable_ipv6=1
options ipv6 disable_ipv6=1
#see https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=138899&p=964851#p964851
pi@raspberrypi:~ $ lsmod
Module                  Size  Used by
bcm2835_gpiomem         3040  0
bcm2835_wdt             3225  0
uio_pdrv_genirq         3164  0
uio                     8000  1 uio_pdrv_genirq
i2c_dev                 5859  0
fuse                   83461  1
ipv6                  347530  0
pi@raspberrypi:~ $ sudo modprobe -r ipv6
pi@raspberrypi:~ $ lsmod
Module                  Size  Used by
bcm2835_gpiomem         3040  0
bcm2835_wdt             3225  0
uio_pdrv_genirq         3164  0
uio                     8000  1 uio_pdrv_genirq
i2c_dev                 5859  0
fuse                   83461  1
ipv6                  347530  0
Seems like IPv6 is here to stay.

DirkS
Posts: 7717
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: How to switch off IPv6 on RPi3?

Sat Apr 30, 2016 10:11 pm

Gerd wrote:Seems like IPv6 is here to stay.
Seems to be 'normal'.
I see the same and I have seen another user having the same issue: module is still loaded for some reason.

User avatar
DougieLawson
Posts: 30430
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website

Re: How to switch off IPv6 on RPi3?

Sat Apr 30, 2016 10:26 pm

Why not embrace the IPv6 (20 years old) protocol rather than dismissing it as something you don't need?

I've been running a IPv4 to IPv6 tunnel for many years, my current tunnel is done with Hurricane Electric and gives every IPv6 ready device in my network a 2001:xxxx:xxxx:xxxx/64 prefixed IPv6 address.

It's extremely simple to set up. https://tunnelbroker.net/
Microprocessor, Raspberry Pi & Arduino Hacker
Mainframe database troubleshooter
MQTT Evangelist
Twitter: @DougieLawson

Since 2012: 1B*5, 2B*2, B+, A+, Zero*2, 3B*3

Please post ALL technical questions on the forum. Do not send private messages.

User avatar
Gerd
Posts: 65
Joined: Wed Mar 16, 2016 10:48 am
Location: Europe

Re: How to switch off IPv6 on RPi3?

Mon May 02, 2016 8:48 am

DougieLawson wrote:Why not embrace the IPv6 (20 years old) protocol rather than dismissing it as something you don't need?
I took your advice and reverted all changes. I'll be better off investing time to learn more about IPv6.
Thank you for pointing me in the right direction! :)

Rasp-Berlin
Posts: 5
Joined: Sat Oct 31, 2015 8:04 pm

Re: How to switch off IPv6 on RPi3?

Tue Dec 06, 2016 3:42 pm

DougieLawson wrote:
Why not embrace the IPv6 (20 years old) protocol rather than dismissing it as something you don't need?
Because, I don't need IPv6 on a System, that will only will be connecte within my local Netzwork.

And because
* IPv6 is still a Problem on nearly all Home-Routers.
* it is my decision which IP address which system in my network gets.

Since concept of IPv6 is, in my opinion, a failure.
It wants to regulate too much automatically, which should not be automatically regulated.

Unfortunately, there is no alternative.

User avatar
BSmallz
Posts: 2
Joined: Sun Jan 15, 2017 3:57 pm

Re: How to switch off IPv6 on RPi3?

Sun Jan 15, 2017 4:03 pm

Add these lines to /etc/sysctl.conf

Code: Select all

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
net.ipv6.conf.[interface].disable_ipv6 = 1
Save and close.
Activate with:

Code: Select all

sysctl -p
(or reboot)
Done :D

zigzag
Posts: 2
Joined: Wed Sep 19, 2012 4:35 pm

Re: How to switch off IPv6 on RPi3?

Thu Mar 16, 2017 9:57 am

BSmallz » Sun Jan 15, 2017 4:03 pm : it works, thx.

ducarpit
Posts: 46
Joined: Mon Jan 09, 2017 8:32 am

Re: How to switch off IPv6 on RPi3?

Thu Mar 23, 2017 7:51 am

I try this fix but when i insert the sysctl -p command it says:

Code: Select all

root@raspberryMMDVM:~# clear
root@raspberryMMDVM:~# history -c
root@raspberryMMDVM:~# sysctl -p
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.eth0.disable_ipv6 = 1
sysctl: cannot stat /proc/sys/net/ipv6/conf/[interface]/disable_ipv6: File o directory non esistente
Why?
If i try ifconfig now it says:

Code: Select all

root@raspberryMMDVM:~# ifconfig
eth0      Link encap:Ethernet  HWaddr b8:27:eb:21:c2:de
          inet addr:192.168.1.80  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:500 errors:0 dropped:30 overruns:0 frame:0
          TX packets:239 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:80950 (79.0 KiB)  TX bytes:51895 (50.6 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:74:97:8b
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
It's ok or there are some problems?
Thanks

boyinhell
Posts: 3
Joined: Sat Mar 25, 2017 2:26 am

Re: How to switch off IPv6 on RPi3?

Fri Mar 31, 2017 10:13 am

My solution. IPv6 disabled. ipv6 module not loaded.
I just want a clean ipv4 system.

Add ipv6.disable=1 to cmdline.txt.

Code: Select all

cat /etc/modprobe.d/ipv6.conf 
# Don't load ipv6 by default
alias net-pf-10 off
# uncommented
alias ipv6 off
# added
options ipv6 disable_ipv6=1
# this is needed for not loading ipv6 driver 
blacklist ipv6

Return to “Networking and servers”

Who is online

Users browsing this forum: No registered users and 32 guests