Search Our Database

How to disable ipv6 on Ubuntu/Debian

Last updated on |

Introduction

IPv6 is enabled by default on most modern Linux distributions. However, certain network configurations, security policies, or compatibility issues may require disabling IPv6 on a server.

This guide provides a step-by-step method to disable IPv6 by modifying the sysctl configuration.

 

Prerequisites

  • Root or sudo privileges to modify system files.
  • A text editor installed (such as vim or nano).
  • Basic knowledge of the Linux command line.

 

Step-by-Step Guide

Step 1: Check IPv6 Status on Your Server

Before disabling IPv6, verify whether it is currently enabled by running:

ip a | grep inet6

If IPv6 is active, you will see IPv6 addresses listed.

 

Step 2: Edit the sysctl Configuration File

Open the sysctl.conf file using a text editor:

vim /etc/sysctl.conf

 

Step 3: Add the Following Lines to Disable IPv6

Append the following configuration lines at 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

After adding the lines, save and exit the file:

  • Press ESC, then type :wq and press Enter.

 

Step 4: Apply the Changes

Run the following command to reload the sysctl settings:

sysctl -p

 

 

Step 5: Verify IPv6 is Disabled

Check if IPv6 is disabled by running:

ip a | grep inet6

If no IPv6 addresses appear, IPv6 has been successfully disabled.

 

 

Conclusion

🚀 Congratulations! You have successfully disabled IPv6 on your Linux server. With these changes, your server will now operate solely on IPv4, reducing potential security risks and ensuring compatibility with services that do not yet support IPv6.

By disabling IPv6, you can:
✅ Prevent potential IPv6-related network misconfigurations.
✅ Improve security by eliminating unused network protocols.
✅ Ensure better compatibility with IPv4-only applications and services.

If you encounter any issues or require further assistance, don’t hesitate to reach out to IPServerOne Customer Support at support@ipserverone.com.