How toLinuxNetworking

How to disable IPv6 address on Ubuntu 18.x

Disable IPv6 Ubuntu


If you are running Ubuntu 18.x desktop or server the IPv6 network addresses are enabled by default.
In most of the cases this default setting can be simply ignored.
However, in case that you need to disable the IP version 6 network protocol on your Ubuntu 18.x Desktop or Server.

Disable IPv6 – Ubuntu 18.x:

IPv6 network protocol is enabled by default on Ubuntu 18.x

The simplest way to disable the IPv6 on Ubuntu 18.04 is to execute the following commands:

$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 
$ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=
After executing the above sysctl command the IPv6 network addresses are no longer present.

The above IPv6 disable settings would not persist after the reboot. The usual way on how to load the above settings is to edit the /etc/sysctl.conf configuration file by adding the following lines:


The recommend way to disable IPv6 on Ubuntu 18.x after reboot is to configure the GRUB boot loader to pass kernel parameter during the boot.

To do so open the /etc/default/grub using your favorite text editor with root privileges and change/add:

Disable IPv6 protocol also after reboot on Ubuntu 18.x using GRUB

Once you have made the above change within the /etc/default/grub file execute the following commands to apply the GRUB changes:

$ sudo update-grub

All finished. Now you can reboot your Ubuntu 18.04 system.

Enable IPv6 Network Address

To enable IPv6 protocol, To immediately disable IPv6 protocol execute:

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

In case you have also configured the /etc/sysctl.conf configuration file remove the appropriate lines. Lastly, edit the /etc/default/grub using your favourite text editor with root privileges and change/remove:

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

When ready and saved the file execute the commands below:
to apply changes made to the GRUB boot loader configuration.

$ sudo update-grub

Related Articles

Leave a Reply

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

0R4 if6f Yj

Please type the text above: