OPNsense、OpenWRT 关系
opnsense 为主路由,openwrt 为旁路,ipv4 和 ipv6 均由 opnsense 分配,openwrt 主要用于插件
OPNsense 设置
接口
->WAN
->
IPv6 配置类型
设置为DHCPv6
DHCPv6客户端配置
->
勾选仅请求IPv6前缀
勾选使用IPv4连接
接口
->LAN
->
IPv6 配置类型
设置为跟随接口
跟踪IPv6接口
->
IPv6接口
设置为 WAN
保存后,连接 opnsense shell,输入
1 | root@OPNsense:~ # ifconfig |
1 | vtnet0为WAN,vtnet1为LAN |
1 | inet6 240e:xxx:xxx:xxxx:xxxx:xxxx:xxxx:xxxx prefixlen 56 |
240e 开头的即为公网 ip,后面的 prefixlen 56,为前缀委托大小
复制到接口
->WAN
->DHCPv6客户端配置
->前缀委托大小
中,默认是 64
1 | inet6 fe80::xxxx:xxxx:xxxx:xxxx%vtnet1 prefixlen 64 scopeid 0x2 |
fe80 开头的为内网 ip,后面的 scopeid 0x2 为 IPv6 前缀 ID,复制 0x 后面数字到接口
->LAN
->跟踪IPv6接口
->IPv6前缀ID
中
保存应用
OpenWRT 设置
网络
->接口
->修改LAN接口
IPv6 分配长度
修改为56
,即 opnsense 中设置的前缀委托大小
DHCP 服务器
->IPv6设置
路由通告服务
、DHCPv6 服务
、NDP 代理
均设置为中继模式
保存应用
测试
1 | ping6 240C::6666 |