• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux

By admin

Ubuntu 18.04 Bionic Beaver Linux enables Internet Protocol Version 6 (IPv6) by default. However, in certain situations, some users may find it desirable to disable IPv6 support or to re-enable it after it has been disabled.

Disabling IPv6 support (Permanently)

Disable ipv6 built-in kernel module.

1. Edit /etc/default/grub and append ipv6.disable=1 to GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT like the following sample:

FROM:

GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

TO:

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

2. Run the update-grub command to regenerate the grub.cfg file:

# update-grub

3. Reboot the system to disable IPv6 support.

Disabling IPv6 via sysctl settings

Alternatively, this can be done via sysctl settings.

1. To disable Ipv6 temporarily on the system apply the below sysctl settings:

$ sysctl -w net.ipv6.conf.all.disable_ipv6=1
$ sysctl -w net.ipv6.conf.default.disable_ipv6=1
$ sysctl -w net.ipv6.conf.lo.disable_ipv6=1

2. In order to make the above sysctl changes permanent, we need to add them to /etc/sysctl.conf confirguation file.

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6 = 1

3. Use “sysctl -p” to apply the changes from /etc/sysctl.conf file.

# sysctl -p

4. An output of 1 from the below command verifies that the IPv6 has been successfully disabled.

# cat /proc/sys/net/ipv6/conf/all/disable_ipv6
1

Re-enabling IPv6 support

1. Edit /etc/default/grub and delete the entry ipv6.disable=1 from the GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT, like the following sample:

FROM:

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

TO:

GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

2. Run the “update-grub” command to regenerate the grub.cfg file.

# update-grub

3. Delete the below entries from /etc/sysctl.conf file:

net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6 = 1

4. Use “sysctl -p” to apply the changes from /etc/sysctl.conf file.

# sysctl -p

5. Reboot the system if required.

Filed Under: Linux, Ubuntu

Some more articles you might also be interested in …

  1. How to Configure rsyslog Server to Accept Logs via SSL/TLS
  2. How to rename a KVM VM with virsh
  3. How to send Audit Logs to Remote Rsyslog Server in CentOS/RHEL 6,7
  4. UNIX / Linux : How crontab validates the access based on the cron.allow and cron.deny files
  5. Managing Clustered Logical Volumes in RHEL Cluster (pacemaker)
  6. CentOS / RHEL : How to resize (extend) existing Physical Volume (PV)
  7. CentOS / RHEL 6 : How to add/remove additional IP addresses to a network interface
  8. How to disable IPv6 on CentOS / RHEL 7
  9. RHEL 7 – RHCSA Notes (Cheat Sheets)
  10. RHEL 7 – RHCSA Notes – input / output redirection

You May Also Like

Primary Sidebar

Recent Posts

  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • How to Capture More Logs in /var/log/dmesg for CentOS/RHEL
  • Unable to Start RDMA Services on CentOS/RHEL 7
  • How to rename a KVM VM with virsh
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary