云服务器

首页 > 其他教程 > 服务器上如何禁用接收IPv6?

服务器上如何禁用接收IPv6?

cat << EOF >> /etc/sysctl.conf

Disable IPv6 autoconf

net.ipv6.conf.default.autoconf=0
net.ipv6.conf.default.accept_ra=0
net.ipv6.conf.all.autoconf=0
net.ipv6.conf.all.accept_ra=0
EOF

sysctl -w net.ipv6.conf.default.autoconf=0
sysctl -w net.ipv6.conf.default.accept_ra=0
sysctl -w net.ipv6.conf.all.autoconf=0
sysctl -w net.ipv6.conf.all.accept_ra=0
对于每个接口,无需重新启动

sysctl -w net.ipv6.conf.IFACE.autoconf = 0
sysctl -w net.ipv6.conf.IFACE.accept_ra = 0
其中IFACE是接口的名称

CentOS系统服务器
echo IPV6_AUTOCONF=”no” >> /etc/sysconfig/network
Debian / Ubuntu系统服务器
提交
/etc/network/interfaces

pre-up echo 0> / proc / sys / net / ipv6 / conf / $ IFACE / autoconf
pre-up echo 0> / proc / sys / net / ipv6 / conf / $ IFACE / accept_ra
pre-up echo 0> / proc / sys / net / ipv6 / conf / $ IFACE / accept_ra_defrtr

pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra_pinfo
pre-up echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra_rtr_pref

图片描述

发表回复