LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-08-2006, 07:59 AM   #1
ChrisR(SQL DBA)
Member
 
Registered: Sep 2004
Posts: 43

Rep: Reputation: 15
Does my host name change due to DHCP?


Howdy all. When I installed CentOS 4, I don't think I assigned a host name. That beign said, would my host name then be the ip address? But it gets worse....

My ip address has since changed due to dhcp. When I go into the terminal, I am connected as user@ip22-22-22-22(not really all 2's). The address is my new address, not the address I had when I originally installed the OS. So as near as I can tell, the host name was assigned the IP address, and changed when the IP changed. Is that the case?
 
Old 12-08-2006, 08:04 AM   #2
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
Hi there,

A hostanme is typically ComputerName.Domain, if you assigned a computername that would be the hostname. When you are connected at a terminal is it showing your internal ip address, or are you talking about ssh from the outside?, just asking because this is what I commonly see. Not too sure about CentOS though. On my Slackware box I have /etc/HOSTNAME, do you have the same?

Last edited by lord-fu; 12-08-2006 at 08:07 AM.
 
Old 12-08-2006, 08:06 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
You assign the hostname, and dhcp assigns the IP **to that name**. DHCP is not going to change your hostname.

When you do assign a hostname, don't make it like an IP--that would have the potential of really confusing the SW--not to mention the operator of the computer. Just name the computer after your favorite pet, girlfriend, etc.
 
Old 12-08-2006, 08:10 AM   #4
ChrisR(SQL DBA)
Member
 
Registered: Sep 2004
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by lord-fu
Hi there,

A hostanme is typically ComputerName.Domain, if you assigned a computername that would be the hostname. When you are connected at a terminal is it showing your internal ip address?, just asking because this is what I commonly see. Not too sure about CentOS though.

Sorry, I should have specified this as well. When I log in/ out I see ip.domainName in the lower right corner, which is another reason I suspected it as being the host name. Regardless, I just found out that ipconfig is not universal, and was wondering if there is a way for me to determine my host name?
 
Old 12-08-2006, 08:24 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
the hostname command will do it.

On my machine, it is in a file named /etc/hostname. It also appears in /etc/hosts

To change it, I **think** you need to change both files. (But look first in the GUI network setup)

What do you mean "ipconfig is not universal"?
 
Old 12-08-2006, 08:34 AM   #6
ChrisR(SQL DBA)
Member
 
Registered: Sep 2004
Posts: 43

Original Poster
Rep: Reputation: 15
I mean I ran ipconfig and it said "command not found" (its a windows command).

I ran the hostname command (thanks for the tip) and it gave me back:

ip22-222-222-222.domainName.net (not really all 2's)

Is that my host name?
 
Old 12-08-2006, 08:40 AM   #7
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
ifconfig is what you want.
As I said in my post and pixellany mentioned, try /etc/HOSTNAME.

Last edited by lord-fu; 12-08-2006 at 08:42 AM.
 
Old 12-08-2006, 08:40 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
In Linux it is "ifconfig"

The complete hostname is name.domain but at least on my system, hostname just gives the name. Perhaps you have told your machine that "name" is really "name.domain"

Look in /etc/hosts and you will see something like this:
127.0.0.1 localhost.localdomain localhost mepis1
These are all aliases for the hostname

Please post the content of your /etc/hosts file

Again, you don't want an IP address for a hostname
 
Old 12-08-2006, 08:45 AM   #9
ChrisR(SQL DBA)
Member
 
Registered: Sep 2004
Posts: 43

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by lord-fu
Hi there,

On my Slackware box I have /etc/HOSTNAME, do you have the same?
Sorry, I just noticed you question. No, I have /etc/hosts, which only contains the entry:

127.0.0.1 localhost.localdomain localhost
 
Old 12-08-2006, 08:48 AM   #10
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by ChrisR(SQL DBA)
Sorry, I just noticed you question. No, I have /etc/hosts, which only contains the entry:

127.0.0.1 localhost.localdomain localhost
This will need to include whatever is in hostname---which, in turn, should be just one simple short word.

Did you try looking in the GUI network setup? Might be a lot easier than changing all the low-level files.
 
Old 12-08-2006, 02:27 PM   #11
ChrisR(SQL DBA)
Member
 
Registered: Sep 2004
Posts: 43

Original Poster
Rep: Reputation: 15
Thank you all for your efforts thus far. the only thing in my /etc/hosts file is:

127.0.0.1 localhost.localdomain localhost

Also, I found a GUI Network Config tool, and under Hostname it says "localhost.localdomain".

These two things, plus the fact that I didn't assign a name during install, is leading me to beleive the name is acutally "localhost". Is this correct?
 
Old 12-08-2006, 02:52 PM   #12
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by ChrisR(SQL DBA)
Thank you all for your efforts thus far. the only thing in my /etc/hosts file is:

127.0.0.1 localhost.localdomain localhost

Also, I found a GUI Network Config tool, and under Hostname it says "localhost.localdomain".

These two things, plus the fact that I didn't assign a name during install, is leading me to beleive the name is acutally "localhost". Is this correct?
I think maybe "localhost" is some kind of default. What does the command hostname say?

Actually, that command may be how you CHANGE the hostname---YES!! check man hostname for how to change your hostname at the CLI.
 
Old 12-08-2006, 04:10 PM   #13
ChrisR(SQL DBA)
Member
 
Registered: Sep 2004
Posts: 43

Original Poster
Rep: Reputation: 15
I changed it both using Hostname, and using the GUI, and it is for sure now named what I want.

Thanks to all!
 
Old 12-08-2006, 04:19 PM   #14
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Yea!!!--we love happy endings
 
  


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
How To know if a host configured with DHCP has obtained IP address from DHCP server? Prassanta SUSE / openSUSE 1 06-29-2006 09:48 AM
can't DHCP, i think due to ioctl's busy(?). sis900 NIC, linksys router, 2.4 kernel FirebirdV0273 Linux - Networking 2 02-11-2006 03:43 PM
Delay due to DHCP in boot pymehta Linux - Networking 2 09-15-2005 08:08 AM
why DHCP client not sending own host name in DHCP request packet? sonika_singhi Linux - Networking 7 05-28-2005 05:18 AM
change in resolution due to driver zexter Linux - General 1 11-01-2003 10:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:07 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