适用环境
- 路由OpenWrt固件有IPV6模块
- 原生IPV6环境
方案
我采用的是6relayd,这也是相对方便的方案。
6relayd is a daemon for serving and relaying IPv6 management protocols to configure clients and downstream routers. 6relayd provides server services for RA, stateless and stateful DHCPv6, DHCPv6-PD and can be used to relay RA, DHCPv6 and NDP between routed (non-bridged) interfaces in case no delegated prefixes are provided by the upstream router.
当然还有其他的方案,如openwrt下的ipv6单一地址做网关(附mentohust、njitclient) 。
软件包准备
opkg intall (ipv6的各种内核模块)
opkg install 6relayd
opkg install odhcp6c(用于获取IPV6地址)
路由获取IPV6地址
默认的wan端口是获取IPV4地址的,要获取IPV6地址,我们需要新建一个接口"wan6",协议为"DHCPv6 client",包含以下接口为自定义接口"@wan",或者直接在配置文件加入vi /etc/config/network
:
config interface 'wan6'
option proto 'dhcpv6'
option ifname '@wan'
内网分配IPV6地址
编辑6relayd的配置文件vi /etc/config/6relayd
,反注释或者加入配置:
config server relay
option master 'wan'
option network 'lan'
option rd 'relay'
option dhcpv6 'relay'
option ndp 'relay'
然后 /etc/init.d/6relayd start
或者在luci web界面开启6relayd服务。