Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to disable IPv6 in a Ubuntu system

Shulou Source: shulou.com Published: 2022-06-01 21:39:24 10月03日 Update

Today, I will talk to you about how to disable IPv6 in the Ubuntu system. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Introduction of two methods to disable IPv6 in Ubuntu system

Method 1: disable the IPv6 protocol using Sysctl in Ubuntu

1. Execute the following command in Terminal to see if IPv6 is enabled:

Ip a

If the IPv6 protocol is enabled (your Nic name may be different), you should be able to see it:

two。 To temporarily disable IPv6, you only need to execute the following three commands in the Terminal:

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

After the above command has been executed, use ip a to see if IPv6 is disabled successfully:

Note: the above method only temporarily disables the IPv6 protocol in the Ubuntu system, and the system will automatically enable IPv6 again after reboot.

If you want to permanently disable IPv6 on Ubuntu systems, we can modify the / etc/sysctl.conf file through this article editor:

1. Open the / etc/sysctl.conf configuration file using a file editor such as VIM or Nano

two。 Add the following three lines to the / etc/sysctl.conf configuration file:

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

3. After the modification of the configuration file is complete, for the settings to take effect, you also need to execute the following command in the Terminal:

Sudo sysctl-p

Method 2: disable the IPv6 protocol through GRUB in Ubuntu

Another way to disable the IPv6 protocol in Ubuntu is to configure GRUB to pass kernel parameters at boot time:

1. Edit the / etc/default/grub configuration file using a file editor such as VIM or Nano

two。 Modify GRUB_CMDLINE_LINUX_DEFAULT and GRUB_CMDLINE_LINUX to disable IPv6 at startup:

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

3. After the modification of the configuration file is complete, for the settings to take effect, you also need to execute the following command in the Terminal:

Sudo

After the GRUB configuration modification is completed, the configuration will be retained even when the system is rebooted.

After reading the above, do you have any further understanding of how to disable IPv6 in Ubuntu systems? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

Tags: File configuration system command method content terminal editor different success kernel again parameters just just can pass name that is more knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Shulou Information Linux Shulou Tech Info OPPO Reno