![]() |
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? |
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? |
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. |
Quote:
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? |
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"? |
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? |
ifconfig is what you want.
As I said in my post and pixellany mentioned, try /etc/HOSTNAME. |
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 |
Quote:
127.0.0.1 localhost.localdomain localhost |
Quote:
Did you try looking in the GUI network setup? Might be a lot easier than changing all the low-level files. |
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? |
Quote:
Actually, that command may be how you CHANGE the hostname---YES!! check man hostname for how to change your hostname at the CLI. |
I changed it both using Hostname, and using the GUI, and it is for sure now named what I want.
Thanks to all! |
Yea!!!--we love happy endings
|
All times are GMT -5. The time now is 07:35 PM. |