In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to disable IPv6 in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
IPv6 and IPv4 are both network protocols. In Linux systems, the connection timeout may occur when IPv6 and IPv4 exist at the same time. At this time, you only need to disable IPv6 to solve this problem.
See if IPv6 is enabled in Linux
IPv6 is automatically enabled by default in all modern Linux distributions. To see if IPv6 is activated in your Linux, use the ifconfig or ip command. If you see the output with the word "inet6" after entering these commands, it means that your Linux system has IPv6 enabled. $ifconfig
$ip addr
Temporarily disable IPv6
If you want to temporarily shut down IPv6 on your Linux system, you can use the / proc file system. "temporary" means that our changes that disable IPv6 will not be saved after the system restart. IPv6 will be enabled again after your Linux machine is rebooted. To disable IPv6 on a specific network interface, use the following command:
$sudo sh-c 'echo 1 > / proc/sys/net/ipv6/conf//disable_ipv6'
For example, disable IPv6 on the eth0 interface:
$sudo sh-c 'echo 1 > / proc/sys/net/ipv6/conf/eth0/disable_ipv6'
Re-enable IPv6 for the eth0 interface:
$sudo sh-c 'echo 0 > / proc/sys/net/ipv6/conf/eth0/disable_ipv6'
If you want to disable IPv6 on all interfaces of the entire system, including the loopback interface, use the following command:
$sudo sh-c 'echo 1 > / proc/sys/net/ipv6/conf/all/disable_ipv6' permanently disable IPv6
The above methods can not permanently disable IPv6, once you restart the system IPv6 will still be enabled. If you want to turn it off permanently, there are several ways you can try it. Method 1 the first method is to permanently modify / proc through the / etc/sysctl.conf file. In other words, open / etc/sysctl.conf with a text editor and add the following:
# disable IPv6net.ipv6.conf.all.disable_ipv6 for all interfaces of the entire system = disable IPv6 for a specified interface (for example: eth0, lo) net.ipv6.conf.lo.disable_ipv6 = 1net.ipv6.conf.eth0.disable_ipv6 = 1
To make these changes take effect at / etc/sysctl.conf, run the following command:
$sudo sysctl-p / etc/sysctl.conf
Or just restart it.
Method 2 another way to permanently disable IPv6 is to pass a necessary kernel parameter at boot time. Open / etc/default/grub with a text editor and add "ipv6.disable=1" to the GRUBCMDLINELINUX variable.
$sudo vi / etc/default/grubGRUB_CMDLINE_LINUX= "xxxxx ipv6.disable=1"
The "xxxxx" above represents any existing kernel parameters, and add "ipv6.disable=1" after it. Finally, don't forget to save changes to GRUB/GRUB2 in the following ways: Debian, Ubuntu, or Linux Mint systems:
$sudo update-grub
Fedora, CentOS/RHEL system:
$sudo grub2-mkconfig-o / boot/grub2/grub.cfg
Now as long as you restart your Linux system, IPv6 will be completely disabled.
Other optional steps after disabling IPv6
Here are some optional steps to consider after you disable IPv6, because when you disable IPv6 in the kernel, other programs may still try to use IPv6. In most cases, this behavior of the application doesn't affect much, but you can disable IPv6 for them for efficiency or security reasons. / etc/hosts depending on your settings, / etc/hosts will contain one or more hosts of IPv6 and their addresses. Open / etc/hosts with a text editor and comment out the script line that contains IPv6 hosts.
$sudo vi / etc/hosts # comment these IPv6 hosts#:: 1 ip6-localhost ip6-loopback# fe00::0 ip6-localnet# ff00::0 ip6-mcastprefix# ff02::1 ip6-allnodes# ff02::2 ip6-allrouters
NetworkManager if you are using NetworkManager to manage your network settings, you can disable IPv6 in NetworkManager. Open wired connection in NetworkManager, click the "IPv6 Settings" option and select "Ignore" in the "Method" column to save the exit. 201563173528661.png (473 × 489) SSH service by default, the OpenSSH service (sshd) tries to bundle the addresses of IPv4 and IPv6. To force sshd to bind only IPv4 addresses, open / etc/ssh/sshd_config with a text editor and add the following line. Inet applies only to IPv4, while inet6 applies to IPv6.
$sudo vi / etc/ssh/sshd_config AddressFamily inet
Then restart the sshd service.
Thank you for reading! This is the end of this article on "how to disable IPv6 in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.