LinuxQuestions.org
Help answer threads with 0 replies.
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 04-09-2004, 01:01 AM   #1
karlovac
LQ Newbie
 
Registered: Mar 2004
Posts: 25

Rep: Reputation: 15
What to do after changing /etc/hosts/?


I just moved a server I was setting up from my work network to a colo. The helpful guy at the colo set up networking there, so it's working fine now.

However the hostname is messed up. At work, I named the server "antunsbox", since it was on the internal network, so /etc/hosts used to look like this (spaces have been added because the forums won't let me post anything that looks like a link):

Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost . localdomain localhost
192.168.1.8            antunsbox antunsbox. workdomail .com
             antunsbox antunsbox
Now it looks like this:

Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost . localdomain localhost
123.123.123.123            domaon.com www.domain.com
#192.168.1.8            antunsbox antunsbox.workdomain.com
#             antunsbox antunsbox
So I've commented out the old domain in /etc/hosts/, but what do I need to restart for it to take effect, bearing in mind I don't have full-time physical access to the server now)?

Thanks,

Antun

Last edited by karlovac; 01-16-2005 at 02:37 PM.
 
Old 04-09-2004, 01:53 AM   #2
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
my /etc/host file
127.0.0.1 linux.domain.com linux localhost.localdomain.com

if its needed, edit /etc/sysconfig/network to change your host name
 
Old 04-09-2004, 06:02 AM   #3
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
Changes in the /etc/hosts file take effect immediately.
 
Old 04-09-2004, 07:22 AM   #4
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
oopps sorry, i type the contents of my /etc/hosts file wrongly.

[mesut@linux mesut]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 linux.domain.com linux localhost.localdomain localhost
 
Old 04-09-2004, 09:59 AM   #5
karlovac
LQ Newbie
 
Registered: Mar 2004
Posts: 25

Original Poster
Rep: Reputation: 15
But when I do:

$ hostname

I still get the old hostname ("antunsbox").

Although as you can see I've commented out the antunsbox line from /etc/hosts. Also, if I do:

$hostname -i

I get:

hostname: Unknown host

... shouldn't I get my IP address?

-Antun

Quote:
Originally posted by ugge
Changes in the /etc/hosts file take effect immediately.
 
Old 04-09-2004, 10:03 AM   #6
jsokko
Member
 
Registered: Mar 2004
Location: Phila, PA
Distribution: SuSE 9.0 / RH 9 / Slackware 9.1
Posts: 110

Rep: Reputation: 15
either reboot or restart your network connection... that should show you the right hostname.
 
Old 04-09-2004, 10:09 AM   #7
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
The /etc/hosts file has nothing to do woth your hostname. The /etc/hosts file list the different hosts on your network, inkluding your own.
The hostname of your machine is set using the hostname command. This is a temporary change of hostname and has to be set in the config scripts in /etc/sysconfig/network
Change HOSTNAME=<new hostname>
 
Old 04-10-2004, 02:18 AM   #8
karlovac
LQ Newbie
 
Registered: Mar 2004
Posts: 25

Original Poster
Rep: Reputation: 15
I've updated /etc/sysconfig/network to read:

HOSTNAME=www.lumeneo.com

I've also updated /etc/hosts and /etc/sysconfig/networking/profiles/default/resolv.conf, and removed any reference to "antunsbox".

I've restarted networking using:

/etc/rc.d/init.d/network/ restart

... and I restarted:

/etc/rc.d/init.d/named restart

(Not sure if that one had anything to do with this issue). However the machine still thinks it's called antunsbox.

Then I went into /etc/ and did:

find . -type f -exec grep -H antunsbox {} \;

... to look for any files that have antunsbox in them. A bunch in /etc/httpd turned up, some in printcap and one in mail. None of these appeared relevant. One other file turned up: /etc/detectchanges/hostname (all it contained was one word: antunsbox), but I'm not quite sure what this file is for. (I'm running Fedora Core).

If I change hostname in /etc/sysconfig/network, do I still have to change it using the command hostname?

-Antun


Quote:
Originally posted by ugge
The /etc/hosts file has nothing to do woth your hostname. The /etc/hosts file list the different hosts on your network, inkluding your own.
The hostname of your machine is set using the hostname command. This is a temporary change of hostname and has to be set in the config scripts in /etc/sysconfig/network
Change HOSTNAME=<new hostname>
 
Old 04-10-2004, 05:24 PM   #9
ugge
Senior Member
 
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
You may have to log out and log in again for the hostname to show up in the prompt.
 
Old 07-05-2007, 09:57 AM   #10
briealeida
Member
 
Registered: Jun 2007
Location: PA
Distribution: FreeBSD, Ubuntu, Knoppix,
Posts: 41

Rep: Reputation: 16
I was at the same point. Rebooted the machine. Still no change. What did you end up doing?
 
Old 07-05-2007, 10:25 AM   #11
Crito
Senior Member
 
Registered: Nov 2003
Location: Knoxville, TN
Distribution: Kubuntu 9.04
Posts: 1,168

Rep: Reputation: 53
Red Hat's system-config-network command works for me. There are actually three palces hostnames appear:
1) On DNS tab.
2) In DHCP section of device settings.
3) The hosts file tab.
 
Old 07-05-2007, 10:49 AM   #12
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
You could follow this simple guide to make sure you've tested and hit everything you need to set the hostname properly..

http://www.cpqlinux.com/hostname.html
 
  


Reply



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
Changing Hostname.../etc/hosts...? vous Linux - Networking 13 01-16-2008 08:38 PM
External Hosts Resolve but Local Hosts Do Not kjm9 Linux - Networking 7 11-19-2005 03:51 PM
hosts.allow & hosts.deny question... jonc Linux - Security 9 03-05-2005 09:41 PM
Adding shell commands to hosts.deny and hosts.allow ridertech Linux - Security 3 12-29-2003 03:52 PM
hosts.deny and hosts.allow defaults? gui10 Linux - Security 5 12-20-2001 01:57 AM

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

All times are GMT -5. The time now is 05:23 AM.

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