Skip to content

Instantly share code, notes, and snippets.

@andreibosco
Created March 24, 2017 21:06
Show Gist options
  • 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.

@g0lgs
Copy link

g0lgs commented May 23, 2025

After my post from Jan 2024, I found that adding 'ipv6.disable=1' to /boot/firmware/cmdline.txt also works

A potential problem with adding the settings via the Network Manager CLI is that if you use multiple network interfaces, i.e. different Wifi's depending where the device is used then you need to do that for each one.

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