15

When I SSH directly to the server's IP address, it works. (ssh michael@10.1.10.129) 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?

PopKernel
  • 399
  • 1
  • 2
  • 12
  • 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. – No Time May 16 '14 at 17:00
  • Is nslookup preinstalled on most UNIX-likes? Or must I download it? – PopKernel May 16 '14 at 17:02
  • Yes it should be in by default – No Time May 16 '14 at 17:04
  • It returned ** server can't find noranetserver: NXDOMAIN Does that mean anything? – PopKernel May 16 '14 at 17:39
  • 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. – No Time May 16 '14 at 20:07

2 Answers2

9

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.

mikewhatever
  • 32,243
  • 10
  • 87
  • 98
  • 1
    Is there a more universal way to do this? I was hoping to using the computer's hostname for a variety of other things on the network. I can't hold on to the static IP indefinitely, I just convinced my superior to let me use one as a stopgap measure. – PopKernel May 16 '14 at 18:37
  • 1
    Sure, there are other ways to make the server advertise its hostname. Please refer to the following questions: [1](http://askubuntu.com/questions/144280/cannot-ssh-into-ubuntu-server-by-hostname) and [2](http://askubuntu.com/questions/23741/how-to-reach-a-host-in-the-same-network-by-hostname). – mikewhatever May 16 '14 at 18:47
0

Try avahi-daemon package, it just work as a service.

Itachi
  • 101
  • 2