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

I am having problems getting my domain name set correctly on CentOS 6. My resolv.conf looks like this:

# Generated by NetworkManager

I have a single eth0 interface with the following configuration:


Hosts file for reference also:   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6    myvm

I am trying to change the domain to But after reboot, it reverts to By the inline comment, I can see it is generated by NetworkManager. However, system-config-network-tui doesn't have anything about the domain name (only the search path).

A fgrep -r '' /etc/* only brings up /etc/sysconfig/networking/profiles/default/resolv.conf as another choice to edit. But I have tried editing this file also with the same results. This is a virtual machine running in VMware Workstation. But I have the DHCP server disabled for the VMnet interface that the VM is using.

Rather than just blindly disable NetworkManager (which seems to be the answer for most NetworkManager related issues), I would like to understand more about how it works and saves configuration. So how is my system ending up with as the domain name and what needs to be updated to set it to

share|improve this question
What does a reverse lookup of resolve to (host – mgorven May 18 '12 at 19:19
There is no reverse DNS setup. It returns Host not found: 3(NXDOMAIN) – Andy Shinn May 22 '12 at 15:38
Can you please share the contents of /var/run/nm-dhclient-eth0.conf? I want to see what networkmanager is sending to your dhcp server. – slm Feb 8 '13 at 17:45

You need to edit the following files: /etc/sysconfig/network. Set the following:
share|improve this answer
It looks like this would set the hostname to which is not what I am asking. I am asking for the domain to be set to (so the full hostname would be Is this really the correct way to get this behavior? – Andy Shinn Oct 29 '12 at 15:31

set the short name into /etc/sysconfig/network


Edit /etc/hosts and set another line like this:

[root@vcolo ~]# cat /etc/hosts vcolo   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
share|improve this answer

NetworkManager makes use of the files that are already present on your system. Take a look at this script, /etc/NetworkManager/dispatcher.d/11-dhclient, which is part of NetworkManager's configuration files.

Specifically there are these 2 lines:

[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network

[ -f /etc/sysconfig/network-scripts/ifcfg-$interface ] && \
    . /etc/sysconfig/network-scripts/ifcfg-$interface

These lines will source the contents of what's in /etc/sysconfig/network and the different ifcfg-$interface files (ifcfg-eth0, ifcfg-wlan0, etc.) if these files are present.

So typically you want to set your /etc/sysconfig/network file up like this:


And setup DHCP client config file, /etc/dhcp/dhclient.conf, so that it contains these lines:

supersede domain-name "";
prepend domain-search "";


share|improve this answer

This worked for me on Fedora 14. You can also try the following command:


Go to "DNS Configuration" and you'll find a cell to complete hostname and domain for your hosts.

I've found that although my netmask was correctly configured in various ifcfg-eth0 files in /etc, it was wrongly set at boot time. Didn't find where it was set, but using system-config-network I found it set to the wrong value. Corrected it with this tool and problem solved!

Hope it works for you too.

share|improve this answer

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.