1. Knowledge base
  2. Networking
  3. How to Configure Static IPv6 address on…

How to Configure Static IPv6 address on CentOS 8

Updated on 8 April 2024 2 min read Snel.com support team

Introduction

There are multiple ways to configure your network interface. In our article, we will describe how you can change your network configuration from DHCP (dynamic) IP address to Static IPv6 address in CentOS 8.

Prerequisites

  • Cloud VPS or Dedicated Server with CentOS 8 installed.
  • You must be logged in via SSH as sudo or root user. This tutorial assumes that you are logged in as a sudo user.

Log in using SSH

You must be logged in via SSH as sudo or root user. Please read this article for instructions if you don’t know how to connect.

Find the active network interface

Code
clear && echo $(ip -o -4 route get 8.8.8.8 | sed -nr 's/.*dev ([^\ ]+).*/\1/p')

Configure the network interface

In our example, our network interface is ens18 with the following network details:

Code
IPv6 = 2a00:7b80:452:3000::231Netmask = /48Gateway = 2a00:7b80:452::1

Our article will use network interface ens18 and the server details described above. Your server details will not be the same as our article and your network interface name can be different than ours. Use the network interface name from step 2.

Edit your network configuration file.

Code
nano /etc/sysconfig/network-scripts/ifcfg-ens18

It should be similar to this configuration.

Code
DEVICE="ens18"ONBOOT="yes"BOOTPROTO="none"TYPE="Ethernet"IPADDR="185.62.56.231"NETMASK="255.255.255.0"GATEWAY="185.62.56.1"DNS1="89.207.128.252"DNS2="89.207.130.252"NM_CONTROLLED="NO"

Add the below lines to your current configuration file.

Code
IPV6INIT="yes"IPV6_AUTOCONF="no"IPV6_DEFROUTE="yes"IPV6_FAILURE_FATAL="no"IPV6ADDR="2a00:7b80:452:3000::231/48"IPV6_DEFAULTGW="2a00:7b80:452::1"

Apply the changes.

Code
sudo systemctl restart network.service

Conclusion

Congratulations, you have now configured a static IPv6 address for your CentOS 8 Operating System. If you need to configure a static IPv4 address for your CentOS 8 please view this article.

Was this article helpful?

Spot a mistake in this article? Email us at support@snel.com

This article was last checked on 8 April 2024. · 10,880 views

Your own VPS online within 2 minutes

Windows or Linux, root access and hosted in Rotterdam.

View VPS from € 6.99

Support

Can't figure it out? We are happy to help

You always talk to a real engineer. We typically respond within 15 to 30 minutes, and 24/7/365 for outages.

Call us

+31 88 3 088 099

Create a ticket

Through the client area we immediately see which service it is about.

Email us

Send your question via the contact form, also outside office hours.