The objective is to disable IPv6 on Ubuntu Bionic Beaver Linux
Operating System and Software Versions
- Operating System: – Ubuntu 18.04 Bionic Beaver Linux
Privileged access to your Ubuntu System as root or via
sudo command is required.
- # – requires given linux commands to be executed with root privileges either directly as a root user or by use of
- $ – given linux commands to be executed as a regular non-privileged user
Other Versions of this Tutorial
Whether you are running Ubuntu 18.04 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.04 Desktop or Server this tutorial we help you to do just that.
Disable IPv6 Network Address
The simplest way to instantly disable the IP version 6 network protocol system on 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=1
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:
/etc/sysctl.confconfiguration file on Ubuntu 18.04 does Not work. However, this seems to be a bug so feel free to try.
The recommend method to disable IPv6 on Ubuntu 18.04 after reboot is to configure the GRUB boot loader to pass kernel parameter during the boot time.
To do so open the
/etc/default/grub using your favorite text editor with root privileges and change/add:
FROM: GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="" TO: GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1" GRUB_CMDLINE_LINUX="ipv6.disable=1"
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 done. Optionally reboot your Ubuntu 18.04 system.
Enable IPv6 Network Address
To enable IPv6 protocol simply reverse the above procedure. 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=0
In case you have also configured the
/etc/sysctl.conf configuration file remove the appropriate lines. Lastly, edit the
/etc/default/grub using your favorite text editor with root privileges and change/remove:
FROM: GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1" GRUB_CMDLINE_LINUX="ipv6.disable=1" TO: GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX=""
When ready execute:
$ sudo update-grub
to apply changes made to the GRUB boot loader configuration.