Category Archives: Networking

IPv6 over IPv4 on Linux using 6to4

6to4 is a tunneling protocol for using IPv6 over an IPv4 connection, and it’s configuration on Linux is well described.

Note: this can only apply to interfaces which have a public IPv4 address

A 6to4 tunnel can be configured using the following shell script

#/bin/bash

# set the interface name
if=wlan0

# calculate the IPv6 address
ipv4=`/sbin/ifconfig $if | grep "inet addr" | sed -e 's/^. *inet addr://' | sed 
-e 's/ .*$//'`
ipv4s=`echo $ipv4 | tr "." " "`

ipv6=`printf "2002:%02x%02x:%02x%02x::1" $ipv4s `

case "$1" in
  start)
/sbin/ip tunnel add tun6to4 mode sit ttl 128 remote any local $ipv4
/sbin/ip link set dev tun6to4 up
/sbin/ip -6 addr add $ipv6/16 dev tun6to4
/sbin/ip -6 route add 2000::/3 via ::192.88.99.1 dev tun6to4 metric 1
# configure firewall
/sbin/ip6tables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
/sbin/ip6tables -A INPUT -j DROP
    ;;
  stop)
/sbin/ip -6 route flush dev tun6to4
/sbin/ip link set dev tun6to4 down
/sbin/ip tunnel del tun6to4
# clear firewall
/sbin/ip6tables -F INPUT
  ;;
  *)
    echo "usage: ipv6 {start|stop}"
    exit 1
esac

exit 0

This will create a new interface ‘tun6to4’ which will be used for IPv6.

See here for link preference.

WiFi (2.4Ghz) Link Calculation

While searching around on how to calculate the maximum distance of a WiFi connection, I came across this very useful link budget calculator.

So far we’re still searching for a way to calculate the area of a fresnel zone which falls below ground. Based on a 1km link the zone starts at the antenna (8m high), extends to the user (1m high), and the fresnel zone has a radius at its centre point of 5.6m. This zone will intersect the ground at 371.181m and 990.905m from the antenna – thanks to Rory McCann for calculating this.

We’re still trying to work out the area of the Freshnel which travels underground. After doing this, we only then need to calculate the loss in dB. Any ideas?