现在新版本的Linux操作系统默认启用Internet协议版本6(IPv6)。但是,在某些情况下,某些用户可能会发现需要禁用IPv6支持。本文将详细介绍如何禁用IPV6服务。
(一)在NetworkManager中禁用IPv6
1.对于RHEL7和RHEL8.0:
[root@shizhanxia.com ~]# nmcli connection modify ipv6.method "ignore"
2.对于RHEL8.1及更高版本和9:
[root@shizhanxia.com ~]# nmcli connection modify ipv6.method "disabled"
(二)通过sysctl设置禁用IPv6
1.创建一个名为的新文件/etc/sysctl.d/ipv6.conf包含以下文本。
# First, disable for all interfaces net.ipv6.conf.all.disable_ipv6 = 1 # If using the sysctl method, the protocol must be disabled on all specific interfaces, as well. net.ipv6.conf..disable_ipv6 = 1 # By default, we do not disable IPv6 on localhost, as it's important for multiple # components. If you want to disable it anyway, change the following # value to 1. net.ipv6.conf.lo.disable_ipv6 = 0
2.然后需要重新加载新设置:
[root@shizhanxia.com ~]# sysctl -p /etc/sysctl.d/ipv6.conf
原创文章,作者:保哥,如若转载,请注明出处:https://www.shizhanxia.com/1076.html