The other day I was configuring IPv6 on a CentOS box and got the following error:
1 |
ERROR: [ipv6_set_default_route] Given IPv6 default gateway ‘fe80::254′ is link-local, but no scope or gateway device is specified |
I had set the following in my /etc/sysconfig/network-scripts/ifcfg-eth0
file:
1 2 3 4 5 |
NETWORKING_IPV6=yes IPV6INIT=yes IPV6ADDR=2dcc:7c4e:3651:55::1 IPV6_AUTOCONF=no IPV6_DEFAULTGW=fe80::254 |
The error message was telling me what’s wrong, but who bothers reading error messages!
The problem was this: I have specified the default gateway as fe80::254
but that’s a link-local address. How does the system know which link to use this with? I’d either have to specify a scope with the gateway address, or clarify which network interface to use. That’s what the error message is trying to say.
So the solution is one of the below.
Either specify the scope id:
1 |
IPV6_DEFAULTGW=fe80::254%eth0 |
Or specify the device to use:
1 2 |
IPV6_DEFAULTGW=fe80::254 IPV6_DEFAULTDEV=eth0 |
Another thing, if your network router is sending Router Advertisements you can skip specifying the gateway altogether and ask the interface to auto configure.
1 |
IPV6_AUTOCONF=no |
This is how you’d configure your network on a VPS. The VPS provider will have allocated to /64 block to you. Unlike IPv4 where the provider will take an IPv4 from the same network as you to use as the router for your network, with IPv6 they don’t need to do that as link-local addresses can be used. So they’ll either provide you with a link-local address, or you can turn on auto configure and pick it up yourself (provided it’s being advertised).
Lastly, I needn’t have put this configuration in the interface specific files. I could have put it in /etc/sysconfig/network
too.