Adding IPV6 on Rocky Linux

Find the active network interface name

First check ifconfig (or IP address) for the "active" network interface,

ip a

You'll then find output similar to the following,

[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 54:52:00:5c:86:50 brd ff:ff:ff:ff:ff:ff
    inet 5.183.95.89/24 brd 5.183.95.255 scope global dynamic noprefixroute ens3
       valid_lft 21599735sec preferred_lft 21599735sec
    inet6 fe80::5652:ff:fe5c:8650/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

In the above output, ens3 is the active network interface, so we use this when building our configuration

Edit the network interface file config file, for example, our NETWORK_INTERFACE is ens3

nano /etc/sysconfig/network-scripts/ifcfg-ens3

File Should contains. [update with your network details]

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=ens3
UUID=d6ac791e-6d35-4c05-939c-ac705ea4f79c
DEVICE=ens3
ONBOOT=yes

restart the system.

service network restart 

If your network interface isn't ens3, you can find it by checking,

ifconfig

To Configuring Multiple IPv6 addresses from the same Range

Editing that config file, replacing NETWORK_INTERFACE with the correct network interface,

nano /etc/sysconfig/network-scripts/ifcfg-NETWORK_INTERFACE

And then add the following to the end of the file,

IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
IPV6ADDR="IPv6_RANGE/NETMASK"
IPV6ADDR_SECONDARIES="IPv6_ADDRESS/NETMASK"

Information for the IPv6_RANGE/NETMASK can be found from CrownPanel.

And for the IPv6_ADDRESS/NETMASK replace it with generated IPv6 with its netmask.

Note: IPv6 addresses are separated with white space.

Save the file and then,

systemctl restart network

Configuring the IPv6 Gateway

Next, add the Gateway (can be found from CrownPanel) into /etc/sysconfig/network

nano /etc/sysconfig/network

and then add the following into it,

IPV6INIT=yes
IPV6_DEFAULTGW="GATEWAY"

Replace "GATEWAY" with the actual IPv6 Network Gateway, Information for the GATEWAY can be found from CrownPanel.

Also, If you see the following line in the same file (/etc/sysconfig/network)

NETWORKING_IPV6=no

Change it to,

NETWORKING_IPV6=yes

Save the file and then,

systemctl restart network

To restart the network with the latest configuration changes

Configuring DNS For IPv6

Last but not least, update the DNS Servers for IPv6 as well in your /etc/resolv.conf

nano /etc/resolv.conf

and then add the following into it,

nameserver 8.8.8.8
nameserver 2001:4860:4860::8888

This will add 1 IPv4 DNS Nameserver and 1 IPv6 DNS Nameserver into your service which should ensure both IPv6 domain resolution and IPv4 domain resolution working perfectly.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS