Saturday, January 4, 2020

How to assign IPv6 on your CentOS server

Many of our new customers were very curious about how to assign IPv6 on their CentOS server.
This article is provided as a courtesy to our customers, to help them to assign IPv6 on their CentOS server.
By following this brief article to the end, you will be able to assign IPv6 addresses on your server. Please follow these simple steps to assign IPv6 addresses on your server:

Step 1: Edit sysctl.conf file
Access your server via SSH, then open the sysctl.conf file using the following command:

vi /etc/sysctl.conf
Then, add the following lines at the end of the file:



net.ipv6.conf.default.disable_ipv6 = 0

net.ipv6.conf.all.disable_ipv6 = 0

And then save and exit the file.



Step 2: Edit network file
Open the network.conf file using the following command:

vi /etc/sysconfig/network

Then, add the following line at the end of the file:

NETWORKING_IPV6=yes

Then save and exit the file.

Step 3: Edit ifcfg-eth0 file
Open the ifcfg-eth0 file using the following command:

vi /etc/sysconfig/network-scripts/ifcfg-eno1 

[Here eno1 is the main network interface name of the server]

Append the following lines to the file:

IPV6INIT=yes

IPV6ADDR=IPv6-IP-Address

IPV6_DEFAULTGW=IPv6-IP-Gateway-Address

example:

IPV6ADDR=2405:ff02:100:e2::2 [1st usable IP of the block ::2]
IPV6_DEFAULTGW=2405:ff02:100:e2::1  [default gateway ::1]

Then save and exit the file. Make sure that you replace IPv6-IP-Address and IPv6-IP-Gateway-Address with the IPv6 details provided to you.

Step 4: Edit resolv.conf file and add Google's Public DNS IPv6 addresses
Open the resolv.conf file using the following command:

vi /etc/resolv.conf


Then, replace the nameserver lines with, or add, the following lines for IPv6: 

nameserver 2001:4860:4860::8888

nameserver 2001:4860:4860::8844

Then save and exit the file.

Step 5: Restart network service

The last step in enabling the IPv6 address on your server is to restart the network service in order for the changes to come into effect. Use the following command to restart the network service:

systemctl restart network

Step 6: Be sure that you have configured the server with IPv6
Use the following command to ping google.com using ipv6:

ping6 google.com

If you get a reply like the following, then you have successfully configured your server with IPv6





No comments:

Post a Comment