question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hostname resolution fails using zeroconf

See original GitHub issue

Problem

Using the zeroconf discovery, SyncThread on local host hostfoo throws errors about being unable to resolve the hostname of a remote host hostbar:

[INFO][rosout]: hostbar is now online
[INFO][rosout]: SyncThread[hostfoo] Requesting remote state from 'http://hostbar:11911/'
[ERROR][rosout]: SyncThread[hostfoo] ERROR: Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/master_sync_fkie/sync_thread.py", line 264, in _request_remote_state
    remote_state = remote_monitor.masterInfo()
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1311, in single_request
    self.send_content(h, request_body)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1459, in send_content
    connection.endheaders(request_body)
  File "/usr/lib/python2.7/httplib.py", line 1053, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 897, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 859, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 836, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 557, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno -2] Name or service not known

Notes:

  • There is no network-wide name resolution, I want to rely on mdns only.
  • It’s an IPv6-only network

Debugging

My /etc/nsswitch.conf (relevant line):

hosts:          files mdns [NOTFOUND=return] dns

The parameters for the zeroconf node are default; the zeroconf nodes discover each other perfectly.

Manual hostname resolution fails with:

host hostbar
host hostbar.local
avahi-resolve -n hostbar
getent hosts hostbar

Manual hostname resolution works with:

avahi-resolve -n hostbar.local
getent hosts hostbar.local

I’m not sure, it might be a better idea to use hostbar.local instead?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
atiderkocommented, Apr 11, 2019

I added a fqdn parameter. You have to set this parameter to true.

rosrun master_discovery_fkie zeroconf _fqdn:=true

Regarding your post, I’m afraid that the ROS-topic communication will not work anyway. But you can try it out!

0reactions
stertingencommented, Apr 11, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

FS#18278 : [avahi] Zeroconf hostname resolution for .local fails
Description: When I use avahi-resolve-host-name laptop.local, it returns an IPv4 or IPv6 address, but when using e.g. ping laptop.local, I get 'Unknown host'....
Read more >
How can I resolve .local addresses in Windows? - Super User
I've got some Linux servers on my home network that I access via "hostname.local", however ...
Read more >
Name Resolution Problems with ".local" Domains | Support
Applications or system programs like ping have problems with the resolution of names in a DNS domain ending with .local.
Read more >
can't connect using mDNS addressing when systemd ...
[chris@fmac ~]$ sudo systemctl start systemd-resolved.service [chris@fmac ~]$ ssh chris ssh: Could not resolve hostname flap.local: Name or ...
Read more >
Cannot resolve .local addresses from within Home Assistant ...
local hostnames for devices on my network. If I try to use any of those .local hostnames from within the container, it fails....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found