IPv6 Gateway outside of Subnet

The way the IPv6 gateway is typically configured for VPS servers can cause issues for Almalinux and Rockylinux.

Usually, each VPS is allocated a /64 range out of a /48 – some 65,000 of them if fully utilised.  The first IP of the /48 is then the gateway IP, assigned to the router.

This can cause some Redhat-derived distros to fail to connect via IPv6 showing errors like:

ERROR     : [ipv6_add_route] 'No route to host' adding route '::/0' via gateway '2b01:1000:0:0::1' through device ''

This is because the network drivers don’t know how to get to that first hop, in order to get to the internet at large, so we need to tell them.

Say your interface is called ‘eth0’ – you’ll have a file in the /etc/sysconfig/network-scripts/ folder called ‘ifcfg-eth0’.  Alongside this we need a new file, so create it using touch (change the device name to match yours):

[user@server ~] sudo touch /etc/sysconfig/network-scripts/route6-eth0

Now, we just need to add 2 lines to that file:

[user@server ~] sudo nano /etc/sysconfig/network-scripts/route6-eth0

Update the file so that it reads:

IPV6_GATEWAY dev eth0
default via IPV6_GATEWAY

Again, replacing the device name and IPv6 gateway address with your own.

You can now restart the network either by a reboot or ‘sudo service network restart’ and your IPv6 will hopefully spring into life.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu