Unknown and double hostnames

I setup my pihole as DHCP a couple of weeks before and it works great.
But I have two questions maybe someone can help me with.
I didn’t find any topics regarding excactly this questions.

Dashboard and network tab show hostnames with “-2” at the end. These entrys are from my notebook which is online wired or wireless with the same hostname on different interfaces.
First hostname is correct but the same client on another interface is named “-2”.
Furthermore the same interface/MAC is shown with “unknown” as hostname in active leases.
When wireless interface is active the MAC of wired interface is show as “unknown” and the other way around.

Maybe this “unknown” thing is by design and I have to accept.
But what about the doubled hostnames in dashboard, network tab and query logs.
Is there any way to show the same hostname for different MAC?

I tried the following without success:

  • Adding two dhcp-host entries to /etc/dnsmasq.d/04-pihole-static-dhcp.conf for both interfaces with the same name an omitted IP
  • Changing name of the doubled hostname in the network table of “pihole-FTL.db”. After this names on the network tab are correct (as in DB) but the dashboard and query log keeps wrong

Any ideas on that?

Anyone? :worried:

What you see is perfectly normal.

You have given the explanation yourself:
Your notebook sports two NICs, an ethernet and a wireless one.
Your notebook will route its network traffic either through your wifi or your ethernet, resorting to the respective other only if the one is not available.

As you have (at least almost :wink: ) correctly deduced, identity of a device in a network is provided by its hardware MAC address (which is guaranteed to be globally unique, if only by convention, bar incompetent NIC manufacturers or beneficial or malevolent spoofing).

Your notebook, on the other hand, has only one name, and it is trying to register that name, regardless of NIC used for connectivity, trying to avoid possible conflicts by appending a digit. Pi-hole just uses the name as requested.

You can avoid or at least clarify this by doing the obvious:
Supply a meaningful hostname for each specific MAC address of your notebook (e.g. notebook-wlan and notebook-eth).

Besides, you should be aware that Pi-hole identifies DNS clients by IP-address rather than MAC address in its Query Log for various technical reasons (e.g. a device can potentially be assigned different IP addresses over time, and a segmented network does not carry MAC addresses over segment boundaries).

Thanks for explaination.

Are you saying that Windows appends a digit to the hostname?

Any idea how to apply a specific hostname to an interface in windows?

As you are running Pi-hole as DHCP, you should be able to assign correct hostnames to MAC addresses via Pi-hole’s UI under Settings | DHCP.
Don’t forget to save :wink:

I thought I tried that yet and it didn‘t work.
But know it does. Thanks for you help.

From your description here, you may have been editing the *.conf files directly, i which case you’d have to restart pihole-FTL in order for them to take effect. Also, an incidental save via Pi-hole’s UI at some later time may have overwritten your manual alterations, as may a pihole -up. :wink: