OPNsense OpenWRT IPv6设置

OPNsense、OpenWRT 关系

opnsense 为主路由,openwrt 为旁路,ipv4 和 ipv6 均由 opnsense 分配,openwrt 主要用于插件

OPNsense 设置

接口->WAN->
  IPv6 配置类型设置为DHCPv6
  DHCPv6客户端配置->
    勾选仅请求IPv6前缀
    勾选使用IPv4连接
接口->LAN->
  IPv6 配置类型设置为跟随接口
  跟踪IPv6接口->
    IPv6接口设置为 WAN

保存后,连接 opnsense shell,输入

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
root@OPNsense:~ # ifconfig
vtnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c00b8<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,VLAN_HWTSO,LINKSTATE>
ether xx:xx:xx:xx:xx:xx
hwaddr xx:xx:xx:xx:xx:xx
inet6 xxx::xxxx:xxxx:xxxx:xxxx%vtnet0 prefixlen 64 scopeid 0x1
inet6 240e:xxx:xxx:xxxx:xxxx:xxxx:xxxx:xxxx prefixlen 56
inet 10.1.1.253 netmask 0xffffff00 broadcast 10.1.1.255
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
media: Ethernet 10Gbase-T <full-duplex>
status: active
vtnet1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c00b8<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,VLAN_HWTSO,LINKSTATE>
ether xx:xx:xx:xx:xx:xx
hwaddr xx:xx:xx:xx:xx:xx
inet6 fe80::xxxx:xxxx:xxxx:xxxx%vtnet1 prefixlen 64 scopeid 0x2
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
media: Ethernet 10Gbase-T <full-duplex>
status: active
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