Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 10-02-2008, 02:35 PM   #1
LQ Newbie
Registered: Oct 2008
Posts: 2

Rep: Reputation: 0
Hostname issue - showing "localhost" instead of actual hostname.

So I've been having this problem for a few days and have searched and read through pretty much everything I could find regarding the issue and still can't get it to work. Hoping to find some help here.

Hostname issues...when I telnet into my server on port 25, it reports the hostname as being localhost:

220 localhost SMTP; Thu, 02 Oct 2008 14:21:03 -0500

I have changed the hostname on the server in just about every place I can imagine.

[root@weboflearning ~]# hostname

# Do not remove the following line, or various programs
# that require network functionality will fail.
::1 localhost.localdomain localhost weboflearning localhost


Still, everytime I telnet in, it says localhost no matter what. Maybe I have something configured wrong? Any expert help on the matter would be greatly appreciated, as I'm starting to get pretty frustratd with it. Thanks in advance.


Oops - forgot to mention I'm running CentOS 5.2

Last edited by ryes31; 10-02-2008 at 02:36 PM. Reason: update OS version
Old 10-02-2008, 03:05 PM   #2
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 542

Rep: Reputation: 33
Assuming you restarted networking after each of these changes.

What do you get if you telnet to yourself from that server?

It appears you've set the hostname in all the right places.

I just did:
[/etc]# telnet 25
Connected to
Escape character is '^]'. ESMTP Exim 4.69 #1 Thu, 02 Oct 2008 14:58:14 -0400
220-We do not authorize the use of this system to transport unsolicited,
220 and/or bulk e-mail.

I did this from the server.
Old 10-02-2008, 03:12 PM   #3
LQ Newbie
Registered: Oct 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Yeah I did restart the network after making each change.
I get the same thing when I telnet to myself from inside the server-

[root@weboflearning /]# telnet 25
Connected to (
Escape character is '^]'.
220 localhost SMTP; Thu, 02 Oct 2008 15:04:58 -0500

Still can't figure out why it might be doing this when the hostname is set permanently. It's gotta be some simple fix right in front of my face that I'm going to kick myself for later.
Old 10-02-2008, 03:29 PM   #4
Senior Member
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Originally Posted by ryes31 View Post
Still, everytime I telnet in, it says localhost no matter what. Maybe I have something configured wrong? Any expert help on the matter would be greatly appreciated, as I'm starting to get pretty frustratd with it. Thanks in advance.
When I change the hostname, I run
find /etc -name '*' -exec grep -H localhost '{}' ';'
and change everything manually to the new hostname. But that is because I have had so much trouble changing the hostname on other RedHat variants.
Old 10-02-2008, 06:34 PM   #5
Senior Member
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,170

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
From whence are you "teleneting in?" Perhaps what you're seeing is the host name of the telenet source, not of the destination. (Note: I haven't used telenet for 20 years, so that's just a guess.)
Old 10-02-2008, 08:35 PM   #6
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,701

Rep: Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566Reputation: 566
What SMTPd are you running? Does it have a "myhostname" configuration? Postfix does.
Old 10-02-2008, 08:47 PM   #7
LQ Guru
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
What MTA are you telnetting into - postfix or sendmail (or something else)?

What is the output of the hostname command?

FYI, the hostname is set in /etc/sysconfig/network with the line

Last edited by billymayday; 10-02-2008 at 08:50 PM.
Old 12-06-2012, 11:26 AM   #8
LQ Newbie
Registered: Dec 2012
Posts: 1

Rep: Reputation: Disabled
If someone happens upon this looking for an answer...

Make sure you have the appropriate line in your /etc/resolv.conf for your domain, this fixed it for me.

search your-domain.whatever

Old 12-12-2012, 05:51 PM   #9
Registered: Oct 2011
Location: New Delhi
Posts: 221
Blog Entries: 3

Rep: Reputation: 16
try this one

echo "" > /proc/sys/kernel/hostname

& also check the resolv.conf
Old 12-12-2012, 09:19 PM   #10
LQ Newbie
Registered: Sep 2012
Location: Tonawnada, NY
Distribution: CentOS Redhat ubuntu mint
Posts: 15

Rep: Reputation: Disabled
Telnet is an xinetd or is it the date inetd service, that may need a restart or it could be that the mailer daemon needs a restart. I would that is read at start up by either or both.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Mandriva 2008 boot stalls on "setting hostname localhost:" on HPdv9700t cmack43 Linux - Laptop and Netbook 0 02-24-2008 08:00 PM
startx fail , error shown "hostname: Unknown host " syseeker Red Hat 4 07-05-2006 12:40 PM
How to change prompt hostname "localhost"? Arodef Fedora 3 08-02-2004 07:45 AM
/var/log/messages contains "localhost" instead of the real hostname allel Linux - Networking 0 07-15-2002 03:49 PM

All times are GMT -5. The time now is 03:18 PM.

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