Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Centos6 box on a network I control.

I want to be able to set a static IP locally on the machine and have it grab its FQDN from the local DNS server without me having to set it manually.

# hostname
# dnsdomainname // Doesn't return anything at all
# dnsdomainname -A
# dnsdomainname -f

I have both an A record in DNS and the matching reverse-dns record, but something is missing.

share|improve this question

This isn't how DNS works. Its purpose is to map host names to ip addresses (and the reverse) so that they can be looked up using the easy to remember host name.

If you set your ip statically you need to set your host name/fqdn manually. The FQDN is generally acquired from DHCP when not setup manually. An option if you want a "static" IP is to reserve the IP you want in your DHCP server and let the host pull that as well as all the other settings, including FQDN.

share|improve this answer
So there is no way to get a machine to do a reverse lookup on its own IP to determine its fqdn? I have a problem with this answer because, though I don't exactly understand why, I think I have gotten this to happen in the past. – colechristensen Jan 20 '12 at 21:53
I'm sure you can write some init scripts to do it ... but no nothing built in. – Zypher Jan 20 '12 at 21:55
The problem with doing a reverse lookup is ... there's no guarantee that the PTR record is correct (or even set). It's not required. The right way to provide this is: either hard code it or have your DHCP server provide it in the lease offer, like Zypher suggested. – Travis Campbell Jan 20 '12 at 22:24

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.