0

I have a problem when connecting via ssh by name. I have 1 main computer (Gigabyte) and other 4 extra computers (Odroids). I am running Ubuntu in all of them. I have the computers in a network using a router, so when I ssh one of the odroids I do:

ssh odroid@odroid1.local

If I have the router connected to internet, I can ssh all the machines by name. But if the router is not connected to internet I cannot ssh the last machine. So:

ssh odroid@odroid4.local

doesn't work. And this happens with two routers I have. They are Buffalo routers. On the other hand I can connect to odroid4 by ip address.

ssh odroid@192.168.11.x

If I use ssh -vvv odroid@odroid4.local I notice that the ip address is not correct, it gives me:

debug1: Connecting to odroid4.local [192.168.11.1] port 22.
debug1: connect to address 192.168.11.1 port 22: Connection refused
ssh: connect to host odroid4.local port 22: Connection refused

192.168.11.1 is not the ip address of any machine. I think I am missing some configuration either in the routers or on the computers but I don't know what.

2
  • UseDNS no in the server config should do the change.
    – Jakuje
    Sep 27 '16 at 15:36
  • I tried UseDNS no, but no success.
    – Luis
    Sep 27 '16 at 16:31
1

The ssh -vvv shows that all requests are redirected to your gateway (if 192.168.1.1 is indeed that).

You are probably using DHCP to get your local IP configuration. With that, comes the DNS server configuration, which, again, is probably your local gateway. It usually serves as a DNS relay which sends your DNS requests to an external DNS server.

When you have no Internet connection, most CPEs (Customer Premises Equipment) offer a captive portal enabling you -the customer- to troubleshoot the internet connection if you try to access an external website using your preferred browser.

To do that, the CPE uses DNS spoofing to redirect all requests to itself. It is rather normal for a CPE , even if usually only http requests are redirected to avoid this kind of issue, and also only external requests. This might be a defect on Buffalo's side.

To workaround that, you can either :

  • offer yourself a nice new all-in-one router;
  • less expensively, setup your own DNS server in your LAN to handle the requests you make;
  • even more minimal, setup a local hosts file.

DNS setup

  • Configuration of the local zone file with the LAN names you want
  • Use it as your primary DNS server
  • Use the gateway as your second DNS server.

This might make DNS requests go slower in case of external FQDN resolution though (like a few hundred milliseconds more at best).

Local hosts file

This is a file you can edit to register local FQDNs. Your system will look it up before sending DNS requests, and if it gets a match, it will use the IP associated.

In Windows: C:\Windows\System32\drivers\etc\hosts

In Unix systems (including Mac OS X): /etc/hosts

Feel free to comment my answer if it doesn't solve your issue and that you are able to provide with more information regarding it (as you can see, I had to write a lot of "probably". This is where you could have added more information in the first place :) ).

6
  • Hello, I tried the hosts file setup, but no success. The DNS server is a little complicated so I will skip that one. Can you recommend me a good router?
    – Luis
    Sep 27 '16 at 16:30
  • We don't do hardware recommendations here, there's another StackExchange site for that. Have you rebooted your computer after editing the file?
    – Doezer
    Sep 27 '16 at 16:32
  • Yes, I rebooted and tested. After that, I also disconnected everything and connected again.
    – Luis
    Sep 27 '16 at 16:35
  • If not already, can you try using different hostnames in your hosts file? (different than the one you were using before I mean, like odroid1.local)
    – Doezer
    Sep 27 '16 at 16:52
  • The hosts file solution worked!!! I forgot to change the computer names in all the files using computer names.
    – Luis
    Sep 28 '16 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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