OpenWRT + 隧道IPv6配置

SixXS的Tunnel broker不仅支持PC,也可以放到路由上面使用,正好本人最近入手了WL-500G Premium V2,于是就把Aiccu放到了路由上面,这样就有连续稳定的IPv6连接了。

基本配置:ASUS WL-500G Premium V2, OpenWRT Backfire 10.03 brcm-2.4。

固件地址:http://downloads.openwrt.org/backfire/10.03/brcm-2.4/openwrt-brcm-2.4-squashfs.trx

刷完固件之后登录ssh,执行

opkg update
opkg install aiccu

然后执行

sysctl -a | grep forward查看ipv6的转发是否打开。如果没有的话修改/etc/sysctl.conf

net.ipv6.conf.all.forwarding=1

接下来修改/etc/config/aiccu

基本上填上用户名密码就可以了。范例:

config aiccu
option username 'your-username'
option password 'your-password'
option protocol ''
option server ''
option interface 'sixxs'
option tunnel_id ''
option requiretls '0'
option defaultroute '1'
option nat '1'
option heartbeat '1'

同时aiccu要求本机时间与标准时间相差不能超过2分钟,否则会自动断线。用ntpclient同步下时间。

设置好之后reboot一下,然后执行/etc/init.d/aiccu,再执行logread看看有错误没有。如果输出这样的话基本上就没问题了:

Mar 22 12:00:39 TZR local7.info syslog: AICCU running as PID 832
Mar 22 12:00:40 TZR local7.info syslog: [AYIYA-start] : Anything in Anything (draft-02)
Mar 22 12:00:40 TZR local7.info syslog: [AYIYA-tun->tundev] : (Socket to TUN) started

测试下ping6 ipv6.google.com能否ping通。如果logread里面有sixxs: no ipv6 router present的话检查转发规则是否设置正确。

由于OpenWRT的aiccu软件包有点问题,所以还需要手工修改启动脚本:

首先是/etc/init.d/aiccu

开头的START=50改为START=80

["$defaultroute" != "1"] && echo "defaultroute false" >> /tmp/run/aiccu-${cfgs_section}.conf
["$nat" = "1"] && echo "behindnat true" >> /tmp/run/aiccu-${cfgs_section}.conf

原始的脚本在两个红色的地方缺少了双引号。

然后进入/etc/hotplug.d/

40-rdate重命名为30-rdate50-aiccu重命名为80-aiccu,以确保aiccu在rdate和radvd之后执行。

然后将80-aiccu改为如下内容:

#!/bin/sh
["$ACTION" = "ifdown" -a "$INTERFACE" = "eth0.1"] && /etc/init.d/aiccu stop
["$ACTION" = "ifup" -a "$INTERFACE" = "eth0.1"] && /etc/init.d/aiccu start

其中eth0.1是这个路由的wan接口,如果不是的话要做相应修改。

最后记得要在LuCI里面启用aiccu。

至此的话路由连接IPv6的部分应该就完成了,下一篇文介绍如何配置radvd。