You are not logged in.

#1 2009-09-16 19:01:41

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Incorrect Hostname

I followed the begineers guide on the Wiki and when I run the following command to verify my hostname, I get two different results and I don't know why...

[root@mail ~]# hostname
mail
[root@mail ~]# hostname -f
localhost.localdomain
[root@mail ~]#

I checked my /etc/hosts file and have the following:

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost mail
10.1.1.200     mail.mdg.army.mil          mail

# End of file

------------------

Anyone know why I don't get my proper FQDN when I run the 'hostname -f' command?


./

Offline

#2 2009-09-16 19:35:13

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: Incorrect Hostname

Check a few working /etc/hosts out there. Also, you want hostname -a to show your hostname cool


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#3 2009-09-16 20:10:28

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: Incorrect Hostname

When I run the command "localhost -a" I get the following:

[root@mail ~]# hostname -a
localhost mail

I can't find anything in the Wiki besides what it advised me to do and I did...


./

Offline

#4 2009-09-16 20:14:05

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: Incorrect Hostname

Yes, which is exactly what you have in your hosts file. Change that to whatever you want.


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#5 2009-09-16 20:19:43

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: Incorrect Hostname

toad wrote:

Yes, which is exactly what you have in your hosts file. Change that to whatever you want.

I guess I am confused because what you're saying or what I am gathering is conflicting with the Wiki.

Add your hostname, coinciding with the one specified in /etc/rc.conf, as an alias, so that it looks like this:

127.0.0.1   localhost.localdomain   localhost [b]yourhostname[/b]

Obviously from the Wiki the bold section is to be changed accordingly to my server. Which I did so if my server is mail.iamghost.com, should I then do the following in /etc/hosts?

127.0.0.1 mail.ghost.org localhost.localdomain localhost mail

>?


./

Offline

#6 2009-09-16 20:24:50

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: Incorrect Hostname

Sorry, didn't want to be confusing. Here is my hosts file for my archtop laptop:

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1               localhost.localdomain   archtop

Now that _should_ make sense smile


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#7 2009-09-16 20:32:36

Carlwill
Member
From: Orlando, FL
Registered: 2008-10-06
Posts: 560
Website

Re: Incorrect Hostname

Thanks that does make sense but I still don't understand how to append the domain to your hostname. This is going to be a mail server so its mail.iamghost.com.

I am now getting:

[root@mail ~]# hostname
mail
[root@mail ~]# hostname -a
mail 
[root@mail ~]# hostname -f
localhost.localdomain

My file looks now as follows:

[root@mail ~]# cat /etc/hosts
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1        localhost.localdomain    mail
10.1.1.200        mail.iamghost.com    iamghost

# End of file

./

Offline

#8 2009-09-17 03:30:21

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: Incorrect Hostname

if you have a static ip-address, you don't put the name in 127.0.0.1 - thats only for dhcp!
Any 'server' _should_ have a static address.
So - your /etc/hosts _should_ be:

127.0.0.1  localhost
10.1.1.200 mail.iamghost.com mail

Offline

#9 2009-09-17 06:05:14

arunix
Member
From: /home/kurali
Registered: 2009-04-08
Posts: 93

Re: Incorrect Hostname

you should edit two files
first use this at your /etc/hosts

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1    <hostname>        localhost.localdomain    localhost

# End of file

and you have to chage in /ect/rc.conf

# -----------------------------------------------------------------------
# NETWORKING
# -----------------------------------------------------------------------
#
# HOSTNAME: Hostname of machine. Should also be put in /etc/hosts
#
HOSTNAME="<hostname>"

Minds are like parachutes. They only function when they are open.

Offline

#10 2009-09-23 15:24:14

ataraxia
Member
From: Pittsburgh
Registered: 2007-05-06
Posts: 1,553

Re: Incorrect Hostname

I had this problem, and solved it just now by reordering the names in /etc/hosts. Apparently order matters.
Before:

127.0.0.1      localhost.localdomain   localhost asenath.cc.cmu.edu asenath asenath.isam.vpn.cmu.local

After:

127.0.0.1      asenath.cc.cmu.edu asenath asenath.isam.vpn.cmu.local localhost.localdomain localhost

And now it works as expected:

ataraxia@asenath:/etc $ hostname 
asenath.cc.cmu.edu
ataraxia@asenath:/etc $ hostname -s
asenath
ataraxia@asenath:/etc $ hostname -f
asenath.cc.cmu.edu

Offline

#11 2009-09-23 18:37:28

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: Incorrect Hostname

As stated numerous times in this thread, the line beginning with 127.0.0.1 is the key to success smile


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#12 2009-09-24 00:09:16

perbh
Member
From: Republic of Texas
Registered: 2005-03-04
Posts: 765

Re: Incorrect Hostname

I beg to differ!
You use 127.0.0.1 if and only if you use dhcp.

If you have a fixed ip-address (which would seem to be the case here) then you _do_ _not_ put your hostname in 127.0.0.1 (infact - in several template hosts-file you will find a warning against it - quoting arnt gulbrandsen (redhat))

So - /etc/hosts should be

127.0.0.1  localhost
10.1.1.200 mail.iamghost.com mail

and /etc/rc.conf should have your hostname as 'mail'

Last edited by perbh (2009-09-24 00:10:21)

Offline

#13 2009-09-24 01:09:13

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Incorrect Hostname

But 127.0.0.1 is just the loopback address. What difference does it make where you are assigned a static or dhcp address?
I mean, even if you don't assign your computer an address at all, the loopback device still exists.


neutral

Offline

#14 2009-09-28 06:35:34

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: Incorrect Hostname

perbh:
You use 127.0.0.1 if and only if you use dhcp.

This is entirely new to me - sources? Indeed, once firefox wouldn't even consider working on my box because of a missing loopback. Anyway, I think we can agree that everybody can stick their loopback where they want to lol

perbh:
If you have a fixed ip-address (which would seem to be the case here) then you _do_ _not_ put your hostname in 127.0.0.1

I also have a fixed ip and again, this info is new to me (just about everything appears to be new to me...) and I will try it seeing that I've got my hostname in my rc.conf already.

Thanks for the tips.

EDIT:
This may be of use: http://wiki.archlinux.org/index.php/Con … _Static_IP

Last edited by toad (2009-09-28 06:43:13)


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

Board footer

Powered by FluxBB