Configuring IPv6 on CentOS

Introduction

Digital Media Geek supports IPv6 for all VPS and Dedicated Servers. To enable IPv6, use either of these methods:

CentOS 8

Dynamic configuration

Populate /etc/sysconfig/network-scripts/ifcfg-ens3 with:

TYPE="Ethernet" 
DEVICE="ens3" 
ONBOOT="yes" 
BOOTPROTO="dhcp" 
IPV6INIT="yes" 
IPV6_AUTOCONF="yes" 
IPV6ADDR_SECONDARIES="2001:db8:1000::100 2001:db8:1000::200" 
  • The primary IPv6 is dynamic.
  • 2001:db8:1000::200 is the optional static secondary IPv6. Remove the IPV6ADDR_SECONDARIES line if a secondary address isn’t required, or replace the example with an address in your IPv6 subnet.

Restart the connection, or reboot.

nmcli con load /etc/sysconfig/network-scripts/ifcfg-ens3
nmcli con up 'System ens3'

CentOS 6 through 7

Add the following lines to /etc/sysconfig/network-scripts/ifcfg-eth0.

IPV6INIT="yes" 
IPV6ADDR="2001:db8:1000::100/64" 
IPV6_AUTOCONF="yes" 
IPV6ADDR_SECONDARIES="2001:db8:1000::200/64" 
  • 2001:db8:1000::100 is the primary IPv6, replace the example with an address in your IPv6 subnet.
  • 2001:db8:1000::200 is the optional secondary IPv6. Remove the IPV6ADDR_SECONDARIES line if a secondary address isn’t required, or replace the example with an address in your IPv6 subnet.

Restart networking or reboot.

service network restart

IP forwarding

If you have IP forwarding enabled, such as when using your server as a VPN, add the following lines to /etc/sysctl.conf:

net.ipv6.conf.all.accept_ra=2
net.ipv6.conf.eth0.accept_ra=2

These variables default value is 1, which prevents IPv6 from working. To verify the status of IP forwarding, run:

# sysctl net.ipv4.ip_forward

Leave a Reply