# How To Configure IPv6 on CentOS 7 ### Introduction In this guide, you will configure IPv6 support on your TeraSwitch VPS. This will allow it to communicate across the internet using the latest standards. ## Prerequisites Before you begin this guide you'll need the following: - One Linux VPS running CentOS 7 ## Step 1 — Locating the Address To start, you need to locate the IPv6 address that was automatically assigned to your server. Login to your TeraSwitch portal at [https://my.teraswitch.com/clientarea.php](https://my.teraswitch.com/clientarea.php). From the top menu bar, navigate to **Services** > **My Services**, and then choose the VPS you would like to configure. Next, scroll down to **Interfaces** and look for **Fixed IP Address**. You will see at least two addresses. The longer one is your **IPv6 address** for this specific server. For example, the IPv6 address for your server might look similar to this: `2607:fdc0:2:0:f816:3eff:fea6:2734` ## Step 2 — Calculating the Gateway CentOS will also need to know the location of the **default gateway** in order to sucessfully send traffic outside the network. At TeraSwitch, this will always be the address ending in `...0000:0000:0000:0001`. In IPv6, we can compress all of those zeroes, and rewrite the ending like this: `::1` So for example: | <!-- --> | <!-- --> | | ----------- | -------------- | | If your **IPv6 address** is: | `2607:fdc0:2:0:f816:3eff:fea6:2734` | | Your **default gateway** is: | `2607:fdc0:2:0::1` | ## Step 3 — Applying the Configuration In this step you will insert the address and gateway into CentOS's configuration. To do this, connect to your server, and then open the `/etc/sysconfig/network-scripts/ifcfg-eth0` file with root privileges: ```bash sudo nano /etc/sysconfig/network-scripts/ifcfg-eth0 ``` At the bottom of this file, add the following lines, replacing **your_ipv6_address** and **your_ip_gateway** with the values you located in the previous steps. ```ini IPV6INIT=yes IPV6ADDR=your_ip_address IPV6_DEFAULTGW=your_ip_gateway ``` ## Step 4 — Restarting the `network` service Finally, in CentOS we can restart the network by running the following command: ```bash sudo systemctl restart network ``` Your terminal session will briefly pause while your VPS's network goes down and comes back online. Verify that you can ping IPv6 addresses: ```bash ping6 2606:4700:4700::1111 ``` You'll see the following output: ```bash PING 2606:4700:4700::1111(2606:4700:4700::1111) 56 data bytes 64 bytes from 2606:4700:4700::1111: icmp_seq=1 ttl=60 time=0.535 ms 64 bytes from 2606:4700:4700::1111: icmp_seq=2 ttl=60 time=0.300 ms 64 bytes from 2606:4700:4700::1111: icmp_seq=3 ttl=60 time=0.314 ms ``` You can also list the default route for IPv6 traffic: ```bash /sbin/ip -6 route show ``` You'll see the following output: ``` 2607:fdc0:2::/64 proto kernel metric 256 pref medium fe80::/64 proto kernel metric 256 pref medium default via 2607:fdc0:2::1 metric 1 pref medium ``` ## Conclusion In this article you enabled IPv6 support for your VPS, future-proofing it for next generation applications. Next, consider double checking that any firewall rules you may have are also configured for IPv6.