Skip to content

Instantly share code, notes, and snippets.

@andreibosco
Created March 24, 2017 21:06
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save andreibosco/3badaac477446587bcd6751e186df446 to your computer and use it in GitHub Desktop.
Save andreibosco/3badaac477446587bcd6751e186df446 to your computer and use it in GitHub Desktop.
Raspberry Pi: disable IPv6

Disabling IPv6

Source: https://www.leowkahman.com/2016/03/19/disable-ipv6-raspberry-raspbian/

Firstly, check for presence of IPv6 using ifconfig. You should be seeing a few lines containing inet6 addr: ....

To disable, edit a file: sudo nano /etc/sysctl.conf

Add the following line:

net.ipv6.conf.all.disable_ipv6 = 1

For the change to take effect without rebooting: sudo sysctl -p

Verify that IPv6 address does not show up in ifconfig.

If you wish to re-enable, change the value in the setting above from 1 to 0 then execute the following two lines:

sudo sysctl -p
sudo ifconfig eth0 down && sudo ifconfig eth0 up

If you are doing this over SSH, the current session will of course be cut off. You should be able to reconnect in just a few seconds.

@wilwet
Copy link

wilwet commented Jan 10, 2021

Thnx, works great

@GiannisDorokidis
Copy link

Works great on pi zero w

@ansi13c
Copy link

ansi13c commented Nov 30, 2021

How to enable after that?IPv6 not enabling without reboot

@MestreLion
Copy link

@ansi13c : the same way when disabling: sudo sysctl -p

@g0lgs
Copy link

g0lgs commented Jan 25, 2024

This has worked fine on OS versions up to and including Bullseye, but for me it is NOT working on bootup on Bookworm.

Anyone found a fix ?

@andreibosco
Copy link
Author

This has worked fine on OS versions up to and including Bullseye, but for me it is NOT working on bootup on Bookworm.

Anyone found a fix ?

I'm sorry, I haven't used a raspberry pi in a while. I hope that someone has a solution for Bookworm. Meanwhile, have you seen this thread ? It suggests adding ipv6.disable=1 to GRUB as a workaround.

@g0lgs
Copy link

g0lgs commented Jan 30, 2024

This has worked fine on OS versions up to and including Bullseye, but for me it is NOT working on bootup on Bookworm.

Anyone found a fix ?

I have found a work around that I did not need to do on bullseye which is to add the following to /etc/rc.local

service procps reload

@barci335
Copy link

barci335 commented Mar 14, 2024

This has worked fine on OS versions up to and including Bullseye, but for me it is NOT working on bootup on Bookworm.
Anyone found a fix ?

I have found a work around that I did not need to do on bullseye which is to add the following to /etc/rc.local

service procps reload

Fixed it with Network Manager on command line:

  1. nmcli connection show
  2. nmcli connection modify <connection_name> ipv6.method ignore ipv6.ip6-privacy 0 connection.autoconnect yes
  3. reboot

This command sets IPv6 method to "ignore", sets IPv6 privacy to "0" (optional, but it ensures IPv6 privacy extensions are disabled), and sets the connection to autoconnect. This ensures that the IPv6 configuration remains disabled even after a reboot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment