IPv6 startup script

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 20:30, 28 June 2005 (edit)
131.193.177.151 (Talk)

← Previous diff
Revision as of 17:33, 2 July 2005 (edit) (undo)
62.195.125.154 (Talk)

Next diff →
Line 1: Line 1:
-I love you+==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
 + EXTIP=`/sbin/ifconfig vlan1 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`
 + # My tunnel endpoint
 + MYTUNNELIP="2001:abc:abc:abc::2"
 + # Sixxs tunnel endpoint
 + SIXXSTUNNELIP="2001:abc:abc:abc::1"
 + # Sixxs 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 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;
 + };
 + };

Revision as of 17:33, 2 July 2005

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
 EXTIP=`/sbin/ifconfig vlan1 | grep 'inet addr' | awk '{print $2}' | sed -e 's/.*://'`
 # My tunnel endpoint
 MYTUNNELIP="2001:abc:abc:abc::2"
 # Sixxs tunnel endpoint
 SIXXSTUNNELIP="2001:abc:abc:abc::1"
 # Sixxs 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 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;
   };
 };