Merging IPv4 and IPv6 DNS lookups for a given client

So, as of this writing, my FTL version is 5.23

network table has an extra column at the end: alias client_id (referencing the aliasclient table's IDs). I'm gonna write down all the steps, for anyone else in future, who might stumble upon this issue, and wanna figure a way around it.

Load up the pihole-FTL database

sudo pihole-FTL sqlite3 /etc/pihole/pihole-FTL.db

Now, you can run .tables command, and it should return you the following,

For our solution, we are gonna focus on two tables, namely network and aliasclient. To see the content of network table, we are gonna use the following command,

.mode column
.headers ON
SELECT * FROM network;

This, for example, gave me client details on my Pi-Hole network, as follows,

A device, say an iphone, has been assigned 10.66.66.62 IPv4 and fd42:42:42::62 IPv6 address on a VPN network (in my case Wireguard). @DL6ER pointed out that since this iphone is connected to VPN network with only IPv4 and IPv6 assignment, it's been given a mock-MAC by FTL, which in case is ip-10.66.66.62 and ip-fd42:42:42::62.

So, what we gotta do is assign each of these devices i.e. iphone with mock-MACK address ip-10.66.66.62 and ip-fd42:42:42::62 a common identifier, which will reside in the column aliasclient_id.

Before we can even give a common value aliasclient_id for ip-10.66.66.62 and ip-fd42:42:42::62, we need to first declare it in the table aliasclient. So, in my case, I'll be choosing value 0 as aliasclient_id. This would be declared in aliasclient table as follows,

INSERT INTO aliasclient (id,name,comment) VALUES (0,'iphone',NULL);

Screenshot 2023-06-10 at 1.19.09 AM

Now that I've declared 0 as aliasclient_id for my device iphone, I'm gonna use it in the network table,

UPDATE network SET aliasclient_id = 0 WHERE hwaddr = 'ip-10.66.66.62';
UPDATE network SET aliasclient_id = 0 WHERE hwaddr = 'ip-fd42:42:42::62';

This is from the Pi-hole dashboard,

So, why does it still have two entries for device/client iphone?

Well, you wanna ask FTL to import the new aliasclient(s),

sudo pkill -RTMIN+3 pihole-FTL

And now, the dashboard looks like this,

You need to repeat this every ever pair of IPv4 and IPv6 mock-MAC assigned for a given device/client in your network table (ensuring that the aliasclient_id is declared in aliasclient table).