LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Changing hostname, dnsdomainname, and domainname permanently. (https://www.linuxquestions.org/questions/linux-networking-3/changing-hostname-dnsdomainname-and-domainname-permanently-280577/)

xemous 01-21-2005 01:41 PM

Changing hostname, dnsdomainname, and domainname permanently.
 
I am trying to change my hostname, domainname and dnsdomainname permanently.

If someone could explain why there is a dnsdomainname and domainname it would sort out alot of confusion with my dns server. I have no idea why the dns server dosent just use the normal domainname, and why theres a seperate dnsdomainname.

Were are the files that store this information so I can change them directly.

Cheers.

marghorp 01-21-2005 04:48 PM

these files are in the etc folder. As you would predict they are called dnsdomainname domainname and hostname. If they don't exist create them and if they do, just change their contents.

xemous 01-22-2005 04:04 AM

I'm doing this on redhat 7.3. The placed the file /etc/sysconfig/network and inside it has a HOSTNAME=thehostname which works if i change it and reboot. I tried adding a DOMAINNAME=adomainname and it dosent work so i'm thinking that the domainname and dnsdomainname isnt help in this file.

I also tried echo "HOSTNAME=asdf" > /etc/hostname and echo "DOMAINNAME=asdf" > /etc/domainname. After a reboot and a hostname --fqdn it still wont work. I did remove the HOSTNAME portion from the /etc/sysconfig/network file.

homey 01-22-2005 06:48 AM

Type the command: neat . That will open up a small gui tool where you can setup the hostname, domainname and dns servers.

RHELL 01-22-2005 03:59 PM

>I tried adding a DOMAINNAME=adomainname and it dosent work >so i'm thinking that the domainname and dnsdomainname isnt >help in this file.

DOMAINNAME in this context refers to NIS domain. Using an FQDN for hostname should allow your system to deduce the DNS domain.

As mentioned above, neat will work nicely, but you may not learn anything.

xemous 01-23-2005 06:50 PM

And thats why I'm not to keen on using it. Thanks for the advice anyway.

alwanza 12-16-2009 01:21 PM

re: changing hostname, dnsdomainname, domainname permanently
 
Reminder: unless you have physical access to the server you should be very careful about changing network configurations.

Changing your hostname, domainname, and dnsdomainname is variable depending upon your linux distro (and possibly version) and what you are using the server for.

A good start might be to use a find with grep in /etc to find your current hostname (etc).

determine your current hostname with the hostname command, then use a find-grep something like this:

find /etc -type f print0|xargs -0r grep 'current hostname'

In general, you will need to make changes in
* the hosts file (/etc/hosts),
* the network file (on my machine /etc/sysconfig/network),
* the file that resolves your dns (and tells your server which domain to search first) (on my machine /etc/resolv.conf)

But there are other files you will also need to change depending on what you use your server for:
Web server? check files in /etc/httpd/conf and /etc/httpd/conf.d (or the equivalent on your distro)
Mail server? check files in /etc/mail - you may need to rebuild your access database and then your sendmail config
And of course if you are using NIS, you'll need to check your nis-related files (aka yp files)

After changing config files, remember to restart appropriate services so that your server "reads" these files - or reboot the server.

Some time later, check your logs in /var/log to see if there are errors indicating that some configuration file was not properly reconfigured.


All times are GMT -5. The time now is 05:24 PM.