If you need to disable IPv6 on Ubuntu Server, or you searched specifically for ubuntu disable ipv6, the cleanest way is to decide first whether you want a temporary runtime change or a persistent change that survives reboots. For most VPS users, the right order is simple: verify whether IPv6 is actually enabled, disable it temporarily with sysctl if you are testing, and then make it persistent only if you are sure the server and network do not need IPv6.
That order matters because turning IPv6 off can absolutely fix a real problem — for example, broken upstream routing, applications that bind badly on dual-stack hosts, or internal compliance rules that require IPv4-only operation. But it can also create new problems if your provider, DNS, firewall policy, or package mirrors expect IPv6 to be available.
This guide shows the safe step-by-step path, the commands you actually need, and how to roll the change back if you change your mind.
Quick answer
There are two common ways to disable IPv6 on Ubuntu:
-
Temporary / runtime only: use
sysctland change the kernel values immediately. -
Persistent across reboots: add the kernel parameter
ipv6.disable=1, rebuild GRUB, and reboot.
For a VPS, I usually recommend this sequence:
- Check whether IPv6 is currently active.
- Test the runtime
sysctlchange first. - If that solves the issue and nothing breaks, make it persistent.
- Verify after reboot.
That gives you the smallest blast radius before you commit the change permanently.
Before you disable IPv6, make sure you really need to
Disabling IPv6 is not a generic performance tweak. It is an operational choice.
Good reasons to do it include:
- your provider or upstream network has broken IPv6 routing
- an application prefers AAAA resolution but fails when the remote path is unhealthy
- your environment is standardized on IPv4 only
- a hardening or compliance baseline explicitly calls for IPv6 to be disabled
Bad reasons include:
- "I heard it makes Ubuntu faster"
- "I am not using it today so I should turn it off"
- "I want fewer protocols running" without first checking whether any service depends on dual-stack networking
In practice, a modern Linux VPS is usually happy with IPv6 enabled. Only disable it when you have a specific networking, application, or policy reason.
Step 1: Check the current IPv6 status
Start by checking the current kernel state:
sysctl net.ipv6.conf.all.disable_ipv6
sysctl net.ipv6.conf.default.disable_ipv6
If both values return 0, IPv6 is enabled. In our Ubuntu 24.04 verification environment, both values were 0 by default:
-
net.ipv6.conf.all.disable_ipv6 = 0 -
net.ipv6.conf.default.disable_ipv6 = 0
If you want an additional quick visual check, you can also inspect whether the server currently has IPv6 addresses assigned:
ip -6 addr show
That does not disable anything — it just shows the current state so you know what you are changing.
Step 2: Disable IPv6 temporarily with sysctl
If you want to test the effect without making a reboot-time change yet, set the runtime values directly:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
What these do:
-
all.disable_ipv6=1tells the kernel to disable IPv6 globally -
default.disable_ipv6=1makes newly created interfaces inherit the disabled state
This is the safest first move on a VPS because it is immediate and easy to reverse. If the server loses connectivity in an unexpected way, you can usually reverse the values just as quickly.
How to verify the runtime change
Run the same status commands again:
sysctl net.ipv6.conf.all.disable_ipv6
sysctl net.ipv6.conf.default.disable_ipv6
You want both values to come back as 1.
If you also ran ip -6 addr show before the change, compare the before/after output after restarting the affected service or interface. On a headless VPS, the sysctl values are usually the cleaner verification point.
Step 3: Make the change persistent across reboots
If the runtime change solves the problem and you want Ubuntu to keep IPv6 disabled after a reboot, the most reliable server-side method is to set the kernel parameter ipv6.disable=1 and rebuild the boot configuration.
The change looks like this conceptually:
- find the
GRUB_CMDLINE_LINUXline in your GRUB configuration - append
ipv6.disable=1 - rebuild GRUB
- reboot the server
The command you run after editing the kernel command line is:
sudo update-grub
Then reboot:
sudo reboot
Why I prefer the kernel-parameter route for VPS tutorials: it is explicit, it is applied early in the boot process, and it is easier to reason about when you come back to the server six months later.
Step 4: Verify IPv6 is disabled after reboot
Once the server is back up, check the same runtime values again:
sysctl net.ipv6.conf.all.disable_ipv6
sysctl net.ipv6.conf.default.disable_ipv6
If the persistent configuration is working, they should still return 1.
You can also do a quick address check:
ip -6 addr show
On a VPS that is fully running IPv4-only after the reboot, you should no longer see normal active IPv6 interface addressing for the workloads you disabled.
Which method should you use on a VPS?
For most Ubuntu VPS deployments, the answer is:
-
Testing a fix or debugging a routing issue: use the runtime
sysctlmethod first. - Permanent policy for the server: use the GRUB kernel parameter after you confirm nothing depends on IPv6.
That split matters because production VPS changes should be reversible. A runtime change lets you validate the outcome before you bake it into the next boot.
If you are still deciding on the wider server build, it also helps to think about your base platform and workload first. These related guides can help:
- Cloud VPS for the actual server plan
- Server Operating Systems Compared – Linux vs Windows for OS selection context
- What Is IOPS? A Guide to VPS Storage Performance for infrastructure sizing
Things to watch out for after disabling IPv6
This is the part many quick tutorials skip.
After you disable IPv6, check these areas:
- DNS behavior: if a service previously preferred AAAA records, test name resolution and connectivity again.
- Package repositories: some mirrors are dual-stack; verify updates still work as expected.
-
Monitoring and health checks: some tools bind to
::by default and may need service restarts or config review. - Application listeners: web servers, reverse proxies, and mail daemons may have explicit IPv6 listen directives.
- Firewall rules: if your firewall policy assumed IPv6 existed, simplify or update the rule set so it matches the new network model.
On a small personal VPS, the risk is usually low. On a business server, do not skip this post-change validation.
How to re-enable IPv6 later
If you used the runtime sysctl method and want to revert immediately, set the values back to 0:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0
If you made the persistent GRUB change, remove ipv6.disable=1 from the kernel command line, rebuild GRUB again, and reboot.
The principle is the same as the original change: keep the runtime state and the boot-time state consistent.
FAQ
Is it safe to disable IPv6 on Ubuntu Server?
It can be safe, but only if your provider, applications, and routing policy do not rely on IPv6. On many VPS deployments it is fine. On others it breaks outbound package access, monitoring, or service bindings. Test before you make it permanent.
What is the fastest way to disable IPv6 temporarily?
Use the runtime sysctl commands. They apply immediately, do not require a reboot, and are easy to reverse if the change causes trouble.
What is the best permanent method?
For a server, the most predictable permanent method is the boot-time kernel parameter ipv6.disable=1, followed by update-grub and a reboot. It is clearer than leaving a half-documented runtime override in place.
Will disabling IPv6 improve VPS performance?
Usually no. This is not a meaningful performance optimization on its own. Disable IPv6 because you have a network, application, or policy reason — not because you expect a free speed boost.
If you want an Ubuntu environment where you can test networking changes cleanly before making them permanent, start with a Cloud VPS plan so you have full control over the kernel, network stack, and reboot cycle.
Closing summary
To disable IPv6 on Ubuntu Server safely, start with a runtime test using sysctl, confirm the change solves the real problem, and only then make it persistent with the ipv6.disable=1 kernel parameter and a GRUB rebuild. That approach is cleaner, easier to roll back, and far less risky on a production VPS than jumping straight to a permanent change without testing first.