HomeHow ToHow to Disable IPv6 Permanently on Raspberry Pi

How to Disable IPv6 Permanently on Raspberry Pi

On paper, IPv6 is a great thing because there are 340 undecillion addresses available, and it can be allocated uniquely to every device connected to the internet.

But along with that, it comes with many issues. One thing that we found during our testing is that all the services that are running on your device are directly exposed to the internet if you are not using any firewall that monitors inbound connection.

The best thing we could do was turn off IPv6 network-wide using the router settings. But on our Raspberry Pi, we found one other issue. Since we are using docker to run multiple services, it has IPv6 on by default. Combining that with the Cloudflare Tunnel that we use to access the device creates a lot of conflict with IPv6, and sometimes, we cannot access the Raspberry Pi remotely even if it is connected to the internet.

Also read: How to Automatically Spin Down or Sleep HDD on Raspberry Pi

To us, disabling IPv6 was the only feasible way to go, and this is valid for most of the users.

Steps to Disable IPv6 Permanently on Raspberry Pi

Disabling IPv6 system-wide on Raspberry Pi is quite simple, using a few steps.

  1. Check if the IPv6 address is showing for any available network interfaces using the command below
ifconfig
ifconfig with ipv6
  1. Type the following to edit /boot/cmdline.txt
sudo nano /boot/cmdline.txt
  1. Add the following at the end of the file
ipv6.disable=1
sudo nano /boot/cmdline.txt
  1. Save the file and reboot
sudo reboot
sudo reboot
  1. Check again to see if the IPv6 is disabled for all network interfaces.
ifconfig
ifconfig without ipv6

Also read: How to Setup Watchdog on Raspberry Pi

So that was all. There are various methods that you will find online, but this is the simplest and the most effective one.


“As an Amazon Associate & Affiliate Partners of several other brands we earn from qualifying purchases.” [Read More Here]


Mehul Boricha
Mehul Boricha
Mehul Boricha is the driving force behind Tech Arrival. He is a computer and smartphone geek from Junagadh, Gujarat, India. He is a Software Engineer by Education & a Blogger by Passion. Apart from technology geek, his free time is dedicated to cybersecurity research, server optimization, and contributing to open-source projects.

Leave a Comment

Please enter your comment!
Please enter your name here


By submitting the above comment form, you agree to our Privacy Policy and agree with the storage and handling of your data by this website.


Stay Connected