I am running a server on Ubuntu 18.04 that uses the jmDNS library for discovery. The code that initializes it is:
jmDNS = JmDNS.create(InetAddress.getLocalHost());
serviceInfo = ServiceInfo.create("_http._tcp.local.", "Service", 65534, "Ready");
However, when it resolves on a client on another machine, the IP address is 127.0.1.1. The client is configured as such:
jmdns = JmDNS.create(InetAddress.getLocalHost());
When I run this on a non Ubuntu machine, the IP Address is correct. I'm trying to figure out what's causing this.
Edit the
/etc/hostsfileComment out the 2nd line which starts with
127.0.1.1So your
/etc/hostsfile should look like this:Reference: https://serverfault.com/questions/363095/why-does-my-hostname-appear-with-the-address-127-0-1-1-rather-than-127-0-0-1-in