二级路由的 ipv6 路由表需要自己维护,不维护就是不通
安装计算子网的软件包
opkg install owipcalc
手动在 WAN 口获得 IPv6 地址后添加一条路由表,让整个子网重定向到 LAN 口,编辑下面文件
/etc/hotplug.d/iface/80-reset-route6
内容
#!/bin/sh
wan_dev="wan6"
[ "$HOTPLUG_TYPE" = "iface" ] || exit 0
[ "$INTERFACE" = "$wan_dev" ] || exit 0
RTMETRIC=127
. /lib/functions/
network.shnetwork_get_physdev lan_dev lan || exit 0
ifup_cb() {
local _lan_dev="$1"
local _metric="$2"
local wan_subnet
network_get_subnet6 wan_subnet "$wan_dev" || return
_wan_network=$(owipcalc "${wan_subnet}" network)
ip -6 route replace "$_wan_network" dev "$_lan_dev" metric "$_metric"
}
ifdown_cb() {
local _lan_dev="$1"
local _metric="$2"
ip -6 route flush dev "$_lan_dev" metric "$_metric"
}
case "$ACTION" in
ifup)
ifup_cb "$lan_dev" "$RTMETRIC"
;;
ifdown)
ifdown_cb "$lan_dev" "$RTMETRIC"
;;
ifupdate)
ifdown_cb "$lan_dev" "$RTMETRIC"
sleep 1
ifup_cb "$lan_dev" "$RTMETRIC"
;;
*)
;;
esac
exit 0
作用就是
#ip -6 route replace "240e:XXX:3e00::/64" dev "br-lan" metric "127"
#路由表添加 240e:XXX:3e00::/64 dev br-lan metric 127 pref medium