Files
dock/ipv6
2025-11-05 19:19:36 +08:00

43 lines
1.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
echo "=== Ubuntu IPv6 基础检测 ==="
# 检查系统版本
echo "1. 系统信息:"
lsb_release -d 2>/dev/null || echo " Ubuntu $(uname -r)"
# 检查NetworkManager状态Ubuntu默认
echo "2. 网络管理器状态:"
if systemctl is-active NetworkManager >/dev/null 2>&1; then
echo " ✓ NetworkManager 运行中"
else
echo " ⚠ NetworkManager 未运行"
fi
# 检查IPv6内核参数
echo "3. IPv6内核参数:"
if [[ $(cat /proc/sys/net/ipv6/conf/all/disable_ipv6 2>/dev/null) -eq 0 ]]; then
echo " ✓ IPv6已启用"
else
echo " ✗ IPv6被禁用"
fi
# 检查网络接口
echo "4. 网络接口IPv6状态:"
for iface in $(ip -o link show | awk -F': ' '{print $2}'); do
ipv6_status=$(cat /proc/sys/net/ipv6/conf/$iface/disable_ipv6 2>/dev/null)
if [[ $ipv6_status -eq 0 ]]; then
echo "$iface: IPv6已启用"
else
echo "$iface: IPv6被禁用"
fi
done
# 测试连通性
echo "5. IPv6连通性测试:"
if ping6 -c 2 -W 3 2001:4860:4860::8888 >/dev/null 2>&1; then
echo " ✓ IPv6外网连通正常"
else
echo " ✗ IPv6外网连通失败"
fi