I have a ubuntu-Server 16.04 LTS running and fully updated. I can access it through IP Address and hostname.local, but if I try to access it with just hostname it can't reach the address. hostname and host files are properly configure.

Details about My hosts:

  • ubuntu-server 16.04 (lets call it ubuntuserver for better undestanding);
  • ubuntu 17.10 (called ubuntudesktop);
  • windows (called firstwin);
  • windows (called secondwin).

Note that I can ping ubuntudesktop with just the hostname with any Operating System

  • How do you trying to get access to server? by ssh? Does the server responding on pings when you trying to ping it by hostname? – Dexter Morganov Feb 15 '18 at 8:29
  • Not just SSH, I use this server for media, database and backup. I have two machines with windows and one ubuntu. With ubuntu I can Access it using hostname.local and IP. On windows only IP works – alculete Feb 15 '18 at 14:07

You have configured hostname and hosts on your server only. In this case only server knows it's hostname.

For access to this server by it's hostname your should have properly configured DNS records or records in hosts file on your computer (for correct resolving hostname to IP address).

  • I have an application running on this server as well accessed by smartphone, windows and a ubuntu machine. This doesn't seems to be the right approach. As I said before I can access it with hostname.local and not just hostname – alculete Feb 20 '18 at 13:27

If you want the hostname and hostname.local to be resolved, and you use linux to access hostname, you have to add

search local

in your /etc/resolv.conf file. I am not sure how you do that if resolv.conf is generated. However, take a look at http://man7.org/linux/man-pages/man5/resolv.conf.5.html, where you can see directives for resolv.conf file.

You should always add your domain(s) with search if you want that also short names would be resolved correctly. If you computer is also in the same domain you can also use domain keyword. Since your top domain is local you do not have to change ndots option.

Probably the simplest way to make this work is to name your computer from where you try to access hostname to be yourcomputer.local. In that way, local will automatically be considered as your domain and both (hostname and hostname.local) will be resolved.

You did not give enough detail, what OS are you using to access hostname and how do you want to access it.

  • I've added more information on the problem I hope helps – alculete Feb 15 '18 at 13:58
  • I use both Linux and Windows to access – alculete Feb 19 '18 at 9:26

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.