ObjectiveThe objective is to disable IPv6 on Ubuntu Bionic Beaver Linux
Operating System and Software Versions
- Operating System: - Ubuntu 18.04 Bionic Beaver Linux
RequirementsPrivileged access to your Ubuntu System as root or via
sudocommand 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
InstructionsWhether 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
/etc/sysctl.confconfiguration file by adding the following lines:
WARNING: Please note, that at the time of writing this method to disable IPv6 after reboot usingThe 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.confconfiguration 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/grubusing 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/grubfile execute the following commands to apply the GRUB changes:
$ sudo update-grubAll done. Optionally reboot your Ubuntu 18.04 system.
Enable IPv6 Network AddressTo 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.confconfiguration file remove the appropriate lines. Lastly, edit the
/etc/default/grubusing 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.