禁用IPv6的三种高效方法:NetworkManager、sysctl、内核模块调整

现在新版本的Linux操作系统默认启用Internet协议版本6(IPv6)。但是,在某些情况下,某些用户可能会发现需要禁用IPv6支持。本文将详细介绍如何禁用IPV6服务。

(一)在NetworkManager中禁用IPv6

1.对于RHEL7和RHEL8.0:

[root@yunweixia.com ~]# nmcli connection modify  ipv6.method "ignore"

2.对于RHEL8.1及更高版本和9:

[root@yunweixia.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@yunweixia.com ~]# sysctl -p /etc/sysctl.d/ipv6.conf

剩余内容需解锁后查看

您需要订阅解锁才能查看当前内容

订阅用户订阅用户免费
已付费?登录刷新

原创文章,作者:运维侠,如若转载,请注明出处:https://www.yunweixia.com/solutions/disable-ipv6-3-efficient-methods-networkmanager-sysctl-kernel-module-tuning.html

(0)
运维侠的头像运维侠共建用户
上一篇 2025年7月17日 18:11
下一篇 2025年7月19日 18:11

相关推荐

发表回复

登录后才能评论