IPv6 startup script

From DD-WRT Wiki

Revision as of 19:02, 15 May 2006 by Gerrys (Talk | contribs)
Jump to: navigation, search


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.

 # SIXXS ipv6 startup script for WRT54G
 # external IP
 EXTIP=`/sbin/ifconfig vlan1 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`
 # My tunnel endpoint
 # Sixxs tunnel endpoint
 # Sixxs POP IPv4
 # 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 br0: 2001:abc:def:1::1/64 ..."
 /usr/sbin/ip -6 addr add 2001:abc:def:1::1/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;
   prefix 2001:abc:def:1::1/64 {
     AdvOnLink on;
     AdvAutonomous on;