You are not logged in.
I have several computers with Arch installed. They are all in a local network, with dynamic IPs. Normally, if I install avahi and have avahi-daemon.service running, they can ssh each other with hostname instead of IP address. But there is one computer can't get access with hostname, although to my best knowledge it has exactly the same setup.
cat /etc/hosts
127.0.0.1 localhost.localdomain localhost xxx Then if I ssh to it from other computers, hostname is unknown
ssh user@xxx
ssh: Could not resolve hostname xxx: Name or service not knownIf I ping xxx, same thing.
But ssh and ping with IP address to this computer do work.
What could be the problem and what else should I look at?
Offline
I've never ran a LAN to know if this would be the cause but the /etc/hosts line should be:
127.0.0.1 xxx.localdomain localhost xxx"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
I tried your suggestion, but it didn't help.
In fact, my other computers which are working also have the same format of /etc/hosts, so I assume it was probably not the cause ...
Thank you all the same.
Offline
Normally you should just use
127.0.0.1 localhost
for 127.0.1.1 you can use FQDN
127.0.1.1 localhost.localdomain localhost
edit:
so a translate would be
127.0.1.1 mymachine.domain mymachine
/edit
Though this may/will work on 127.0.0.1 too
You shouldn't use the machine name after the localhost
See man hosts
Last edited by qinohe (2018-06-15 14:12:23)
Offline
What is "xxx"? avahi by default only handles foo.local, see https://wiki.archlinux.org/index.php/Av … resolution
Ensure the daemon is actually running, port 5353 on that system is listening and in case you tampered w/ the avahi config (see above), please paste your alterations.
Online
What is "xxx"? avahi by default only handles foo.local, see https://wiki.archlinux.org/index.php/Av … resolution
Ensure the daemon is actually running, port 5353 on that system is listening and in case you tampered w/ the avahi config (see above), please paste your alterations.
xxx was myhostname without '.local', as the output of cat /etc/hostname.
Now I added .local to it, and /etc/hosts looks like
127.0.0.1 localhost xxx.localI am not aware of having ever touched the avahi config. Here is my /etc/avahi/avahi-daemon.conf
[server]
#host-name=foo
#domain-name=local
#browse-domains=0pointer.de, zeroconf.org
use-ipv4=yes
use-ipv6=yes
#allow-interfaces=eth0
#deny-interfaces=eth1
#check-response-ttl=no
#use-iff-running=no
#enable-dbus=yes
#disallow-other-stacks=no
#allow-point-to-point=no
#cache-entries-max=4096
#clients-max=4096
#objects-per-client-max=1024
#entries-per-entry-group-max=32
ratelimit-interval-usec=1000000
ratelimit-burst=1000
[wide-area]
enable-wide-area=yes
[publish]
#disable-publishing=no
#disable-user-service-publishing=no
#add-service-cookie=no
#publish-addresses=yes
publish-hinfo=no
publish-workstation=no
#publish-domain=yes
#publish-dns-servers=192.168.50.1, 192.168.50.2
#publish-resolv-conf-dns-servers=yes
#publish-aaaa-on-ipv4=yes
#publish-a-on-ipv6=no
[reflector]
#enable-reflector=no
#reflect-ipv=no
[rlimits]
#rlimit-as=
#rlimit-core=0
#rlimit-data=8388608
#rlimit-fsize=0
#rlimit-nofile=768
#rlimit-stack=8388608
#rlimit-nproc=3I can verify avahi-daemon.service is running
systemctl status avahi-daemon.service
● avahi-daemon.service - Avahi mDNS/DNS-SD Stack
Loaded: loaded (/usr/lib/systemd/system/avahi-daemon.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2018-06-15 16:35:51 CEST; 18min ago
Main PID: 361 (avahi-daemon)
Status: "avahi-daemon 0.7 starting up."
Tasks: 2 (limit: 4915)
Memory: 1.8M
CGroup: /system.slice/avahi-daemon.service
├─361 avahi-daemon: running [xxx.local]
└─375 avahi-daemon: chroot helperBut how can I check if the computer is listening to port 5353?
Offline
OK, now I find out another thing. I have a fritzbox router, every computer in the local network seem to be actually named xyz.fritz.box.
If I ssh user@xxx.fritz.box to this problematic computer, it works.
What I don't understand is that for other computers, i don't have to append fritz.box to the hostname.
Offline
You could try adding
domain fritz.boxto /etc/resolv.conf. That way, you can refer to your machines as xxx or xyz without the full domain name.
Offline
You can check the port status with eg. nmap, however we can infer that it's open.
The .local tld should not be required, but you should (only) be able to address the IP under this tld, ie. "ping xxx.local" should work.
The "xyz.fritz.box" will most likely work w/o avahi, the systems report their hostname via dhcp and the DNS(masq, I think) server of the fritzbox will resolve them (iow: w/ a capable router, you don't need avahi at all)
Reg. the avahi situation:
- do you set the static hostname? (see "hostnamectl")
- what if you announce the hostname via the "#host-name=foo" key in avahi-daemon.conf?
Online
You can check the port status with eg. nmap, however we can infer that it's open.
The .local tld should not be required, but you should (only) be able to address the IP under this tld, ie. "ping xxx.local" should work.
The "xyz.fritz.box" will most likely work w/o avahi, the systems report their hostname via dhcp and the DNS(masq, I think) server of the fritzbox will resolve them (iow: w/ a capable router, you don't need avahi at all)
ping xxx.local doesn't work.
I would like to get it work with avahi, not with the help with the router, which actually belongs to the ISP company.
Reg. the avahi situation:
- do you set the static hostname? (see "hostnamectl")
- what if you announce the hostname via the "#host-name=foo" key in avahi-daemon.conf?
hostnamectl shows it has static hostname: xxx, which is the same as in /etc/hostname
Now my avahi-daemon.conf has the line host-name=xxx, then restart avahi-daemon.service, or even the computer, nothing seems to change.
I also checked all the points you mentioned in another working computer, but could not identify any real difference.
Offline
You could try adding
domain fritz.boxto /etc/resolv.conf. That way, you can refer to your machines as xxx or xyz without the full domain name.
Here is another surprise to me. Although I don't remember ever touching /etc/resolv.conf, but it already contains the line
domain fritz.boxThen, on another computer which I can access without fritz.box, there isn't this line in /etc/resolv.conf ...
Offline
Firewall? Let's see whether the port does really respond:
nmap -p 5353 <IP of "xxx" here>Online
Firewall? Let's see whether the port does really respond:
nmap -p 5353 <IP of "xxx" here>
Here is the output
Starting Nmap 7.70 ( https://nmap.org ) at 2018-06-17 02:28 CEST
Nmap scan report for xxx.fritz.box (192.168.xxx.xx)
Host is up (0.0075s latency).
PORT STATE SERVICE
5353/tcp closed mdns
Nmap done: 1 IP address (1 host up) scanned in 0.07 secondsOffline
Now I discovered that the problem was not the server, but the computer i am using to ssh the server!
I tried it on another two Arch computers and they were able to ssh the server with its hostname directly. In fact, all computers, except the one I am actually using on a daily basis, can ssh each other with hostname...
On my daily computer, it only works with xxx.fritz.box
What to look for next?
Offline
The port is closed, either avahi isn't running or it's faulty or you're blocking the port w/ some iptables rule (at that time)
As for the "it's rather an DNS query issue", compare the /etc/nsswitch.conf of the systems (ie. the one that fails to resolve the domain compared to those succeeding)
Also compare the nmap results among the machines.
Online