IPv6 startup script
From DD-WRT Wiki
Revision as of 08:40, 26 July 2007 by 213.139.183.178 (Talk)
Instructions
The script below is targetted at users that have already obtained a SixXS tunnel and subnet. See also http://sixxs.net and http://sconk.se/dd-wrt_ipv6_guide/ for info.
#!/bin/sh # # SIXXS ipv6 startup script for WRT54G # # external IP (Your IPv4) EXTIP=`/sbin/ifconfig vlan1 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'` # My tunnel endpoint (Your IPv6) MYTUNNELIP="2001:abc:abc:abc::2" #My subnet prefix (Subnet Prefix) SUBNET="2001:abc:abc:cba::" # Sixxs tunnel endpoint (PoP IPv6) SIXXSTUNNELIP="2001:abc:abc:abc::1" # Sixxs POP IPv4 (PoP IPv4) SIXXS4="193.109.122.244" # create tunnel echo "- Creating SIXXS tunnel... ${EXTIP} <--> ${SIXXS4}" /usr/sbin/ip tunnel add sixxs mode sit local ${EXTIP} remote ${SIXXS4} # bring tunnel interface up explicitly echo "- Bringing sixxs device up..." /usr/sbin/ip link set sixxs up # fix MTU and TTL echo "- Fixing MTU and TTL of sixxs device..." /usr/sbin/ip link set mtu 1280 dev sixxs /usr/sbin/ip tunnel change sixxs ttl 64 # Add virthost IPs before adding tunnel IP # ... # configure IPv6 endpoint on the tunnel echo "- Configuring my IPv6 tunnel endpoint..." /usr/sbin/ip -6 addr add ${MYTUNNELIP}/64 dev sixxs # default route echo "- Adding default route through SIXXS..." /usr/sbin/ip -6 ro add default via ${SIXXSTUNNELIP} dev sixxs # add a /64 network from the /60 prefix to br0 echo "- Setting up Subnet ..." /usr/sbin/ip -6 addr add ${SUBNET}/64 dev br0 # start router advertisement daemon echo "- Starting radvd..." /sbin/radvd -C /tmp/smbshare/etc/radvd.conf echo "---- end IPv6 setup ----"
An example radvd.conf:
interface br0 { AdvSendAdvert on; AdvHomeAgentFlag on; AdvLinkMTU 1280; MinRtrAdvInterval 3; MaxRtrAdvInterval 10; prefix [REPLACE WITH SUBNET]/64 { AdvOnLink on; AdvAutonomous on; AdvRouterAddr on; }; };