Sunday, June 15, 2008

IPV6 OpenWrt Kamikaze.

This is mostly an adaptation of various ipv6 install bits around.
Kamikaze is a little different, and the documentation isn't entirely
complete -- so I thought I would reproduce what I did in here. It isn't
perfect, but it is working for my /64 delegations of the /48 I have
routed to my fat-pipe machine.

Names changed to protect the innocent.


ipkg install kmod-ipv6
ipkg install radvd
ipkg install ip
ipkg install kmod-ip6tables
ipkg install ip6tables


/etc/hotplug.d/iface/10-ipv6:

. /etc/functions.sh
NAME=ipv6
COMMAND=/usr/sbin/ip
IPV6PREFIX="the:/48:subnet:here:2"
REMOTE="fat.pip.es.heh"

[ "$ACTION" = "ifup" -a "$INTERFACE" = "wan" ] && {
[ -x $COMMAND ] && {
VLAN=$(nvram get ${INTERFACE}_ifname)
IFNAME=eth0.${VLAN#vlan}
IPV4=$(ip -4 addr show $IFNAME | grep inet | cut -f6 -d' ' | cut
-f1 -d'/')
ip tunnel add fatty-ipv6 mode sit ttl 255 remote $REMOTE local $I
PV4
ip link set dev fatty-ipv6 up
ip -6 addr add ${IPV6PREFIX}::2/48 dev fatty-ipv6
ip -6 route add ::/0 dev fatty-ipv6 metric 1
}
}
[ "$ACTION" = "ifdown" -a "$INTERFACE" = "wan" ] && {
[ -x $COMMAND ] && {
VLAN=$(nvram get ${INTERFACE}_ifname)
IFNAME=eth0.${VLAN#vlan}
IPV4=$(ip -4 addr show $IFNAME | grep inet | cut -f6 -d' ' | cut
-f1 -d'/')
ip -6 route flush dev fatty-ipv6
ip tunnel del fatty-ipv6
}
}


/etc/config/network:

config interface lan
option type bridge
option ifname "eth0.0"
option proto static
option ipaddr 192.168.1.1
option ip6addr the:/48:subnet:here:2::2/64


/etc/config/firewall:

accept:proto=41


/etc/firewall.user:

iptables -t nat -D POSTROUTING -o wan -j MASQUERADE
iptables -t nat -A POSTROUTING --protocol ! 41 -o wan -j MASQUERADE


/etc/radvd.conf:

interface br-lan
{
AdvSendAdvert on;

#
# Disable Mobile IPv6 support
#
AdvHomeAgentFlag off;

#
# example of a standard prefix
#
prefix the:/48:subnet:here:2::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr off;
};

};


/etc/init.d/radvd enable

Reboot, or whatever. {/etc/init.d/(network|firewall|radvd) restart}

0 comments: