Apache IPv6 Configuration: Dual Stacked IPv4 & IPv6 Virtual Hosts

To configure Apache to serve dual stacked IPv4 and IPv6 virtual hosts, you need to follow these steps:

  1. Make sure that your Apache installation supports IPv6. You can check this by running the following command:
    httpd -V | grep -i ipv6

    If IPv6 support is enabled, you will see a line containing --enable-ipv6.

  2. Edit the Apache configuration file for the virtual host you want to add IPv6 support to. This file is usually located in the /etc/httpd/conf.d directory, and has a name ending in .conf.
  3. Add the following lines to the configuration file, replacing the values in square brackets with the appropriate values for your virtual host:
    Listen [::]:80
    <VirtualHost [::]:80>
    # Configuration directives for your virtual host
    </VirtualHost>

    These lines will configure Apache to listen on IPv6 address [::]:80 for this virtual host, as well as on the default IPv4 address 0.0.0.0:80.

  4. Test the configuration by restarting Apache:
    sudo service httpd restart

    If the Apache configuration is correct, it should restart without any errors.

  5. Verify that the virtual host is now accessible over IPv6 by visiting the website using an IPv6 address in your web browser. You can also use the curl command to test the virtual host using IPv6:
    curl -6 http://[IPv6-address]/

    This will connect to the virtual host using IPv6.

Repeat these steps for any additional virtual hosts you want to add IPv6 support to. With these steps, you have successfully configured Apache to serve dual stacked IPv4 and IPv6 virtual hosts.

Leave a Comment