Friday, September 26, 2014

How to Add IPv6 to CentOS VPS


How to Add IPv6 to CentOS VPS














How would I add an IPv6 address to my  CentOS based VPS?
First you would want to make sure you have the /etc/sysconfig/network-scripts/network-functions-ipv6 script.

sh-3.00# ls -l /etc/sysconfig/network-scripts/network-functions-ipv6
-rw-r--r--  1 root root 42087 Jun 25  2008 network-functions-ipv6
sh-3.00#

Now that the IPv6 script is on the VPS, the next step is to check if the net-pf-10 module is loaded in your centos based VPS. We can do this by running the following commands:

sh-3.00# modprobe -c | grep net-pf-10
alias net-pf-10 ipv6
sh-3.00#

The above output shows the VPS does have it. If the VPS did not have it, you would get this output.

sh-3.00# modprobe -c | grep net-pf-10
alias net-pf-10 off
sh-3.00#

So if it is off on your VPS you would want to edit /etc/sysconfig/network and enable NETWORKING_IPV6.
Here is an example of what a /etc/sysconfig/network with IPv6 would look like.            

sh-3.00# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=ipv6test.softlayer.com
GATEWAY=10.12.12.1
NETWORKING_IPV6=yes
sh-3.00#

Now you will want to restart your networking service. You can do this via the /sbin/service network restart command.

sh-3.00# /sbin/service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Setting network parameters:                                [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface eth1:                                [  OK  ]
sh-3.00#

Now you will want to edit your /etc/sysconfig/network-scripts/ifcfg-eth1 file to add the IPv6 parameters.
Add the following

IPV6INIT=yes
IPV6ADDR=YOURIPV6ADDRESS
IPV6_DEFAULTGW=YOURGATEWAY
Here is an example of what a IPv6 portion should look like.
#IPV6 configuration
IPV6INIT=yes
IPV6ADDR=2607:f0d0:2001:0000:0000:0000:0000:0010/64
IPV6_DEFAULTGW=2607:f0d0:2001:0000:0000:0000:0000:0001

After you add that you will want to restart your network services again
sh-3.00# /sbin/service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down interface eth1:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Setting network parameters:                                [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface eth1:                                [  OK  ]
sh-3.00#

Now you should be able to communicate over IPv6. You can ping ipv6.google.com and see if it works.

sh-3.00# ping6 ipv6.google.com –n
PING ipv6.google.com(2001:4860:b002::68) 56 data bytes
64 bytes from 2001:4860:b002::68: icmp_seq=0 ttl=59 time=86.6 ms
64 bytes from 2001:4860:b002::68: icmp_seq=1 ttl=59 time=86.9 ms
64 bytes from 2001:4860:b002::68: icmp_seq=2 ttl=59 time=84.8 ms
--- ipv6.google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 84.870/86.130/86.913/0.961 ms, pipe 2
sh-3.00#

--
Thanks : softlayer.com

No comments:

Post a Comment