Damjan Georgievski edited this page Oct 28, 2018 · 1 revision

IPv6 rapid deployment (6rd) is based on 6to4, but better since it allows ISPs to have their own IPv6 tunnelling service, with heir own IPv6 prefix and gateway. More info on http://en.wikipedia.org/wiki/IPv6_rapid_deployment.

This script sets your Linux box as a client. Prerequisits are, you must have a real routable IPv4 address for the 6rd tunnel. Also make sure you have at least linux kernel 2.6.33 and you have enabled 6rd (CONFIG_IPV6_SIT_6RD=y).

#!/bin/sh

# ONE.mk 6rd ipv6 prefix and gateway
PREFIX="2a02:2b64"        
GATEWAY=`dig +short 6rd.on.net.mk`

modprobe sit

## Try to autodetect the local ipv4 address
MYIPV4=`ip route get 8.8.8.8 | cut -d ' ' -f 6`
MYIPV4_nodots=`echo ${MYIPV4} | tr . ' '`
## Generate an IPv6-RD address
IPV6=`printf "${PREFIX}:%02x%02x:%02x%02x::1\n" ${MYIPV4_nodots}`


ip tunnel add 6rd mode sit local ${MYIPV4} ttl 64
ip tunnel 6rd dev 6rd 6rd-prefix ${PREFIX}::/32
ip addr add ${IPV6}/32 dev 6rd
ip link set 6rd up
ip route add ::/0 via ::${GATEWAY} dev 6rd

IPv6-rd allows you to have IPv6 network in your LAN too. Add the following 3 lines to your 6rd script and set the correct LAN interface. You might also want to run the 'radvd' sevice to enable IPv6 auto-configuration on the LAN.

sysctl -w net.ipv6.conf.all.forwarding=1
LANIF=eth0
ip addr add ${IPV6}/64 dev ${LANIF}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.