0

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.

1 Answer 1

0

Edit the /etc/hosts file

Comment out the 2nd line which starts with 127.0.1.1

So your /etc/hosts file should look like this:

127.0.0.1       localhost
#127.0.1.1      your-pc-name

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.