How to Configure IPv6 Address on AlmaLinux RockyLinux and CentOS using nmcli

An IPv6 Address is a numerical label assigned to each device participating in a computer network that uses the IPv6 protocol.

Identify the Network Interface

Determine the name of your network interface. You can use the ip a or ifconfig command to list available interfaces.

Common names for interface include ens3, eth0, enp3s0 and many more,

ip a

Output:

root@vps ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 1.2.3.4 brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    inet 192.168.0.24/24 brd 192.169.6.255 scope global noprefixroute ens3
       valid_lft forever preferred_lft forever
    inet6 2602:ff75::2/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
[root@vps ~]# 

from the above output, the network interface is ens3.

also, you can find the IP address information from CrownPanel, Refer to our wiki on How to View Network Information in CrownPanel.

Modify the Connection

Configure the IPv6 address using the following command,

nmcli connection modify ens3 ipv6.addresses '2602:ff75::2/64' ipv6.method manual

Set the default gateway. Replace 2602:ff75:7::1 with the IPv6 address of your gateway,

nmcli connection modify ens3 ipv6.gateway '2602:ff75:7::1'

Note: Replace "interface" ens3 with the actual interface name that is on your server.
Replace "address" 2602:ff75::2/64 with the actual IPv6 address that is assigned to your server.
Replace "gateway" 2602:ff75:7::1 with the actual Gateway address assigned to the server.

Restart Network Service

Once the modification for the network interface has been updated with the additional IP information, we will go on to restart the NetworkManager for the changes to take effect.

systemctl restart NetworkManager

This concludes our topic of configuring IPv6 Address on the AlmaLinux, Rocky Linux, and CentOS Stream 9 using NetworkManager.