Skip to content
Follow
Ubuntu Linux

How to Disable IPv6 on Ubuntu Linux

Richard
Written by
Richard
Jul 10, 2023 Updated Oct 6, 2026 3 min read
How to Disable IPv6 on Ubuntu Linux
How to Disable IPv6 on Ubuntu Linux

Disabling IPv6 on Ubuntu stops your computer from using the newer internet address standard and makes it rely on the older IPv4 protocol instead. IPv6 is the protocol that assigns addresses to devices on a network. On some routers and older hardware it causes dropped connections, slow page loads or long DNS delays. This tutorial was written for Ubuntu 22.04 LTS.

Advertisement

The change takes a few minutes. You can make it from the terminal, which is the method shown here, or per connection in the network settings. It is safe to turn IPv6 off if your home network or internet service provider does not fully support it. You can turn it back on later, and nothing is deleted from your system.

⚡ Quick Answer

Disable IPv6 by adding ‘net.ipv6.conf.all.disable_ipv6 = 1’ to /etc/sysctl.conf. Apply changes with ‘sudo sysctl -p’. Verify with ‘ip address show’.

Advertisement

Disable IPv6

To disable IPv6 on Ubuntu, you update the system configuration so the kernel ignores IPv6 traffic. You add the disable rule to /etc/sysctl.conf, then apply the new settings with the sysctl tool so you don’t have to reboot. Editing that file and applying the settings both need administrator rights, so your account must be able to use sudo.

If you only want IPv6 off for one connection, there is a graphical alternative. Go to Settings Network, click the gear icon next to the connection, open the IPv6 tab and set the method to Disable. That only affects the one connection, while the steps below turn IPv6 off for the whole system.

  1. Open a terminal. Press Ctrl+Alt+T, or search for Terminal in the Activities overview. A command prompt should appear.
  2. Run the command below to disable IPv6. If it asks for your password, type it and press Enter. Nothing shows on screen while you type the password, which is normal.
🐧Bash / Shell
sudo bash -c 'echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf'
  1. Apply your changes by running the command below. The terminal should print the settings it loaded, and the IPv6 disable values should appear in that output. No restart is needed. Because the rule is saved in /etc/sysctl.conf, it is applied again on every boot.
🐧Bash / Shell
sudo sysctl -p
  1. Display your IP address details with the command below. The output lists each network interface and the addresses assigned to it.
💻Code
ip address show

Read the output for each active interface, such as your Ethernet or Wi-Fi adapter. The terminal output should confirm that IPv6 addresses are no longer bound to them. Lines starting with inet are IPv4 addresses and should still be there. Lines starting with inet6 are IPv6 addresses and should be gone.

If you still see inet6 lines, check that the rule was saved in /etc/sysctl.conf without typos and that you ran the apply command afterwards. A rebooted machine will also read the file again from scratch.

Advertisement
💻Code
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:bc:b2:46 brd ff:ff:ff:ff:ff:ff
altname enp2s1
inet 192.168.156.130/24 brd 192.168.156.255 scope global dynamic noprefixroute ens33
valid_lft 1716sec preferred_lft 1716sec

The system configuration update is now complete. IPv6 is off for the whole system and stays off after a reboot.

To undo the change, open /etc/sysctl.conf with administrator rights, remove the lines you added (or put a # at the start of each one), and run the apply command from step 3 again. If the IPv6 addresses don't come back right away, reboot the machine.

Conclusion:

  • Disabling IPv6 on Ubuntu Linux can improve compatibility with older applications and network equipment that do not support it, and it can fix connection drops or slow lookups on some routers.
  • The process is straightforward: add the rule to /etc/sysctl.conf, apply it, and check the result. No reboot is needed.
  • You can revert the change at any time by removing the lines you added and applying the settings again.
  • Check your IP address details afterwards. If no inet6 lines remain on your active interfaces, IPv6 is disabled.
  • Make a backup copy of /etc/sysctl.conf before you edit it, so you can restore it if something goes wrong with your network.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

📚 Related Tutorials

How to Turn "Week Numbers" on or off for Calendar in Ubuntu Linux
Ubuntu Linux How to Turn "Week Numbers" on or off for Calendar in Ubuntu Linux
How to Install OpenLiteSpeed on Ubuntu Linux
Ubuntu Linux How to Install OpenLiteSpeed on Ubuntu Linux
How to Install Nginx on Ubuntu Linux
Ubuntu Linux How to Install Nginx on Ubuntu Linux
How to Install Ubuntu Linux
Ubuntu Linux How to Install Ubuntu Linux

No comments yet — be the first to share your thoughts!

Leave a Comment

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