The short answer: On a system that you are running radvd
on, you want to configure the interface using the same method as you use to configure radvd
; if radvd.conf
is statically generated, then so should your local Ethernet interface's IPv6 address be statically generated. But, all is not lost; read on for more detail.
What you can do is use a small shell script to configure both. Let's say for a moment that you have a dynamically assigned global IPv4 address, and this is the only IPv4 address on your interface; you can use the following shell script snippet to obtain the IPv6 /48 prefix (note: code adapted from ARIN:
IPV4=$(ip addr ls eth0 | grep 'inet ' | awk '{ print $2 }' | cut -f1 -d/)
PARTS=`echo $IPV4 | tr . ' '`
PREFIX48=`printf "2002:%02x%02x:%02x%02x" $PARTS`
Now, you have the /48 prefix; getting a /64 prefix is simple enough, since you can just append it to the $PREFIX48
variable.
Now, all that would be left for you to do is write the script that writes out the network interface configuration and radvd configuration (presumably, from a template for each of them) and make that script run before your network configuration does. I'll not be including that code here as I do not know what distribution you are using, and it differs depending on that.
Hope this helps.