禁用IPv6
编辑配置文件
vi /etc/sysctl.conf
添加
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
使设置生效
sysctl -p
查看本机IP
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'
上一步已经禁用了 IPv6,但是重启后会复原。要想重启后也禁用,则必须做这一步
vim /etc/rc.local
填入内容
#!/bin/bash
# /etc/rc.local
/etc/sysctl.d
/etc/init.d/procps restart
exit 0
赋权
chmod 755 /etc/rc.local
评论区