IPv6 With Linux

Discussion in 'Linux Networking' started by LinuxDotOrg, Jul 9, 2013.

  1. LinuxDotOrg

    LinuxDotOrg Administrator

    Messages:
    34
    Likes Received:
    66
    Trophy Points:
    8
    IPv6 has begun to pick up a bit of steam. What was once just fancy talk of the new Internet has now started to take shape and really become a focal point of the Internet. There are VPS (virtual private server) companies out there now that offer IPv6 only. One of the greatest (and possibly worst) aspects about this is that those with IPv4 only are not able to access such servers.

    So, how do you know if you're running IPv6 (or have the ability to access IPv6 servers)? Well, one of the best places I've really found to do a quick test on this is http://ipv6-test.com/ This will tell you whether you have IPv6 or not.

    It should be noted that adapters have, for the longest time now, been able to assign themselves an IPv6 address on thehome network. For example, my eth0 shows this:
    Code:
    $ ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500        inet 192.168.1.44  netmask 255.255.255.0  broadcast 192.168.1.255        inet6 fe80::1e6f:65ff:fe80:33c7  prefixlen 64  scopeid 0x20<link>        ether 1c:6f:65:80:33:c7  txqueuelen 1000  (Ethernet)        RX packets 471259  bytes 615471609 (586.9 MiB)        RX errors 0  dropped 1  overruns 0  frame 0        TX packets 249691  bytes 30981224 (29.5 MiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 16436        inet 127.0.0.1  netmask 255.0.0.0        inet6 ::1  prefixlen 128  scopeid 0x10<host>        loop  txqueuelen 0  (Local Loopback)        RX packets 4646  bytes 1559747 (1.4 MiB)        RX errors 0  dropped 0  overruns 0  frame 0        TX packets 4646  bytes 1559747 (1.4 MiB)        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    The "inet6" part is the giveaway. So, it says I have IPv6 BUT when I go to http://ipv6.google.com I get a DNS connection error. Why? Because the network itself doesn't speak IPv6, only IPv4. This is the problem.

    Most networks these days do not offer true support, just placeholders for IPv6. This, however, can be circumvented in a rather easy (and free!) way. But first, some essential preparing.

    To get to the meat of this article, you should have iproute2 installed. While it's not mandatory, this guide assumes you have it installed after this point, otherwise you are pretty much on your own, sadly. This is the software package that is beginning to take over the previous iproute. This means, if the future goes how people are expecting it to, ip addr will be used to get adapter IPs instead of using ifconfig. Fairly simple, right? Well, run this command to see if you have ip or not:


    Code:
    whereis ip
    
    The output for me looks like this:
    Code:
    $ whereis ip ip: /sbin/ip /usr/sbin/ip /usr/share/man/man8/ip.8.gz /usr/share/man/man7/ip.7.gz 
    So I can successfully run ip addr without issues. This is great! If the whereis command returns nothing, however, then you need to install it via your package manager (or source if you're daring and can find it).

    Now, you have this set up, we still need to get IPv6 done. First, we need an IPv6 address. How are we going to do this? Simple: broker tunnels.

    The basic idea is that you sign up to a broker tunnel who will then let you use one of their IPv6 addresses. Now, I"m sure there's ones out there that you have to pay for, but what's the fun in spending your money? I personally use Hurricane Electric's http://tunnelbroker.net/

    I have a VPS right now through a data center that Hurricane Electric owns in Denver right now, and I've loved their network thus far. So, right away I knew I'd sign up for them....(and, well, free is amazing).

    First thing you need to do is click on the "Register" button on the left side, under the form. Here you fill out some basic information and submit it. Soon you should receive an e-mail with your username and a pre-generated password. Put your information in and log in.

    Now, on the left side, you'll see "Create Regular Tunnel", click that. From here, you will provide the information needed. If you're unsure what to use for "IPv4 Endpoint", use your public IPv4 address. Not sure how to find this out? Go to whatsmyip.org and it will tell you. Choose the tunnel server closest to you and click "Create Tunnel". This can take a little bit to finish, but you'll see a page after that which has some nice configuration options.

    There's nothing you need to change here, but make note of your new client IPv6 address and server IPv4 address. You'll need it pretty soon.

    I've already cut out a lot of the work here and wrote a script you can use to get this up and running in a jiff here:https://gist.github.com/4422119

    There's only 2 variables you need to edit (if_name can stay the way it is), and that is server_ipv4 and client_ipv6. While the script does need your own IPv4 address, it does so by checking the adapter you provide when running it (I wrote it using ifconfig because I'm familiar with it more, and I was lazy). To run it (assuming you save the script as ipv6.sh), just do this:

    Code:
    chmod +x ipv6.sh && ./ipv6.sh start eth0
    
    If you want to tunnel the data through a different adapter, replace eth0 with the adapter. To stop IPv6 just replace "start" with "stop". Once this works, go back to the IPv6 testing link at the beginning of this guide and it should give you your Hurricane Electric provided IPv6 address.
  2. Akronix

    Akronix New Member

    Messages:
    8
    Likes Received:
    4
    Trophy Points:
    3
    Hello.

    I'm trying to run this on my xubuntu computer, but I don't get it.

    First of all, obtaining my ip address with:
    Code:
    client_ipv4=$(ifconfig eth0 | grep netmask | awk '{print $2}')
    Fails. Because of ifconfig says 'Mask' not 'netmask' and, later, fix it, that command takes:
    Code:
    "addr:192.168.1.120"
    Which returns this error:
    Code:
    Error: an IP address is expected rather than "addr:192.168.1.120"
    So, after I've put the ip address manually in the script and comment the above command.

    After that, I try to run the script, it throws me these errors:

    Code:
    ./ipv6.sh: line 62: add_daemon: command not found
    ./ipv6.sh: line 63: stat_done: command not found
    :S

Share This Page