发新话题
打印

Linux禁用IPv6或设置IPv4优先

Linux禁用IPv6或设置IPv4优先

打开/etc/gai.conf,删除下面这一行的注释 “#” 即可设置为IPv4优先,反之则为IPv6

precedence ::ffff:0:0/96 100

========
完全关闭ipv6

echo " ">>/etc/sysctl.conf
echo "# made for disabled IPv6 in $(date +%F)">>/etc/sysctl.conf
echo 'net.ipv6.conf.all.disable_ipv6 = 1'>>/etc/sysctl.conf
echo 'net.ipv6.conf.default.disable_ipv6 = 1'>>/etc/sysctl.conf
echo 'net.ipv6.conf.lo.disable_ipv6 = 1'>>/etc/sysctl.conf
tail -5 /etc/sysctl.conf
sysctl -p

[ 本帖最后由 linda 于 2022-7-17 17:13 编辑 ]

TOP

发新话题