Adding alias-clients to Pi-hole FTL

Having seen @jpgpi250's interpretation of what this can be used for, I thought it may be a good idea to generalize the super-clients. So far, super-clients were set by using a MAC address as identifier. This is a limitation as you may have a device with:

  • more than one MAC address (e.g., Ethernet and WiFi interface)
  • devices without a MAC address being available (e.g., connected through VPN or on another VLAN)

So back to the drawing board!

Please first reset your database back to how it was before checking out the new/super-clients branch using:

sudo sqlite3 /etc/pihole/pihole-FTL.db "DROP TABLE superclient;"
sudo sqlite3 /etc/pihole/pihole-FTL.db "UPDATE ftl SET value = 8 WHERE id = 0;"

Then check out the latest version of this branch.

The superclient table now looks like this (hwaddr gone, id added):

ID host name comment
0 linux-box-1 (optional)

The network table - listing all devices - gets an extra column at the end: superclient_id (referencing the superclient table's IDs)

You can add a super-client ID to as many MAC addresses (may be real or mock-MAC addresses) as you like. This will give you a lot more flexibility and should work equally well.

Example:

  1. Check out the FTL branch

    pihole checkout ftl new/super-clients
    
  2. Add a new super-client

    sudo sqlite3 /etc/pihole/pihole-FTL.db
    
    INSERT INTO superclient (id,name,comment) VALUES (0,'something',NULL);
    
  3. Assign two MAC addresses to this super-client (ID = 0)

    sudo sqlite3 /etc/pihole/pihole-FTL.db
    
    UPDATE network SET superclient_id = 0 WHERE hwaddr = 'd0:50:99:33:78:33';
    
  4. Ask FTL to re-import super-clients

    sudo pkill -RTMIN+3 pihole-FTL
    
  5. See that the said client is now inside the super-client something
    Screenshot at 2020-08-12 19-59-43

  6. For the sake of demonstration, let's add the Top Client (25010 queries) to the same super-client:

    sudo sqlite3 /etc/pihole/pihole-FTL.db
    
    UPDATE network SET superclient_id = 0 WHERE hwaddr = 'd0:50:19:31:28:45';
    

    followed by a

    sudo pkill -RTMIN+3 pihole-FTL
    
  7. Enjoy.
    All statistics from all addresses of these two devices are summarized under one name:
    Screenshot at 2020-08-12 20-00-24

1 Like