LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-21-2005, 01:41 PM   #1
xemous
Member
 
Registered: Jun 2004
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.

Cheers.
 
Old 01-21-2005, 04:48 PM   #2
marghorp
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, 04:04 AM   #3
xemous
Member
 
Registered: Jun 2004
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, 06:48 AM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
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, 03:59 PM   #5
RHELL
Member
 
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, 06:50 PM   #6
xemous
Member
 
Registered: Jun 2004
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, 01:21 PM   #7
alwanza
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 01:26 PM. Reason: clarification, grammar
 
  


Reply

Tags
hostname



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 04:27 AM
Want to set hostname permanently on new fedora install DPenguin Linux - Newbie 2 02-04-2005 02:31 PM
postfix uses hostname, not domainname dmarkow Linux - Networking 1 10-13-2003 02:41 AM
hostname/domainname/postfix setup with dynamic DNS from no-ip tesauce98 Linux - Software 10 09-17-2003 01:01 PM
Permanently change the hostname juby Linux - Software 13 05-10-2003 12:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:54 PM.

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