Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Lets say I have 2 servers. They are on the same network, same subnet and the same domain. Everything is same.

server1.something.internal ->
server2.something.internal ->

So my question is Why can't I ping hosts by their fqdn? Instead of using ips I want to connect hosts by using their host and domain names

root@server1:~# ping server2.something.internal
ping: unknown host server2.something.internal

Hosts are Debian 6.0. Hostnames and domain names are set correctly. There is no dns or dhcp server on the network.Ips are set to static.

Here is the etc/resolv.conf of both servers

domain something.internal
search something.internal
share|improve this question
up vote 7 down vote accepted

Your machines must be able to resolve those fqdn into the ip addresses of the servers.

You say you have no DNS (and even if you did google's public resolver won't/shouldn't hand back non-internet IPs to foreign networks). This means that resolution must happen via /etc/hosts or perhaps some other method specified by /etc/nsswitch.conf.

Bottom line: You can't ping hosts by their FQDN because "their FQDN" doesn't resolve (properly?).

share|improve this answer
What about search something.internal line of etc/resolv.conf. Does not that mean that host should broadcast the dns query if destinations's domain is something.internal? – Oguz Bilgic Feb 29 '12 at 6:44
search is not, it's only used for converting hostparts into FQDNs (e.g. server1 -> server1.something.internal) the resulting query still goes though configured resolution methods set by nssswitch.conf . Even then, the servers in question would have to respond to LLMNR, which is not typical, esp. for BSD/*nix. – 84104 Feb 29 '12 at 6:51

The search directive has nothing to do with resolving a FQDN, it just appends the domain (something.internal in your case) to any query for a host name (sever2 in your example).

You need something - on the computer you're on - to resolve the FQDN into an IP address. The two standard "things" would be DNS or /etc/hosts

You say you don't have (and don't want?) a DNS server, so that pretty much leaves the hosts file. Edit /etc/hosts and add    server1.something.internal    server2.something.internal
share|improve this answer

Sounds like a fine case to use dnsmasq. Use your package manager to install.

Assuming you have one server which runs 24/7, install dnsmasq on that machine. Add the other machines IP and Hostnames to the /etc/hosts file of that machine. And start the dnsmasq service. In the resolv.conf of the other machines, add the IP of the machine which has dnsmasq installed as the DNS Server and restart the network.

dnsmasq does many other things. /etc/dnsmasq.conf is self documented and is a good starting point.

share|improve this answer
As I mentioned, I want to solve this problem without using any other tools. Since this is the basic linux network, using hostnames without any other tool should be enough to achieve this. – Oguz Bilgic Feb 29 '12 at 6:11
As I recall, you mentioned that there are no DNS servers in the network setup. DNS is the sane and easiest way to achieve name resolution. The other way is Zero configuration networking. The linux implementation is Avahi daemon. There is a configuration tutorial on Arch Linux wiki. – Shyam Sundar C S Mar 4 '12 at 20:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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