Saturday, March 2, 2013

Raspberry PI as IPv6 router in Home Network

Its been many years IPv6 is introduced but still most ISP are using IPv4. Here I am sharing, how to use the Raspberry Pie as IPv6 router in tunneled mode. No need of IPv6 capable router. IPv6 will also work over Wi-Fi of old IPv4 router. I am using the IPv6 tunnel broker gogo6/Freenet for IPv6 connectivity.

  1. Raspberry Pi with Raspbian Wheezy
  2. Connect Raspberry Pi to router with Ethernet cable
  3. Optionally connect to raspberry pi using shh with this command from the terminal:
  4. ssh pi@ip_address

Step 1: Login in your Raspberry pi via ssh and install gogoc client and radvd with the following command.
sudo apt-get update 
sudo apt-get install gogoc radvd
gogoc is client for IPv6 tunnel broker freenet and radvd is used to provide router functionality.

Step 2: Now sign up for gogoNET account and login.

Step 3: After login, get your freenet6 tunnel username and password from here. Freenet6 tunnel username and password is different from login. Choose any one of the tunnel end point server and make new username and password for the freenet6 IPv6 tunnel.

Step 4: Now edit the gogo6 configuration file with the following file.
sudo nano /etc/gogoc/gogoc.conf
Edit the following fields:
userid= #tunnel user id from step 3
passwd= #tunnel password from step 3 or
#run command "ifconfig" to check its correct value, usually its eth0 or eth1 for ethernet and wlan0 or wlan1 for wireless lan.
Leave the rest fields to their default.

Step 5: Now restart gogoc service with the following commands using appropriate command:
to start:      sudo service gogoc start
to stop :      sudo service gogoc start
to restart:    sudo service gogoc restart

This command will be helpful if you face any key related problem in gogoc :
sudo /usr/sbin/gogoc -n

Step 6: Run the following command.
You should see "tun" interfaces and IPv6 address allocated to your PI if you properly configured the gogoc configuration file in step 4.

Step 7: Now open the log file of gogoc to see prefix allocated to you with the following command:
cat /var/log/gogoc/gogoc.log
You should see a line:
gogoc: Your IPv6 prefix is 2221:0222:1996:0000:0000:0000:0000:0000/56 
if you are successfully connected. Copy it. If there is no IPv6 address than it will show some error messages and will retry after some time.

Step 8: Enable IPv6 routing. Edit the sysctl.conf to enable IPv6 routing with the following command.
sudo nano /etc/sysctl.conf
Uncomment the following line / Remove hash from the start of the following line:

Step 9: Now we will configure radvd. Run the following command
sudo nano /etc/radvd.conf
Paste the following lines in this file:

interface eth0
   AdvSendAdvert on;
   prefix 2001:xxxx:xxxx::/64
        AdvOnLink on;
        AdvAutonomous on;

Replace the eth0 with network interface prefix you want to configure. It has same value of if_prefix in step 4 or check it with "ifconfig" command. Usually it is eth0 or wlan0.

Replace the prefix in the above line with the prefix allocated to you from step 7 like this:
prefix 2221:0222:1996:0000:0000:0000:0000:0000/56


Step 10: Now restart radvd with the following command.
sudo service radvd restart
Step 11: Explicitly provide IPv6 DNS in PC network configuration. Prefer Google IPv6 DNS servers.

To force IPv6, do not provide IPv4 DNS:
In IPv4 Settings select Automatic(DHCP) Address only and do not provide DNS server. IPv4 only websites will resolve   fine as IPv6 DNS is already provided in IPv6 Settings.

Now Raspberry PI will work as a IPv6 router in tunneled mode and it will work on Wi-Fi of your home router also. Android device may not work in only IPv6 only network. Check out your IPv6 Connectivity from here or Google for many other test sites. Now all devices will automatically get IPv6 addresses. One of the best thing with IPv6 is that no port forwarding is needed. Check that PC is getting IPv6 address automatically. Many web site will prefer IPv6 automatically like Google and Yahoo.

1 comment:

  1. Best Practices for Keeping Your. Home Network Secure. As a user with access to sensitive corporate or government information at work, you are at risk at home. 2.4ghz vs 5ghz wifi