Home » Ubuntu » How to disable IPv6 in Ubuntu Operating System

How to disable IPv6 in Ubuntu Operating System

Last updated Sep 5, 2021

How to disable ipv6 in Ubuntu system? Two methods of operation will be introduced in this article.

IPv6 Introduction

IPv6 is designed to improve security and performance while ensuring that we do not run out of IP addresses. It assigns a unique address globally to each device and stores it in 128-bit form, while IPv4 has only 32-bits. Although IPv6 aims to replace IPv4, it still has a long way to go. For now, less than 30% of websites or users on the Internet can connect using IPv6, and IPv6 may also cause problems for some applications.

Method 1: Use Sysctl to disable IPv6 protocol in Ubuntu

Execute the following command in “terminal”-check whether IPv6 is enabled:

$ ip a

If the IPv6 protocol is enabled (your network card name may be different), you should see it like below screen:

To temporarily disable IPv6, you only need to execute the following 3 commands in the “terminal”:

$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
$ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
$ sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1

After the above command is executed, use ‘ip a’ to check whether IPv6 is successfully disabled:

Note: The above method only temporarily disables the IPv6 protocol in the Ubuntu system, and the system will automatically enable IPv6 again after restarting.

If you want to permanently disable IPv6 in the Ubuntu system, we can modify the /etc/sysctl.conf file through the editor of this article:

Step 1 – Use a file editor such as VIM or Nano to open the /etc/sysctl.conf configuration file

Step 2 – Add the following 3 lines to the /etc/sysctl.conf configuration file:

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

Step 3 – After the configuration file is modified, to make the settings effective, you need to execute the following commands in the “terminal”:

$ sudo sysctl -p

Method 2: Disable IPv6 protocol via GRUB in Ubuntu

Another way to disable the IPv6 protocol in Ubuntu is to configure GRUB to pass kernel parameters at boot time:

Step 1 – Use a file editor such as VIM or Nano to edit the /etc/default/grub configuration file

Step 2 – Modify GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX to disable IPv6 at startup:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1"
GRUB_CMDLINE_LINUX="ipv6.disable=1"

Step 3 – After the configuration file is modified, to make the settings effective, you need to execute the following commands in the “terminal”:

$ sudo

Related Posts

How to Install CouchDB on Ubuntu 21.04 Linux Operating System

How to Install CouchDB on Ubuntu 21.04 Linux Operating System

The CouchDB is an open-source database system, managed by the Apache Software Foundation. It is fault-tolerant, and schema-free NoSQL database management system.   CouchDB store data in document or files with JSON data structure. Each document contains fields and...

How to add swap space on Ubuntu 21.04 Operating System

How to add swap space on Ubuntu 21.04 Operating System

The swap space is a unique space on the disk that is used by the system when Physical RAM is full. When a Linux machine runout the RAM it use swap space to move inactive pages from RAM. Swap space can be created into Linux system in two ways, one we can create a...

How to Install Nginx on Ubuntu 21.04 Server

How to Install Nginx on Ubuntu 21.04 Server

Nginx is the most potent, open-source, and a high-performance Web server. It can work as a reverse proxy server also, nowadays, is used by most of the most significant websites on the internet. People pronounced “engine x” for Nginx; it is the hot choice for every...

How to Install VirtualBox on Ubuntu 21.04 Linux

How to Install VirtualBox on Ubuntu 21.04 Linux

VirtualBox is an Open Source tool, known as a cross-platform virtualization application or software. It used to run multiple operating systems or virtual machines simultaneously on a single hardware. In this VirtualBox installation tutorial, we will explain the...

Follow Us

Our Communities

More on Ubuntu

The Ultimate Managed Hosting Platform
Load WordPress Sites in as fast as 37ms!

0 Comments

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

16 − 12 =

Shares