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
?
You need to edit the following files:
/etc/sysconfig/network
. Set the following:set the short name into /etc/sysconfig/network
Edit /etc/hosts and set another line like this:
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:
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:Resources
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.