全球主机交流论坛

标题: 记vps增加ipv6地址后断网修复 [打印本页]

作者: acg88    时间: 4 天前
标题: 记vps增加ipv6地址后断网修复
naranja 的 黑五圣诞优惠 2c5g小鸡默认是不上ipv6的,工单喊老板加上后,出现网络错误都连不上。
后台面板只有vnc可以连上,打开vnc连接,以下是GEMINI回答修复:
检查网络 输入命令: systemctl status networking
如果显示 Active: failed,说明你的 IPv6 配置语法有误
修复: 使用 vi /etc/network/interfaces 检查。确保 IPv6 紧跟在 IPv4 配置之后,且格式正确

修改前
# IPv4 配置
auto eth0
iface eth0 inet static
    address 1.2.3.4
    netmask 255.255.255.0
    gateway 1.2.3.1

# IPv6 配置 (检查这部分)
iface eth0 inet6 static
    address 2001:db8::10/64
    gateway 2001:db8::1

修改后(以 ens3 为例)

auto ens3
iface ens3 inet static
    address 1.2.3.4
    netmask 255.255.255.0
    gateway 1.2.3.1

# IPv6 配置 (检查这部分)
iface ens3 inet6 static
    address 2001:db8::10/64
    gateway 2001:db8::1
按 Ctrl + O 保存,按 Enter 确认,按 Ctrl + X 退出。

强制清除旧的状态:ip addr flush dev ens3
运行以下命令使配置生效:systemctl restart networking
检查状态:systemctl status networking
只要状态显示为绿色的 active (exited),你的 SSH 应该就能恢复连接了。

如果ssh还是无法连接,但其他服务已经恢复
检查 SSH 是否在监听 IPv4: ss -tlnp | grep 22
如果看到 0.0.0.0:22,说明 IPv4 正常
临时关闭防火墙:
ufw disable         # 如果安装了 ufw
nft flush ruleset   # 清空所有规则
尝试此时重新连接 SSH。
作者: Frp大佬    时间: 4 天前
技术贴,必须收藏加支持




欢迎光临 全球主机交流论坛 (https://hostloc.onozo.cc/) Powered by Discuz! X3.4