Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 01-21-2005, 02:41 PM   #1
Registered: Jun 2004
Location: Australia, Melbourne.
Distribution: Ubuntu
Posts: 80

Rep: Reputation: 15
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.

Old 01-21-2005, 05:48 PM   #2
Senior Member
Registered: Jan 2004
Location: Slovenia
Distribution: Slackware 10.1, SLAX to the MAX :)
Posts: 1,040

Rep: Reputation: 45
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.
Old 01-22-2005, 05:04 AM   #3
Registered: Jun 2004
Location: Australia, Melbourne.
Distribution: Ubuntu
Posts: 80

Original Poster
Rep: Reputation: 15
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.
Old 01-22-2005, 07:48 AM   #4
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
Type the command: neat . That will open up a small gui tool where you can setup the hostname, domainname and dns servers.
Old 01-22-2005, 04:59 PM   #5
Registered: Feb 2004
Location: Outermost mingetty
Distribution: RHEL3,RH4U4,Sol9, Sol10
Posts: 321

Rep: Reputation: 31
>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.
Old 01-23-2005, 07:50 PM   #6
Registered: Jun 2004
Location: Australia, Melbourne.
Distribution: Ubuntu
Posts: 80

Original Poster
Rep: Reputation: 15
And thats why I'm not to keen on using it. Thanks for the advice anyway.
Old 12-16-2009, 02:21 PM   #7
LQ Newbie
Registered: Aug 2008
Location: Seattle Washington
Distribution: RH,Ubuntu,SUSE (so far)
Posts: 1

Rep: Reputation: 0
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.

Last edited by alwanza; 12-16-2009 at 02:26 PM. Reason: clarification, grammar



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc/hosts, hostname, and dnsdomainname questions rdmenotte Linux - Software 9 03-28-2015 05:27 AM
Want to set hostname permanently on new fedora install DPenguin Linux - Newbie 2 02-04-2005 03:31 PM
postfix uses hostname, not domainname dmarkow Linux - Networking 1 10-13-2003 03:41 AM
hostname/domainname/postfix setup with dynamic DNS from no-ip tesauce98 Linux - Software 10 09-17-2003 02:01 PM
Permanently change the hostname juby Linux - Software 13 05-10-2003 01:34 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:32 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration