How To Disable IPv6 on Debian 12
In this tutorial, we will show you how to disable IPv6 on Debian 12. IPv6, a successor to IPv4, offers extensive address space, routing efficiency, and enhanced security. Despite these merits, IPv6 adoption can introduce challenges. Its potential impact on website performance and SEO requires diligent consideration.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step disable IPv6 on a Debian 12 (Bookworm).
Reasons to Disable IPv6 on Debian 12
While IPv6 advancement is commendable, disabling it might be necessary under certain circumstances. Let’s explore the compelling reasons that might prompt you to take this step.
- Network and Service Compatibility: Not all networks and services are IPv6-ready. By disabling IPv6, you ensure seamless access for all users.
- Security Concerns: IPv6 vulnerabilities, though relatively rare, can be exploited. Disabling IPv6 can mitigate this risk and contribute to a more secure online environment.
-
Prioritizing IPv4 Traffic: Given the broader compatibility of IPv4, disabling IPv6 can help prioritize traffic and enhance the overall user experience.
Prerequisites
- A server running one of the following operating systems: Debian 12 (Bookworm).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- An active internet connection.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Disable IPv6 on Debian 12 Bookworm
Step 1. Before disabling IPv6, it is recommended to update the system to ensure that all packages are up to date. You can do this by running the following command in the terminal:
sudo apt update
Step 2. Disable IPv6 on Debian 12.
First, run the following commands to gather information about active interfaces and their IP addresses:
ifconfig ip addr
These commands reveal the IPv6 addresses and interfaces currently active on your system.
Now open the /etc/sysctl.conf
file using a text editor with administrative privileges. Let’s use nano
:
sudo nano /etc/sysctl.conf
Append the following lines at the end of the file to disable IPv6 globally:
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
Save your changes by pressing Ctrl
+ O
, then press Enter
. Exit the editor by pressing Ctrl
+ X
. Apply the changes with:
sudo sysctl -p
Step 3. Verifying the Disabling of IPv6.
After implementing the changes, verifying their success is essential. Execute the ifconfig
or ip
commands again to ensure that no IPv6 addresses are listed for any interfaces.
To inspect your network interfaces and their associated IP addresses, utilize the ip
command:
ip -4 addr show
Congratulations! You have successfully disabled IPv6. Thanks for using this tutorial to disable IPv6 on Debian 12 Bookworm. For additional help or useful information, we recommend you check the official Debian website.