How to disable IPv6 in Raspbian [WORKING]

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:

  1. Edit “/etc/sysctl.conf”:
    $ sudo nano /etc/sysctl.conf
    Add this to the end:
    net.ipv6.conf.eth0.disable_ipv6 = 1
    Save and close the file.

  2. 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.

  3. Reboot

  4. Check with “ifconfig” if the IPv6 address has disappeared.
    $ ifconfig
    See my result in picture below, “inet6” is missing:


Enjoy! 🙂

2 thoughts on “How to disable IPv6 in Raspbian [WORKING]

  1. DON’T use this if you use RNDIS usb connection to a PI ZERO..
    Flashing new card now to get it working again..

    1. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *