Covers how to assign a static IPv6 address to a network interface on a Raspberry Pi by editing the DHCP configuration file and verifying connectivity with a ping test.
IPv6 Static Address on Raspberry Pi
We're going to jump on our Raspberry Pi and assign an IPv6 static address to our network interface.
What I have here is I've already brought up a terminal window, and then within the terminal window I am going to bring up that same configuration file that we used to configure an IPv4 address. This does need elevated permission, so I did my sudo command in here, and then I'm using nano to configure this file. I navigate to the /etc/dhcpcd.conf file, so I'll hit enter here.
I'm going to scroll down where we have those static assignments to the different interfaces. I have both the wireless LAN I've got set up here, and the ethernet 0. Ethernet 0 is the one that we're going to want to configure. I already have a static address statement right here, I'm just going to uncomment it. Remember, those comments mean that it's not going to look at that line if it's got that pound sign at the beginning of it, that hashtag at the beginning of it. So I delete that and now it's uncommented, and so now it has activated this line. It says static ip6_address= and then it gives the address that it just has set up by default on here.
I want to create my own, and so I'm going to have to do it somewhere within the fc to fd range here, colon. And then what they do is they recommend that these last network bits are random. The reason why they recommend it's random is because if you ever merge with another company, or set up some sort of other connections with other devices, if you go sequentially there could be a chance that the other network that you're merging with has gone sequentially as well, and you'll have overlap in your networks. So creating something random is actually a really good thing.
For the simplicity of what we're doing here, I actually want to make this real simple, so that way we understand — or, well, one, it's just easier to type in, but two, we're going to actually get into different networks in the future. And so I'm just going to assign this to the fc-001 network. So that's the network, and then colon colon, and then the address that I'm going to assign to this. I'm going to line it up with the address that I assigned to eth0, so I'm going to do three, so this is just the third host on this network, just like I did with the IP version 4 address here.
In reality, once again, you probably want to mix it up and do something a little more random. In fact, in reality a lot of times we don't even assign a static address to these machines, but in this case right here I've assigned the static address.
Then I'm going to exit this, so I'll do a control X. Do I want to save? Yes, I do. And then, where do I want to save it to? I want to save it to that same file. I hit enter, and now it is. So the next time that this service gets rebooted, or I reboot the machine, then this static address will take effect.
Once we've saved our file, then we're going to need to make the changes take effect to the machine. Just like we did with IPv4, we're going to have to restart the interface, we're going to have to restart the service, or we just reboot the machine. I find a lot of times it's just easier to go and hit log out on these and then hit reboot, and let it reboot.
Once the machine is rebooted, we can get in here and open up a terminal and type in ifconfig to see if the changes have taken effect. I open this up, we're looking at ether0, and we see the IPv4 address, we see the link local address here, and then we also see the IPv6 address that I've assigned to this interface.
So now that we know that we have an IPv6 address set up on our Pi, let's see if we can ping it. I've jumped over to my demo laptop now and I'm going to pull up a command prompt to do this. So bring up a command prompt, and then I'm going to ping the address we just set up: ping fc00:1::. Then I'll hit enter, and sure enough we have a ping, so therefore we verified that this is actually set up.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →