In this article you will learn how to temporarily or permanently disable IPv6 on Ubuntu 20.04 LTS Focal Fossa

In this tutorial you will learn:
  • How to temporarily disable IPv6
  • How to permanently disable IPv6
Disable IPv6 address on Ubuntu 20.04 LTS
Disable IPv6 address on Ubuntu 20.04 LTS

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Installed or upgraded Ubuntu 20.04 Focal Fossa
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

How to disable IPv6 address on Ubuntu 20.04 LTS Focal Fossa step by step instructions

To temporarily disable IPv6 address on Ubuntu 20.04 LTS Focal Fossa execute the following commands:
# sysctl -w net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6 = 1
# sysctl -w net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6 = 1
The above commands will temporarily disable IPv6, meaning that the settings will not persist after reboot. To re-enable IPv6 reboot your system or execute the above commands again however reverse the logic and change 1 to 0. In case you need more permanent solution to disable IPv6 even after system reboot follow the steps below:

  1. As an administrative user open up the /etc/default/grub file using your favourite text editor and make to following changes:
    FROM:
    GRUB_CMDLINE_LINUX_DEFAULT=""
    TO:
    GRUB_CMDLINE_LINUX_DEFAULT="ipv6.disable=1"
    

  2. SUBSCRIBE TO NEWSLETTER
    Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


  3. Once ready update Grub menu:
    $ sudo update-grub
    
  4. In case you need to re-enable the IPv6 network addresses simply remove the ipv6.disable=1 from the /etc/default/grub file and run the update-grub command.
ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on LinuxCareers.com.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.