Show static leases with more MAC addresses in line correctly in UI

fixing the static dhcp list in the setting tab to show all the mac address in the same colum instead of the first one in MAC, the second one in IP and showing the IP in the hostname like this.
There is an easy fix for it but I can't update when i use it.

Those screenshots don't look like anything in the Pi-hole Admin interface.

Is that a custom theme/skin ?

No it is because i use f.lux and dark reader addon on chrome

What does the same display look like in the standard Pi-Hole interface, and is that what you want to change?

I don't see the same layout on my side.
i have 33 defined static entries and they all show like this:

With a scrollbar.

that's because you just have 1 MAC address per host. When you use an extender it change the MAC address so you have 2 MAC address per wireless client and in setting/Web interface you can change remove the boxed layout

1 Like

I understand.

What happens when both MAC addresses are present (live on the network)?

both MAC address can't be present at the same time because it's either connecter to the router or to the extender.
Edit:that's the difference when you got 1 or 2 MAC address
or at least the difference that i'm asking a fix for

It shows like this on my side after adding a different mac for the same IP:

you can have more than 1 MAC address on the same line.


That's what it look like in the 04-pihole-static-dhcp.conf file
The first one only have 1 MAC address because it's wired, the second one is wireless so it have 2 MAC address. The advantage is that it will remove the old leases on the other MAC address when you change the connection point

1 Like

What i want to change: When you got a dual MAC address i want both of them to be in the colum of the table.
In the standard interface it show as this.
I would like to show it as this.

The dark theme and the yellow hue aint part of the pi-hole setting page , it was made by an extension and a windows application.

1 Like

What router are you running that with an extender uses two MAC addresses? Are your devices switching between wired and wireless?

No, the devices are switching between the extender and the router in wireless:

The extender is a TP-link RE305 so you can't send the original MAC to the router.
The router is a Smart RG

As a matter of fact i have one way to fix it, but I don't know if the function is used somewhere else.
If you change in /var/www/html/admin/scripts/pi-hole/php/savesettings.php the readStaticLeasesFile by

function readStaticLeasesFile()
    global $dhcp_static_leases;
    $dhcp_static_leases = array();

    $dhcpstatic = @fopen('/etc/dnsmasq.d/04-pihole-static-dhcp.conf', 'r');
        return false;
    //run until end of file
        //Creating variable
        $mac = ""; $ip = ""; $hostname = ""; $i = 0;
        //separate each value and remove the "dhcp-host="
        $local_data = explode(",",trim(fgets($dhcpstatic)));
        $local_data[0] = substr($local_data[0],10);
        //Start validating
        for($i = 0; $i < count($local_data); $i++)
            if(strlen($local_data[$i]) > 0)
                if(validMAC($local_data[$i]))       $mac .= " and {$local_data[$i]}";
                elseif(validIP($local_data[$i]))    $ip = $local_data[$i];
                else                                $hostname .=", {$local_data[$i]}";
        //remove the first " and " and ", " from $mac and $hostname
        if(strlen($mac) >= 5)       $mac = substr($mac , 5);
        if(strlen($hostname) >= 2)  $hostname = substr($hostname , 2);

        //if there is at least one value send the leases
        if(strlen($mac) > 0 || strlen($ip) > 0 || strlen($hostname) > 0)
            array_push($dhcp_static_leases,["hwaddr"=>$mac, "IP"=>$ip, "host"=>$hostname]);
    return true;

In the last version (3.3 I think) it was working.

Does this still work with v5.0? If you already have a fix for this it would be great if you would submit a PR on github so others could also benefit.

Could you improve displaying static entries with more MAC addresses in admin UI (Settings > DHCP)? For ex. this is valid 04-pihole-static-dhcp.conf file entry:


Issue is that second MAC address is displayed in IP address field and Hostname field shows IP address. Hostname part is not shown at all. Inserting such entries through UI seems to work fine and I hope you keep it that way (not limiting to single MAC address).

1 Like

I moved your topic into this because it is the same FR. Your vote was transferred too.

This is also a problem I'm experiencing. My wyzecams loves to change their mac address, so I need to add several macs per cam. It will be awesome to be able to do this from the UI, but at least displaying it correctly will help a lot.

1 Like

I also would like to +1 this feature.
I'm using pi-hole as DHCP server with all my home devices reserved IP addresses. Some devices (like Roku player for example) can be connected via Wired or Wireless connection (with different MAC addresses) however it is the same device and I would like it to get assigned the same IP.
I managed to achieve this by modifying directly


changing the line for my Roku to


and it works great. I switch from wired and wireless on my Roku and back and i get the same IP. However on the pi-hole UI it looks like this:

I have other devices with Wired OR Wireless connection (never at the same time) and I would like to be able to manage this through UI.