Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

nameserver 198.6.100.25
nameserver 198.6.100.53
nameserver 198.6.100.38
# Generated by NetworkManager
domain andyshinn.as
search vcolo.andyshinn.as

I have a single eth0 interface with the following configuration:

DEVICE=eth0
BOOTPROTO=none
NM_CONTROLLED=yes
ONBOOT=yes
TYPE=Ethernet
HWADDR=00:0c:29:3b:2a:70
IPADDR=192.168.50.6
NETMASK=255.255.255.0
DNS2=198.6.100.53
GATEWAY=192.168.50.1
DNS1=198.6.100.25
IPV6INIT=no
USERCTL=no

Hosts file for reference also:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.50.6    myvm myvm.vcolo.andyshinn.as

I am trying to change the domain to vcolo.andyshinn.as. But after reboot, it reverts to andyshinn.as. 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 'andyshinn.as' /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 andyshinn.as as the domain name and what needs to be updated to set it to vcolo.andyshinn.as?

share|improve this question
    
What does a reverse lookup of 192.168.50.6 resolve to (host 192.168.50.6)? –  mgorven May 18 '12 at 19:19
    
There is no reverse DNS setup. It returns Host 6.50.168.192.in-addr.arpa. 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

3 Answers 3

You need to edit the following files: /etc/sysconfig/network. Set the following:

HOSTNAME=vcolo.andyshinn.as
DOMAIN=andyshinn.as
share|improve this answer
    
It looks like this would set the hostname to vcolo.andyshinn.as which is not what I am asking. I am asking for the domain to be set to vcolo.andyshinn.as (so the full hostname would be myvm.vcolo.andyshinn.as). 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

HOSTNAME=vcolo

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

[root@vcolo ~]# cat /etc/hosts
127.0.0.1   vcolo.andyshinn.as vcolo
127.0.0.1   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:

NETWORKING=yes
HOSTNAME=myhost

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

supersede domain-name "my.domain.com";
prepend domain-search "my.domain.com";

Resources

share|improve this answer

Your Answer

 
discard

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.