1

For whatever reason when I try to access local hosts via their names it is not resolving properly.

# ping server.domain.tld
PING server.domain.tld.domain.tld (###.###.###.###) 56(84) bytes of data.

Obviously this breaks ssh and any scripts that rely on host names. Anything on that domain that has a public IP address resolves correctly.

What's my next step in troubleshooting this? Google hasn't turned up anything similar with the search terms I've thought of, so any help is appreciated.

Not sure if it makes any difference, but when I try to ping just the server I get the following (which is as it should be, I believe):

# ping server
ping: unknown host server

2 Answers 2

3

It sounds like you want to setup split horizon DNS. That is, you want to have a DNS server that "knows" about the private IP addresses and names of your servers. Your servers can use this DNS server to resolve names to their private IP addresses instead of the public addresses that your public-facing DNS servers will resolve to.

You don't mention what DNS server software you're using (or even if you're hosting your own DNS). BIND has the views functionality that can do what you need. Other DNS server software likely has similar functionality (I only use BIND on Linux, so I can't speak from experience).

If you're not hosting DNS for your domain and can't get your DNS provider to use views then you might consider just setting up your own DNS server behind your NAT device and configuring your servers to use it.

If you have hosts with names in your domain that are located outside your NAT device be sure that your internal DNS server (or view) correctly returns the public IP addresses for these hosts.

Edit:

As @BillThor says, to get your servers to resolve unqualified names to records in your domain you'll need to add a search domain.tld line to the servers' /etc/resolv.conf.

2

Add domain.tld to the search list in /etc/resolv.conf. You should have your domain first so that it is checked first. If your domain was example.com, the following search list might be appropriate.

search example.com com net org

To test your resolver use a command like:

getent hosts server

This will return the IP and FQDN of the server if the resolver can resolve it.

You must log in to answer this question.

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