Im using Pi-Hole with IPV4, recently I discovered my router Xiaomi AX1800 (OpenWRT) supports IPv6, as well as my ISP (A1).
I noticed that I can assign DHCP static IPv4 assignment from the router’s interface, but I can’t do the same for IPv6. That’s why I decided to set a static IPv6 address for the machine running Pi-Hole (Raspberry Pi 2).
There is a short guide on how to do that:
- Identify the network interface: Run the command ip -6 addr to find the interface name and its current IPv6 address. For example:
12
eno1: mtu 1500
inet6 fe80::1234:5678:9012:3456
/64
scope link
In this example, the interface name is eno1. Replace eno1 with your actual interface name.
- Edit the /etc/network/interfaces file: Use a text editor like nano or vim to edit the file:
1
sudo
nano
/etc/network/interfaces
- Locate the relevant section: Find the section for the identified interface (e.g., eno1). If it doesn’t exist, create a new one.
- Add the IPv6 configuration: Append the following lines to the interface section:
1234
iface <interface_name> inet6 static
address <IPv6_address>
netmask <netmask>
gateway <default_router>
Replace <interface_name> with your actual interface name, <IPv6_address> with the desired static IPv6 address, <netmask> with the subnet prefix length, and <default_router> with the default router’s IPv6 address.
For example:
1234iface eth0 inet6 static
address fe80::9c1b:cda1:706f:f08d
netmask 64
gateway fe80::9e9d:7eff:fe91:9b33
- Save and restart the networking service: Save the changes and restart the networking service using:
1
sudo
service networking restart
Alternatively, you can reboot the system:
1sudo
reboot
Verify the static IPv6 address assignment by running ip -6 addr again. The interface should now have the configured static IPv6 address.
Remember to replace the example values with your actual network settings. Additionally, ensure that the IPv6 address is not already in use on your network before assigning it statically. You can use tools like nmap (as mentioned in the article) or arp-scan to scan your network and identify available IPv6 addresses.
test