Categories
Network

I tried to use 6rd to get IPv6 at home

It worked. I found a script that uses ip2route set up a 6rd tunnel on Linux. If you look at the script you see that the IPv6 address is calculated from the IPv4 address. That is bad. That means if your IPv4 address changes your IPv6 addresses will also change. I will continue to use a Hurricane electric tunnel. Then the IPv6 addresses will always be the same.

#!/bin/sh

## You must have a real routable IPv4 address for IPv6 rapid deployment (6rd)
## tunnels.
## Also make sure you have at least linux kernel 2.6.33 and you have enabled 6rd
## CONFIG_IPV6_SIT_6RD=y

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

modprobe sit

## Try to autodetect the local ipv4 address
MYIPV4=`ip -o route get 8.8.8.8 | sed 's/.* src \([0-9.]*\) .*/\1/'`

## Generate an IPv6-RD address
MYIPV4_nodots=`echo ${MYIPV4} | tr . ' '`
IPV6=`printf "${PREFIX}:%02x%02x:%02x%02x::1" ${MYIPV4_nodots}`

## Setup the tunnel
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. Uncomment the
## following 3 lines on your Linux router 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}

Leave a Reply

Your email address will not be published. Required fields are marked *