Blog
How to Disable IPv6 in Linux Debian or Ubuntu or other Debian based Linux

IPv6 (Internet Protocol version 6) is the next generation of the Internet Protocol, designed to replace IPv4. However, there may be situations where you need to disable IPv6 on your Linux system, such as simplifying network configuration or resolving conflicts. In this article, we will discuss four popular methods to completely disable IPv6 on Debian 12 or Ubuntu and how to verify that IPv6 is indeed disabled. These methods include modifying system configuration files, updating GRUB settings, configuring NetworkManager, and adjusting initramfs settings. Each approach provides a different level of control and permanence, ensuring that IPv6 is fully disabled across your system.

Some ways how you may disable IPv6 on your PC

I’ll describe four popular ways how to disable IPv6 on your Linux Debian or Ubuntu system below.

Disabling IPv6 via sysctl

1. Open the /etc/sysctl.conf file in a text editor with superuser privileges:

sudo nano /etc/sysctl.conf

2. Add the following lines to the end of the file:

net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1 net.ipv6.conf.lo.disable_ipv6=1 

3. Apply the changes:

sudo sysctl -p

Disabling IPv6 via GRUB

1. Open the /etc/default/grub file in a text editor with superuser privileges:

sudo nano /etc/default/grub

2. Find the line starting with GRUB_CMDLINE_LINUX and add ipv6.disable=1 to the end of the line. For example:

GRUB_CMDLINE_LINUX="ipv6.disable=1"

3. Update the GRUB configuration:

sudo update-grub

4. Reboot the system:

sudo reboot

Disabling IPv6 via NetworkManager (if used)

1. Open the /etc/NetworkManager/NetworkManager.conf file in a text editor with superuser privileges:

sudo nano /etc/NetworkManager/NetworkManager.conf 

2. Add or modify the line in the [main] section:

[main]dns=default

3. Create or edit the /etc/NetworkManager/conf.d/disable-ipv6.conf file:

sudo nano /etc/NetworkManager/conf.d/disable-ipv6.conf

4. Add the following lines:

[main]dns=default[global-dns-domain-*]ipv6=false

5. Restart NetworkManager:

sudo systemctl restart NetworkManager

Disabling IPv6 via initramfs

1. Open the /etc/initramfs-tools/initramfs.conf file in a text editor with superuser privileges:

sudo nano /etc/initramfs-tools/initramfs.conf

2. Add or modify the line:

IPV6=no

3. Update initramfs:

sudo update-initramfs -u

Reboot the system:

sudo reboot

Verifying IPv6 Disablement

Checking for IPv6 Addresses

1. Use the ip command to check for IPv6 addresses on all network interfaces:

ip -6 addr show

If IPv6 is disabled, you should not see any IPv6 addresses in the command output.

Checking IPv6 Status via sysctl

Check the values of sysctl parameters related to IPv6:

sysctl net.ipv6.conf.all.disable_ipv6sysctl net.ipv6.conf.default.disable_ipv6sysctl net.ipv6.conf.lo.disable_ipv6

If IPv6 is disabled, you should see the value 1 for all these parameters.

Check the /etc/default/grub file:

cat /etc/default/grub | grep ipv6.disable

If IPv6 is disabled via GRUB, you should see the line ipv6.disable=1.

Checking NetworkManager Configuration

Check the /etc/NetworkManager/conf.d/disable-ipv6.conf file (if it exists):

cat /etc/NetworkManager/conf.d/disable-ipv6.conf

If IPv6 is disabled via NetworkManager, you should see the line ipv6=false.

Checking Active Connections

Use the ss command to check active connections and listening ports for IPv6:

ss -tuln | grep inet6

If IPv6 is disabled, you should not see any active connections or listening ports for IPv6.

Checking Routing

Use the ip -6 route command to check IPv6 routes:

ip -6 route

If IPv6 is disabled, you should not see any IPv6 routes.

These methods will help you ensure that IPv6 is indeed disabled on your Debian or Ubuntu Linux.

Prev post
The Best Server Configurations for High-Load WordPress Websites
IPv6 (Internet Protocol version 6) is the next generation of the Internet Protocol, designed to replace IPv4. However, there may be situations where you need to disable IPv6 on your Linux system, such as simplifying network configuration or resolving conflicts. In this article, we will discuss four popular methods to completely disable IPv6 on Debian 12 or Ubuntu and how to verify that IPv6 is in…
Frontend Development
read post
Next post
Amazon SEO: A Comprehensive Guide to Boost Your Listing SEO
Amazon Search Engine Optimization (SEO) is a powerful tool that, when used effectively, creates a mutually beneficial situation for both sellers and buyers. By optimizing your product listings, you can increase your product's visibility, boost sales, and help customers find the products they desire. In this guide, we will discuss:The fundamentals of Amazon SEOHow Amazon SEO operates with…
Frontend Development
read post