• Start Here
    • How to Install Linux
    • Which Distro To Choose
    • 10 Best Linux Distributions of 2023
  • Distros
    • Ubuntu
  • Linux Commands
  • Virtualization
  • Open Source
Linux Start
  • Start Here
    • How to Install Linux
    • Which Distro To Choose
    • 10 Best Linux Distributions of 2023
  • Distros
    • Ubuntu
  • Linux Commands
  • Virtualization
  • Open Source
Linux Start
Home»Distros»Ubuntu»How To Disable IPv6 On Ubuntu

How To Disable IPv6 On Ubuntu

Anup ThapaBy Anup ThapaMarch 13, 2023 Ubuntu 3 Mins Read

After over 2 decades of being in the adoption phase, IPv6 is in a unique stage at the moment.

On one hand, there are cases where disabling IPv6 is necessary. For instance, some VPNs only encrypt IPv4 traffic. This means if you don’t disable IPv6, it would defeat the purpose of using the VPN.

On the other hand, because we’re pretty far along with the IPv6 transition, many services required IPv6 to work properly. For instance, you may encounter problems with X11 Forwarding if IPv6 is disabled.

Basically, IPv6 may or may not be necessary depending on your exact setup and goals. If you do decide to disable IPv6, this article will be helpful.

Disable IPv6 from Network Settings

The NetworkManager GUI lets you configure various settings including an interface’s IPv6 address.

  1. Launch the Settings app and switch to the Network (wired) or WiFi tab.
    network settings ubuntu
  2. Click on the Settings cog and switch to the IPv6 tab. Select Disable and click on Apply.
    disable ipv6 on ubuntu
  3. Reset the connection (toggle on/off) to apply the changes.
    disable connection ubuntu
  4. Check the connection settings again to verify that it was disabled.
    disable ipv6 ubuntu

Temporarily Disable IPv6 (Sysctl)

You can modify the ipv6 configurations with sysctl if you only need to disable it for the current session. IPv6 will be re-enabled after you restart your machine.

First, verify that IPv6 is currently enabled with  

ip a

Execute the following commands to disable IPv6.

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1

This time, verify that IPv6 was disabled with

ip a

Permanently Disable IPv6 (Sysctl)

Sysctl is handy as you can modify kernel parameters at runtime with it, but the change isn’t persistent. If you want to permanently disable IPv6, you can directly edit the sysctl.conf file.

Open the config file with a text editor like Nano.

sudo nano /etc/sysctl.conf

Add these lines to the file and save the changes.

#disable ipv6
ipv6.conf.all.disable_ipv6 = 1
ipv6.conf.default.disable_ipv6 = 1
ipv6.conf.lo.disable_ipv6 = 1

Afterward, load the new settings and verify the change with

sysctl -p
ip a

Disable IPv6 with GRUB

Sometimes, the system doesn’t load certain parameters (such as the IPv6 parameters we set earlier) at boot. This can cause the ‘persistent’ change to revert after rebooting. In such cases, you can disable IPv6 by editing the GRUB config instead.

Open the config file with a text editor like Nano.

sudo nano /etc/default/grub

Add ipv6.disable=1 to the GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX lines and write out the changes.

Update GRUB to apply the changes.

sudo update-grub

Finally, restart your PC and verify that IPv6 is disabled.

shutdown -r now
ip a
Anup Thapa
  • LinkedIn

Anup Thapa has been using Linux for over 5 years. He has an extensive background in computer hardware and networking. At LinuxStart, Anup is an integral part of our editorial team. His goal is to effectively communicate technical concepts in a simplified form understandable by new Linux users. To this end, he mainly writes beginner-friendly tutorials and troubleshooting guides. Outside of work, he enjoys experimenting with different Linux distros and reading up on things like networking and virtualization.

Leave A Reply Cancel Reply

Table of Contents
  • Disable IPv6 from Network Settings
  • Temporarily Disable IPv6 (Sysctl)
  • Permanently Disable IPv6 (Sysctl)
  • Disable IPv6 with GRUB
Linux Start
Guides

What is the Linux Kernel?

The Linux Kernel is the core of the Linux operating system and is central to…

How To Install Linux Mint

How To Install Linux on VirtualBox

Getting Started with Linux

How to Install Linux

10 Best Linux Distros of 2023

Which Linux Distro Should You Choose? A Complete Guide to Help You Decide

© 2023 LinuxStart.com

Type above and press Enter to search. Press Esc to cancel.