CentosControl PanelCWPLinux

How to Enable IPv6 on CWP Centos WebPanel

On this tutorial I’ll show you how to enable IPv6 for your websites On CWP centos webpanel. A new Internet addressing system Internet Protocol version 6 (IPv6) is being deployed to fulfill the need for more Internet addresses.

IPv6 (Internet Protocol Version 6) is also called IPng (Internet Protocol next generation) and it is the newest version of the Internet Protocol (IP) reviewed in the IETF standards committees to replace the current version of IPv4 (Internet Protocol Version 4).

IPv6 is the successor to Internet Protocol Version 4 (IPv4). It was designed as an evolutionary upgrade to the Internet Protocol and will, in fact, coexist with the older IPv4 for some time. IPv6 is designed to allow the Internet to grow steadily, both in terms of the number of hosts connected and the total amount of data traffic transmitted.

IPv6 is often referred to as the “next generation” Internet standard and has been under development now since the mid-1990s. IPv6 was born out of concern that the demand for IP addresses would exceed the available supply.

The Benefits of IPv6

While increasing the pool of addresses is one of the most often-talked about benefit of IPv6, there are other important technological changes in IPv6 that will improve the IP protocol:

  • No more NAT (Network Address Translation)
  • Auto-configuration
  • No more private address collisions
  • Better multicast routing
  • Simpler header format
  • Simplified, more efficient routing
  • True quality of service (QoS), also called “flow labeling”
  • Built-in authentication and privacy support
  • Flexible options and extensions
  • Easier administration (say good-bye to DHCP)
  • SEO benefits

Here is the tutorial For enabling ipv6 On CWP for your websites :

To enable ipv6 you need to install nginx as reverse proxy (nginx + apache or nginx + varnish + apache), you can enable nginx from webserver option. To enable ipv6 I came with easiest way to enable it with simple one line configuration :

For testing purpose I’m using “tut.mysterydata.com”

Now our First step is to add “AAAA” DNS record which is for IPv6

you can retrieve ipv6 IP from command line via ssh :

Type this command :

ip a

out put will look like this :

********************************************
 Welcome to CWP (CentOS WebPanel) server
********************************************

CWP Wiki: http://wiki.centos-webpanel.com
CWP Forum: http://forum.centos-webpanel.com
CWP Support: http://centos-webpanel.com/support-services

[root@srv1 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/void
    inet 127.0.0.1/32 scope host venet0
    inet 109.235.69.179/32 brd 109.235.69.179 scope global venet0:0
    inet6 2a02:7b40:6deb:45b3::1/128 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::216:3cff:fede:7641/128 scope link
       valid_lft forever preferred_lft forever

you can see the IPV6 IP which is highlighted/red, you need to copy and add it to your dns “AAAA”

Here is the example image how to add ipv6 you’ll also get rough idea on adding ipv6 on your main domain :

Now we’ll move to CWP and add ipv6 ip on the website, I assume you already installed nginx as reverse proxy

Here my ipv6 addrress is 2a02:7b40:6deb:45b3::1 and I’ll use it in below example you need to replace the ip with your one

Template Location :

Navigate to :

cd /usr/local/cwpsrv/htdocs/resources/conf/web_servers/

Step 1 :

For Apache :

Copy the existing template and create the ipv6 template :

**you can do it for other apache default templates as per your preference :

cd /usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/httpd/
cp all_methods.stpl ipv6.stpl
cp all_methods.tpl ipv6.tpl

**for apache + php-fpm :

cd /usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/httpd/php-fpm
cp all_methods.stpl ipv6.stpl
cp all_methods.tpl ipv6.tpl

EDIT the templates ipv6.tpl and ipv6.stpl and add/modify the first line and add the ipv6 address as below and save the templateĀ  :

from :

<VirtualHost %ip%:%apache_port%>

to:

<VirtualHost %ip%:%apache_port% [2a02:7b40:6deb:45b3::1]:%apache_port%>

For Nginx

Copy the existing template and create the ipv6 template :

**you can do it for other nginx default templates as per your preference

/usr/local/cwpsrv/htdocs/resources/conf/web_servers/vhosts/nginx/
cp default.stpl ipv6.stpl
cp default.tpl ipv6.tpl

EDIT the templates ipv6.tpl and ipv6.stpl and add/modify the line and add the ipv6 address as below and save the templateĀ  :

listen [2a02:7b40:6deb:45b3::1]:80;

Final example configuration will look like this for tpl :

server {
listen YOURSERVERIP:NGINXPORT;
listen [2a02:7b40:6deb:45b3::1]:80;
server_name %domain_idn% %alias_idn%;
access_log /usr/local/apache/domlogs/%domain%.bytes bytes;
access_log /usr/local/apache/domlogs/%domain%.log combined;
error_log /usr/local/apache/domlogs/%domain%.error.log error;

editĀ CWP Configuration Templates for nginx_proxy_vhost_ssl and add below line to the template and save it see the eg below where to add it exactly :

listen [2a02:7b40:6deb:45b3::1]:443;

Final example configuration will look like this stpl :

server {
listen YOURSERVERIP:NGINXPORT;
listen [2a02:7b40:6deb:45b3::1]:443;
server_name %domain_idn% %alias_idn%;
access_log /usr/local/apache/domlogs/%domain%.bytes bytes;
access_log /usr/local/apache/domlogs/%domain%.log combined;
error_log /usr/local/apache/domlogs/%domain%.error.log error;

Step 2 :

Then we need to add some config to /etc/sysctl.conf

nano /etc/sysctl.conf

Then add this line :

net.ipv6.ip_nonlocal_bind = 1

After adding the line save it and run this command :

sysctl -p /etc/sysctl.conf

Step 3 :

After that you can choose this template in webserver main config and webserver domain config and don’t forget to check mark on rebuild vhost option and save it.

That is all done, You’ve successfully enable ipv6 on CWP

Sandeep B.

I'm a system admin and php developer and currently working as System Admin In CWP Control panel, expertise in Linux and Windows administration RHEL certified admin.

Related Articles

6 Comments

  1. I just tried this and it doesn’t work.

    I’m trying a 112 range, I don’t know if I’ll need a different configuration, I want each domain to have its own IPv6 range. Can you help me do that?

    Greetings!

Leave a Reply

Your email address will not be published.

Back to top button