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.

Requirements:
  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
server=montreal.freenet6.net or amsterdam.freenet6.net
auth_method=any
host_type=router
if_prefix=eth0   
#run command "ifconfig" to check its correct value, usually its eth0 or eth1 for ethernet and wlan0 or wlan1 for wireless lan.
dns_server=2001:4860:4860::8888
tunnel_mode=v6anyv4
log_console=0
log_stderr=1
log_file=1
log_syslog=0
log_filename=/var/log/gogoc/gogoc.log
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.
ifconfig
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:
net.ipv6.conf.default.forwarding=1

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.

8 comments:

  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

    ReplyDelete
  2. I think this is an informative post and it is very beneficial and knowledgeable. Therefore, I would like to thank you for the endeavors that you have made in writing this article. All the content is absolutely well-researched. Thanks... https://192-168-i-i.com/cisco-router-default-password/

    ReplyDelete
  3. I really loved reading your blog. It was very well authored and easy to understand. Unlike other blogs I have read which are really not that good.Thanks alot! sửa chữa nhà tại hà nội

    ReplyDelete
  4. Nice knowledge gaining article. This post is really the best on this valuable topic. House Cleaning

    ReplyDelete
  5. Interesting and amazing how your post is! It Is Useful and helpful for me That I like it very much, and I am looking forward to Hearing from your next.. toilet seat brands

    ReplyDelete
  6. Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people.. cladding experts

    ReplyDelete
  7. This is my first time visit to your blog and I am very interested in the articles that you serve. Provide enough knowledge for me. Thank you for sharing useful and don't forget, keep sharing useful info: utica locksmith

    ReplyDelete
  8. We have sell some products of different custom boxes.it is very useful and very low price please visits this site thanks and please share this post with your friends. florida eviction notice

    ReplyDelete