-3

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

server1.something.internal -> 10.0.0.1
server2.something.internal -> 10.0.0.2

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
nameserver 8.8.8.8

3 Answers 3

8

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?).

2
  • 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? Feb 29, 2012 at 6:44
  • 2
    search is not en.wikipedia.org/wiki/LLMNR, 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, 2012 at 6:51
5

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

10.0.0.1    server1.something.internal
10.0.0.2    server2.something.internal
1

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.

2
  • 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. Feb 29, 2012 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. Mar 4, 2012 at 20:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .