How to disable IPv6 address on Ubuntu 18.04 Bionic Beaver Linux
op
Objective
The objective is to disable IPv6 on Ubuntu Bionic Beaver LinuxOperating System and Software Versions
- Operating System: - Ubuntu 18.04 Bionic Beaver Linux
Requirements
Privileged access to your Ubuntu System as root or viasudo
command is required.
Conventions
- # - requires given linux commands to be executed with root privileges either directly as a root user or by use of
sudo
command - $ - given linux commands to be executed as a regular non-privileged user
Other Versions of this Tutorial
Ubuntu 20.04 (Focal Fossa)Instructions
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
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.
$ sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 $ sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
/etc/sysctl.conf
configuration file by adding the following lines:
net.ipv6.conf.all.disable_ipv6=1 net.ipv6.conf.default.disable_ipv6=1
WARNING: Please note, that at the time of writing this method to disable IPv6 after reboot using
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. /etc/sysctl.conf
configuration file on Ubuntu 18.04 does Not work. However, this seems to be a bug so feel free to try.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"
/etc/default/grub
file execute the following commands to apply the GRUB changes:
$ sudo update-grubAll 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=0In 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-grubto apply changes made to the GRUB boot loader configuration.
How to disable IPv6 address on Ubuntu 18.04 Bionic Beaver Linux