ipv6配置失败处理
ipv6配置失败处理
如果ipv6通过ifconfig配置失败,且报错如图,说明网卡没有开启ipv6支持。
1.检查业务网卡是否开启ipv6
<button title="Copy Code" class="copy" style="touch-action: manipulation; border: 1px solid var(--vp-code-copy-code-border-color); padding: 0px; background-image: var(--vp-icon-copy); direction: ltr; position: absolute; top: 12px; right: 12px; z-index: 3; border-radius: 4px; width: 40px; height: 40px; opacity: 0; background-position: 50% center; background-size: 20px; background-repeat: no-repeat; transition: border-color 0.25s ease 0s, background-color 0.25s ease 0s, opacity 0.25s ease 0s;"></button>
sysctl -a | grep disable_ipv6
结果如下:
[root@NiuLink64 network-scripts]# sysctl -a | grep disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
net.ipv6.conf.default.disable_ipv6 = 0
sysctl: reading key "net.ipv6.conf.docker0.stable_secret"
net.ipv6.conf.docker0.disable_ipv6 = 0
sysctl: reading key "net.ipv6.conf.eth0.stable_secret"
net.ipv6.conf.eth0.disable_ipv6 = 1
2.发现有 “net.ipv6.conf.eth0.disable_ipv6 = 1”,说明eth0禁用ipv6 (其他业务网卡名同理),执行以下命令
<button title="Copy Code" class="copy" style="touch-action: manipulation; border: 1px solid var(--vp-code-copy-code-border-color); padding: 0px; background-image: var(--vp-icon-copy); direction: ltr; position: absolute; top: 12px; right: 12px; z-index: 3; border-radius: 4px; width: 40px; height: 40px; opacity: 0; background-position: 50% center; background-size: 20px; background-repeat: no-repeat; transition: border-color 0.25s ease 0s, background-color 0.25s ease 0s, opacity 0.25s ease 0s;"></button>
# 注意这里的eth0要替换成实际的业务网卡名
echo "net.ipv6.conf.eth0.disable_ipv6 = 0" >> /etc/sysctl.conf
sysctl -p
3.然后使用 sysctl -a | grep disable_ipv6 检查是否修改成功。