本文是 All In One HomeLab 虚拟化 iKuai + Mihomo 的 IPv6 扩展配置,介绍如何在现有的透明网关架构中启用 IPv6 支持。
只开启网关访问 IPv6,内网设备无需再获取增加复杂度。
iKuai IPv6 配置
WAN1 配置 IPv6
确保 iKuai 的主外网口(WAN1)能够获取 IPv6 地址:
- 如果是 PPPoE 拨号:在 iKuai 的 WAN1 设置中,勾选 “获取 IPv6” 选项。
- 如果是 DHCP:确保光猫支持 IPv6 并已开启 IPv6 功能,iKuai 会自动获取 IPv6 前缀和地址。
LAN 口配置 IPv6
在 iKuai 的 LAN 设置中启用 IPv6 分发:
- 进入 网络设置 > LAN1 > IPv6 设置
- 外网接口: 配置动态接口、绑定 wan1 口
- 内网接口:开启 DHCPv6,绑定 lan1 口、wan1 口
- 进入 网络设置 > LAN1 > DHCPv6黑白名单
- 使用白名单模式
- 添加网关的 mac 地址

透明网关 IPv6 配置
配置 IPv6 自动获取
编辑 LXC 容器内的 /etc/network/interfaces,为 wan0(连接到 iKuai LAN)添加 IPv6 自动获取配置:
auto lo
iface lo inet loopback
auto lan0
iface lan0 inet static
address 192.168.200.1/24
gateway 192.168.200.2
auto wan0
iface wan0 inet static
address 192.168.100.2/24
iface wan0 inet6 auto
应用配置:
systemctl restart networking
开启内核转发(关键)
既然是旁路由,Debian 必须开启 IPv6 转发功能。编辑 /etc/sysctl.conf:
# 开启 IPv6 转发
net.ipv6.conf.all.forwarding=1
net.ipv6.conf.all.proxy_ndp=1
应用配置:
sysctl -p
验证 IPv6 地址获取
检查透明网关是否成功获取 IPv6 地址:
# 查看 wan0 的 IPv6 地址
ip -6 addr show wan0
# 查看 IPv6 路由表
ip -6 route show
# 测试 IPv6 连通性
curl -6 ifconfig.me
Mihomo IPv6 支持
配置 IPv6 DNS
编辑 /etc/mihomo/config.yaml,添加 IPv6 DNS 服务器:
dns:
enable: true
listen: 0.0.0.0:1053
ipv6: true # 启用 IPv6 DNS 查询
...