Difference between revisions of "Setting up IPv6"

From PrgmrWiki
(Introduction)
Line 10: Line 10:
 
<pre>
 
<pre>
 
SVTIX
 
SVTIX
Default Gateway: 2001:470:21:20::1
+
Default Gateway: 2001:470:21:20::1 (or 2001:470:21:31::1)
Prefix: 2001:470:21:20::
+
Prefix: 2001:470:21:20:: (or 2001:470:21:31::)
  
 
Fremont
 
Fremont

Revision as of 06:48, 31 January 2011

Careful: IPv6 setup is currently being tested and thus subject to sudden changes in the setup. Please check the IRC channel or this wiki page for updates. So far it has been reliable, but the router is just a server right now and will eventually be replaced.

Introduction

IPv6 will at the moment only work for hosts at the svtix colocation and Fremont. By default you will only get one IPv6 address, which has to be manually configured. If you are located at the svtix datacenter, you can receive a /64 subnet upon request to support@prgmr.com.

SVTIX
Default Gateway: 2001:470:21:20::1 (or 2001:470:21:31::1)
Prefix: 2001:470:21:20:: (or 2001:470:21:31::)

Fremont
Default Gateway: 2001:470:1:41::1
Prefix: 2001:470:1:41::

Calculating your IPv6 address

The global prefix for one of the subnets is 2001:470:21:20::/64 and the other is 2001:470:21:31::/64. Your IPv6 address is the prefix + your IPv4 address.

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:20::/64
  Valid time              :            0 (0x00000000) seconds
  Pref. time              :            0 (0x00000000) seconds
 Source link-layer address: 00:30:48:9E:54:16
 from fe80::230:48ff:fe9e:5416

Use the prefix shown above as your IPv6 prefix (without the /64).

Web Interface

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

With irb (interactive ruby)

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

With sipcalc

$ sipcalc 68.68.99.14
-[ipv4 : 68.68.99.14] - 0

[CIDR]
Host address            - 68.68.99.14
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 inet6 static
    address 2001:470:21:20::4444:630e
    netmask 64
    gateway 2001:470:21:20::1

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

DEVICE=eth0
IPADDR=64.71.167.165
NETMASK=255.255.255.128
GATEWAY=64.71.167.129
IPV6INIT=yes
IPV6ADDR=2001:470:21:20::4047:a7a5
IPV6_DEFAULTGW=2001:470:21:20::1/64

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        2001:470:21:20::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.

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 ipv6.google.com
PING ipv6.google.com(pv-in-x93.1e100.net) 56 data bytes
64 bytes from pv-in-x93.1e100.net: icmp_seq=1 ttl=54 time=24.0 ms
64 bytes from pv-in-x93.1e100.net: 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 http://www.berkom.blazing.de/ or browse your website with ipv6 using http://www.sixxs.net/tools/gateway/

IPv6 on NetBSD

Add a line to /etc/ifconfig.xennet0:

 inet6 2001:470:1:41::XXXX:XXXX prefixlen 64 alias

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

 inet6 -net 2000::/3 2001:470:1:41::1