DNS resolving returns two different host names for same IP

Hi,

I’m currently facing a strange situation here. I’m using pmacct to gather IP traffic on interface green. This command returns local IP addresses instead of host names.

So, some monitoring I need host names as well, hence I’m using a Python script to resolve DNS names, the appropriate line is, socket.gethostbyaddr(ipaddr) where ipaddr is one of my local IP adddreses here.

I’m running DNS on my IPFire as well as a second DNS on my Synology NAS. The later is needed because of the running Active Directory Server on the NAS.

Now what is strange? The above line sometimes returns different host names for a few IP addresses, mainly if not always for connected smartphone.
The host themselves, however, are correct in a certain way: E.g 192.168.23.3 returns SamsungS5 as well as HandySamsungS5. When doing some traffic statistics, I cannot use different host names, I need unique ones.

OK, some further details: the host name HandySamsungS5 is set up by the HOST file on my IPFire, using the WebIF, whereas SamsungS5 is not used anywhere. The IP address 192.168.23.3 is a static one and configured in DHCP server on IPFire.

Do you know the source of this varying host names. I cannot say for sure when this happens. Since those smartphones are randomly connected via a Wifi AP the time for this occurrence cannot be determined.

Michael

Take a look at “Edit Hosts” and specify a unique name for the address assigned in DHCP.

Excuse my English, I’m using an online translator.

looks that the phones dhcp client submit the “SamsungS5” via DHCP and the lease bridge add this to dns as long the lease is valid.

Thanks for your suggestion. That’s the way I do it today already!

OK, this behavior cannot be suppressed, right?

Michael

Hi,

I do it this way: I set the same name for the phone in IPFire -> Hosts and on the phone itself in (valid for Android) Settings -> Phone Info -> Edit Name (or such).

Cheers

Gremlin

OK, I could do it the other way round of course, set the appropriate HOST entry to the name the phone already provides. But, why should I do this?

I mean, I now know the background of this behavior, however, I rather expect that the available HOST entry wins in case of a client resolves the IP of the phone.

Because this happens for other (Android, about 8) devices, here too, I don’t want to grab each of them and manually change the name of the device.

FWIW: I’ve added a manual host entry because of the SARG reports, IPFire delivers. If I don’t add a host entry, many of those reports just give me the IP-address instead of a human-readable name.

Michael