Results 1 to 5 of 5

Thread: Problem with Hostname.local to ip resolution

  1. #1
    Join Date
    Nov 2021
    Beans
    2

    Question Problem with Hostname.local to ip resolution

    I have recently set up 2 raspberry pis running Ubuntu Server on both, and when I SSH into either, I can only do so by their IP addresses within my house network. I cannot contact these servers using "username@Hostname.local". Even on the RPi 3 which is running a webserver, I can only access the webserver using the server's IP address. Is there something that I am missing, or perhaps something may be broken?

    Tech Info/Context:
    RPi 2 Ubuntu Server 20.04 LTS 32bit
    RPi 3 Ubuntu Server 20.04 LTS 64bit

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Problem with Hostname.local to ip resolution

    {hostname}.local only works if avahi is running, which isn't part of most server installs.
    There are multiple solutions. The easiest is to create a stanza in the ~/.ssh/config file for each system.

    Code:
    host xubu-2110
      user tf
      hostname 172.22.22.88
      port 22
    
    host xubu-2110-ext
      user tf
      hostname thefu.domain.com
      port 63022
    Then on the other system, use the other IP and change the "host" alias to be something that makes sense. I show using a LAN and WAN connection ... this can be handy if you want to allow internet access using a non-standard port. If the userid is the same on the client machine as on the remote system, that doesn't need to be added. But sometimes we need to use a backup userid or deployment userid for servers and I'd rather not need to know it.


    The other answer is to setup proper name resolution on each system. That can be with the /etc/hosts file or by running a DNS on the LAN.

    Avahi has some uses, but it also causes some problems. Best NOT to use it on servers. Also, you'll want to configure each server to have static IPs. That shouldn't need to be said, but I'm always amazed at people when they don't do that.

  3. #3
    Join Date
    Dec 2009
    Beans
    6,588

    Re: Problem with Hostname.local to ip resolution

    Code:
    sudo apt install avahi-daemon
    Do that on both servers.

  4. #4
    Join Date
    Nov 2021
    Beans
    2

    Re: Problem with Hostname.local to ip resolution

    So I have done that, and also followed another step that a tutorial online gave me in regards to Avahi, and it works. Thanks guys.

  5. #5
    Join Date
    Aug 2011
    Location
    Berlin, Germany
    Beans
    7,947
    Distro
    Ubuntu Mate 20.04 Focal Fossa

    Re: Problem with Hostname.local to ip resolution

    Please use Thread tools at the top of the thread and mark it solved

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •