I had connection problems with my Raspberry Pi, it dropped connection over IPv4 periodically.
My solution was to disable IPv6, and the Pi’s network connections (over IPv4) went stable!

To check if you have any IPv6 address, run:
$ ifconfig
Check for “inet6”, see picture above.
To disable IPv6:
- Edit “/etc/sysctl.conf”:
$ sudo nano /etc/sysctl.conf
Add this to the end:
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
Save and close the file. - Edit “/etc/rc.local”:
$ sudo nano /etc/rc.local
Add this to the end (but before “exit 0”):
service procps reload
Save and close the file. - Reboot
- Check with “ifconfig” if the IPv6 address has disappeared.
$ ifconfig
See my result in picture below, “inet6” is missing:

Done!
Enjoy! 🙂
DON’T use this if you use RNDIS usb connection to a PI ZERO..
Flashing new card now to get it working again..
Thank you for feedback!
I have used this on a RPi 3B+
If anything goes wrong you should be able to remove the SD-Card and mount it in a Linux computer to edit the files. And then put the card back to the pi.
Wow. Shouldn’t have done this.
This isn’t letting me login via ssh after making changes.
Add “blacklist ipv6” to /etc/modprobe.d/ipv6.conf instead and reboot.
+1 for that…
I have a Raspberry Pi 1 Modell B+ using Raspberry Pi OS (32-bit) Lite and this worked like a charm, donno what the guys over there did. I also still can connect to my pi via ssh.
Hi,
thanks for the article.
But i have some problem with it.
I started another program with http-server within rc.local and if i reload “procps” via “service procps reload” the previous started programm is dropped.
You do not have to reload the “procps”-service in the “rc.local”. It is working without this.
After a reboot your RPi do not have an ipv6 address any more. I have tried it.
@Steve from 2020-08-10 at 22:06
You do not have to reload the “procps”-service in the “rc.local”. It is working without this.
After a reboot your RPi do not have an ipv6 address any more. I have tried it.
@Christoffer
Thank you very much!
sudo sysctl -p
to make sysctl eat the changes without having to reboot
For the wifi :
net.ipv6.conf.wlan0.disable_ipv6=1
if you never do a eth0 connect before after the sudo sysctl-p you have an error of file not found.
But it’s working. Good solution.
To disable IPv6:
sudo chmod 777 /etc/sysctl.conf
Edit “/etc/sysctl.conf”:
$ sudo nano /etc/sysctl.conf
Add this to the end:
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
Save and close the file. with CTRL O + ENTER + CTRL X
sudo chmod 664 /etc/sysctl.conf
no more working for Raspbian GNU/Linux 10 (buster) armv7l
Worked on my pi 4 with latest raspbian on it. Thanks!