1

I have a couple of test systems running Centos 6 and I thought I'd try out Centos 7. Apart from all the obvious differences (no iptables, no ifconfig), there is one thing that really had me scratching my head. On centos 6, my hostname looks like this:

# hostname
centos6

On centos 7, my hostname needs to look like this:

# hostname
centos7.fqdn.foo

If I set the hostname to simply centos7, this causes DNS issues and I am only able to resolve external addresses, such as google.com, but no internal hostnames from our internal DNS server. Since there does not seem to be a requirement on my centos6 box to have this "clunky" hostname, I am wondering if something changed between releases, or if I'm simply overlooking some configuration made on centos 6 (such as a DOMAIN variable in the network configuration or something like that) that is missing on the centos 7 box.

What also confuses me is that on the centos 7 box, this command works:

# ping centos6
PING centos6.fqdn.foo (192.168.1.15) 56(84) bytes of data.
64 bytes from centos6.fqdn.foo (192.168.1.15): icmp_seq=1 ttl=64 time=0.399 ms

So apparently the ping command can translate the short host name into the long one, but when I try the same with nslookup:

# nslookup centos6
;; Got SERVFAIL reply from 192.168.1.11, trying next server

The short host name is obviously not enough. Using the FQDN with nslookup works fine.

I am assuming that the problem here is that as soon as my centos 7 box leaves the fqdn.foo domain, DNS breaks down. I just don't understand why, and why this doesn't seem to be the case on centos 6.

edit This may have been as easy as running nmtui and making sure both DNS and search were filled out for the proper ethernet adapter. I was almost sure I had done it before but perhaps I forgot to do service network restart, who knows. It works now anyway.

2
  • Is the short name present in /etc/hosts? – HBruijn Dec 9 '14 at 6:53
  • No, hosts only contains localhost on both systems (loopback I guess?). – pzkpfw Dec 9 '14 at 6:54
1

Look at your /etc/resolv.conf and be sure to include in the search directives the internal domain name suffix(es) that you wish to consider for non-FQDN names. Then you should easily be able to use the simple hostname you wish.

I don't think that this is a difference between Centos versions.

1
  • Thanks for your answer! In Centos 6, my resolv.conf looks "clean", it has a "search" variable as well as the nameservers. However, on Centos 7 this file begins with the statement "# Generated by NetworkManager". I believe this should be set in NetworkManager somehow in Centos 7, and I'm also pretty sure I did! It just will not propagate to resolv.conf for some reason. This is probably on the right track though, resolv.conf on my centos7 only contains nameservers. – pzkpfw Dec 9 '14 at 6:53

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.