Create ipv6

This commit is contained in:
2025-11-05 19:16:54 +08:00
committed by GitHub
parent 895619af12
commit a6f100371d

52
ipv6 Normal file
View File

@@ -0,0 +1,52 @@
#!/bin/bash
echo "=== IPv6 专业检测工具 ==="
# 颜色定义
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# 检测函数
check_with_color() {
if $1 &> /dev/null; then
echo -e "${GREEN}✓ $2${NC}"
return 0
else
echo -e "${RED}✗ $2${NC}"
return 1
fi
}
echo "正在执行IPv6检测..."
# 1. 内核支持检测
check_with_color "test -f /proc/net/if_inet6" "内核IPv6支持"
# 2. IPv6地址检测
echo -e "\nIPv6地址信息:"
ip -6 addr show | grep "inet6" | head -5 | while read line; do
echo -e " ${YELLOW}$line${NC}"
done
# 3. 连通性测试
echo -e "\n连通性测试:"
check_with_color "ping6 -c 1 -W 3 2001:4860:4860::8888" "Google IPv6 DNS"
check_with_color "ping6 -c 1 -W 3 2606:4700:4700::1111" "Cloudflare IPv6 DNS"
# 4. 路由检测
echo -e "\nIPv6路由表:"
ip -6 route show | head -5 | while read line; do
echo -e " ${YELLOW}$line${NC}"
done
# 5. 总结报告
echo -e "\n=== 检测总结 ==="
if ip -6 addr show | grep -q "inet6" && ping6 -c 1 -W 2 2001:4860:4860::8888 &> /dev/null; then
echo -e "${GREEN}✅ 系统IPv6功能完整正常${NC}"
elif ip -6 addr show | grep -q "inet6"; then
echo -e "${YELLOW}⚠️ 系统有IPv6地址但无法访问外网${NC}"
else
echo -e "${RED}❌ 系统未启用IPv6${NC}"
fi