Board logo

标题: Linux禁用IPv6或设置IPv4优先 [打印本页]

作者: linda    时间: 2022-7-17 17:11     标题: 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 编辑 ]




欢迎光临 中神通公司技术论坛 (http://trustcomputing.com.cn/bbs/) Powered by Discuz! 6.0.0