Setting up IPv6

From PrgmrWiki
Revision as of 19:06, 3 February 2016 by Paul (talk | contribs) (Introduction)

Unfamiliar with IPv6? Try Hurricane Electric's free IPv6 certification.


By default you will only get one IPv6 address. You can receive a /64 subnet upon request to IPv6 subnet prefixes and default gateways are given below.

Prefix: 2605:2700:0:2::/64 (or 2605:2700:0:3::/64)
Default Gateway: 2605:2700:0:2::1 (or 2605:2700:0:3::1)

Prefix 2605:2700:0:5::/64
Default Gateway: 2605:2700:0:5::1

Prefix: 2605:2700:0:17::/64
Default Gateway: 2605:2700:0:17::1

Calculating your IPv6 address

The global prefix for one of the subnets is 2605:2700:0:2::/64, and the other is 2605:2700:0:3::/64. (If you were using the old prefixes of 2001:470:21:20::/64 and 2001:470:21:31::/64, be aware that they are deprecated.) Your IPv6 address is the prefix + your IPv4 address.

IPv6 addresses consist of 8 groups of 16-bit hexadecimal numbers. Consecutive groups of 0's are represented with a double colon ::

Example: 2605:2700:0:3::adc5:47aa is equivalent to 2605:2700:0:3:0000:0000:adc5:47aa.

Finding your prefix

On debian, install rdisc6 from the ndisc6 package.

$ rdisc6 eth0
Soliciting ff02::2 (ff02::2) on eth0...

Hop limit                 :           64 (      0x40)
Stateful address conf.    :           No
Stateful other conf.      :           No
Router preference         :       medium
Router lifetime           :            0 (0x00000000) seconds
Reachable time            :  unspecified (0x00000000)
Retransmit time           :  unspecified (0x00000000)
 Prefix                   : 2001:470:21:31::/64
  Valid time              :            0 (0x00000000) seconds
  Pref. time              :            0 (0x00000000) seconds
 Prefix                   : 2605:2700:0:3::/64
  Valid time              :            0 (0x00000000) seconds
  Pref. time              :            0 (0x00000000) seconds
 Source link-layer address: 00:30:48:BC:A1:9A
 from fe80::230:48ff:febc:a19a

Use the prefix shown above (the one beginning with 2605:2700) as your IPv6 prefix (without the /64). Ignore the prefix beginning with 2001:470; as noted above, that prefix is deprecated.

Web Interface

You can use the web interface at, but please make sure that you replace the default prefix with the prefix.

With irb (interactive ruby)

irb(main):001:0> ip4 = ""
=> ""
irb(main):002:0> prefix = "2605:2700:0:3::"
=> "2605:2700:0:3::"
irb(main):003:0> ip6 = prefix + ip4.split(".").map { |x| x.to_i }.pack("CCCC").unpack("H4H4").join(":")
=> "2605:2700:0:3::4444:630e"

With sipcalc

$ sipcalc
-[ipv4 :] - 0

Host address            -
Host address (decimal)  - 1145332494
Host address (hex)      - 4444630E

Updating your /etc/network/interfaces for Debian/Ubuntu

Add the following lines to your /etc/network/interfaces (don't forget to substitute the address for your own):

iface eth0 inet static
iface eth0 inet6 static
    address 2605:2700:0:3::4444:630e
    netmask 64
    gateway 2605:2700:0:3::1

Updating /etc/sysconfig/network-scripts/ifcfg-eth0 for Fedora and CentOS


Setting the default route with IPV6_DEFAULTGW is broken in CentOS/RHEL 5.2 and earlier, so in that case a route for 2000::/3 to the same router should work almost as well. A static ipv6 route can be set in /etc/sysconfig/static-routes-ipv6 like

eth0   2000::/3        2605:2700:0:3::1

For more information on ipv6 and other settings in /etc/sysconfig, see /usr/share/doc/initscripts-8.45.30/ or whatever version initscripts is on your system. (And be sure to use the correct gateway for your network. The gateway for the 2605:2700:0:3:: prefix is different from the gateway for the 2605:2700:0:2:: prefix.)

On CentOS you may need to add "NETWORKING_IPV6=yes" to /etc/sysconfig/network if the IPv6 address is not assigned on ifup.

Making sure the IPv6 module is loaded

When rebooting my IPv6 connection was not initialized automatically. Adding the line "ipv6" to /etc/modules makes sure that the IPv6 kernel module gets loaded.

Bringing the interface up

You can either just reboot your server, or bring down the interface from the virtual console and then bring it up again. If you are connected directly via SSH and bring down the interface, you won't be able to send any more commands after bringing down the interface, so make sure you bring the interface up in the same command:

ifdown eth0 && ifup eth0

Testing your connection

david@kauri:~$ ping6
PING 56 data bytes
64 bytes from icmp_seq=1 ttl=54 time=24.0 ms
64 bytes from icmp_seq=2 ttl=54 time=24.0 ms

Congratulations, your native IPv6 connection is now up and running.

You may also want to test your connection from the outside, you can use the tools at or browse your website with ipv6 using

IPv6 on NetBSD

Add a line to /etc/ifconfig.xennet0:

 inet6 2605:2700:0:3::XXXX:XXXX prefixlen 64 alias

Add a line to (or create) /etc/route.conf

 inet6 -net 2000::/3 2605:2700:0:3::1

Remember to use the correct gateway for your prefix. The gatway for the 2605:2700:0:3:: prefix is different from the gatway for the 2605:2700:0:2:: prefix.

Setting up your own /64

To get your own /64, email and ask for one. Once you receive it, you can configure it in Debian or Ubuntu by changing the IPv6 section in your /etc/network/interfaces file to look like this (be sure to change the IP addresses):

iface eth0 inet6 static
    address 2605:2700:0:3::4444:630e
    netmask 64
    gateway 2605:2700:0:3::1
    up ip -6 addr add 2605:2700:1:f00d::1/64 dev eth0
    up ip -6 addr add 2605:2700:1:f00d::beef/64 dev eth0

For Fedora or CentOS, add the following line to your /etc/sysconfig/network-scripts/ifcfg-eth0 file, changing the addresses as necessary:

   IPV6ADDR_SECONDARIES="2605:2700:1:f00d::1/64 2605:2700:1:f00d::beef/64"

You can also add addresses under your prefix to a dummy, VPN, or bridge interface. You MUST keep your old address that you calculated earlier in the article because your prefix is routed through that address.