LibreNMS finds wrong host by hostname, even though ping provides correct IP address

Hi folks,

I have a device (my router) that works fine when the host name is set to its IP address (192.168.9.1), but when I set the host name to the actual host name of the device (edge.armitage.space), LibreNMS considers it to be localhost. Logging in to the librenms user on the LibreNMS host and pinging edge.armitage.space yields the correct IP address (PING edge.armitage.space (192.168.9.1) 56(84) bytes of data.)

When changing the host name to the actual host name, on the next poll, LibreNMS changes all of the device information over to match that of localhost (OS, ports, processor, everything). Changing back to the IP address of the router changes everything back to the correct data.

This was working fine until I had an extended power outage and my router (running both DHCP and DNS servers) did not come back up properly. After resolving that I power cycled pretty much everything in my network. All other devices tracked by LibreNMS are working fine by host name.

Suggestions?

For some reason I never thought to dig the host name until just now. From the LibreNMS host I get:

;; ANSWER SECTION:
edge.armitage.space.    0       IN      A       192.168.9.1
edge.armitage.space.    0       IN      A       127.0.1.1

I’m going to go out on a limb and guess that that second record is part of the problem…

For what it’s worth, this is an EdgeRouter, and the reason 127.0.1.1 is being returned is discussed here. After setting the override-hostname-ip configuration option as described to 192.168.9.1, a dig from the LibreNMS host now returns

;; ANSWER SECTION:
edge.armitage.space.    0       IN      A       192.168.9.1

I will now try to change back to the host name and see if it works now.

1 Like

Yes it seems to be working now. Sometimes it helps to put your problem down in words; forces you to think it through instead of short-circuiting :wink: