Can SSH with IP but not host name?

52,429

You could try adding 10.1.10.129 noranetserver to /etc/hosts, to make the computer you connect from aware of the server hostname.

There are other ways as well, as pointed out in the following questions: 1 and 2.

Share:
52,429

Related videos on Youtube

PopKernel
Author by

PopKernel

Updated on September 18, 2022

Comments

  • PopKernel
    PopKernel over 1 year

    When I SSH directly to the server's IP address, it works. (ssh [email protected]) For reference, here is the resulting prompt:

    michael@noranetserver:~$
    

    However ssh-ing by name doesn't work like so:

    ssh michael@noranetserver
    ssh: Could not resolve hostname noranetserver: nodename nor servname provided, or not known
    

    Why would this be?

    • No Time
      No Time about 10 years
      You could try nslookup and see if the 'noranetserver' is in the names list. nslookup noranetserver if it is not that may be the reason.
    • PopKernel
      PopKernel about 10 years
      Is nslookup preinstalled on most UNIX-likes? Or must I download it?
    • No Time
      No Time about 10 years
      Yes it should be in by default
    • PopKernel
      PopKernel about 10 years
      It returned ** server can't find noranetserver: NXDOMAIN Does that mean anything?
    • No Time
      No Time about 10 years
      Sucky think about SSH: Using NAT (especially on port overload), and DHCP make it hard to SSH because of the constant changed, vs a home network where you can set stuff up how you want. :/ hope that answer below helped.
  • mikewhatever
    mikewhatever about 10 years
    Sure, there are other ways to make the server advertise its hostname. Please refer to the following questions: 1 and 2.