How to Disable IPv6 on Ubuntu Linux
Disabling IPv6 on Ubuntu Linux stops your computer from using the newer Internet Protocol version.
IPv6 is the latest way computers talk on the internet, designed to offer way more addresses than the old IPv4. Ubuntu Linux usually turns it on automatically.
You might want to turn off IPv6 on Ubuntu 22.04 LTS if it causes problems with old devices or certain programs. This guide shows you how to do it.
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’.
Disable IPv6
To disable IPv6, you’ll edit a system file that controls network settings. This change tells your computer to stop using the IPv6 internet protocol. Below, you’ll find the exact command to run, making it convenient to disable IPv6 when needed.
Run the command below to disable IPv6.
sudo bash
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf
Next, apply your changes by running the command below.
sudo sysctl -p
Display your IP address details.
ip address show
The output should show that IPv6 is no longer usable on the machine.
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
That should do it!
Conclusion:
- Disabling IPv6 on Ubuntu Linux can enhance compatibility with older applications and network infrastructures that do not support it.
- This process is straightforward and can be accomplished with a few simple commands.
- Users can easily revert the changes if they decide to enable IPv6.
- Verifying the IP address details is essential to ensure that IPv6 is effectively disabled.
- Always back up configuration files before making changes to prevent unintended network issues.
Should I disable IPv6 on Ubuntu?
If you have no IPv6 addresses other than link-local (fe80::) and no services are using it, it is safe to disable. If you have an IPv6 address in use, such as a global unicast address (2000::/3) or unique local address (fc00::/7), disabling will affect connectivity.
How to temporarily disable IPv6 on Linux?
To disable IPv6 temporarily, use `disable_ipv6=1` for immediate effect on current interfaces and as the default for future ones. For persistence across reboots, create `/etc/sysctl.d/99-disable-ipv6.conf`. Apply changes with `sysctl –system`.
Was this guide helpful?
About the Author
Richard
Tech Writer, IT Professional
Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.
No comments yet — be the first to share your thoughts!