LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-28-2002, 07:09 PM   #1
Rampage2884
Member
 
Registered: Mar 2002
Posts: 84

Rep: Reputation: 15
Hostname: Unknown Host ?? I'm very confused


When the computer boots up and it shows me the login prompt and when i put my l/p in, it then says "Hostname: Unknown Host ". What does this exactly mean. I thought the hostname is your ip address, and with a wrong ip address, you will have no access to the internet but my internet does work.

What exactly is a hostname, and is it actually useful.? BTW, when i run "neat", and look under host, it says hostname --> 127.0.0.1. Now, isn't that number suppost to be your ip address?

Here is my hosts file;

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost

Is everything correct?


I appreciat any help.
 
Old 04-28-2002, 11:27 PM   #2
lnxconvrt
Member
 
Registered: Mar 2002
Location: Houston
Distribution: FC3, Manrake 10.x, various others at times
Posts: 113

Rep: Reputation: 18
hostname command

The "hostname" command will show you your hostname, which is simply the name of your computer. So that, for instance, you might "telnet bigdog" if "bigdog" was the name of a computer you wanted to telnet to. The hostname just gives a computer a name which maps to its ip address.

Some distros will ask for a hostname when you're installing. I'm thinking that this may go into several files besides /etc/hosts, and some distros also have a graphical tool to change/add a hostname.

127.0.0.1 is the "loopback address" for a network adapter, NOT its real ip. Try the ifconfig command to see your ip address. Your ip may not be fixed if you're connecting directly to the internet, rather than through a router. That is, it may change from time to time, especially with dial-up internet access. Usually you'll get your ip through DHCP in this case (given to your computer by your ISP's DHCP server).

Does this clarify things for you?
 
Old 04-29-2002, 07:06 AM   #3
Rampage2884
Member
 
Registered: Mar 2002
Posts: 84

Original Poster
Rep: Reputation: 15
Quote:
The "hostname" command will show you your hostname, which is simply the name of your computer. So that, for instance, you might "telnet bigdog" if "bigdog" was the name of a computer you wanted to telnet to. The hostname just gives a computer a name which maps to its ip address.
PERFECT, now I understand the host thing.

Quote:
127.0.0.1 is the "loopback address" for a network adapter, NOT its real ip
Why would it have a "loopback" address? What is the reason for this?





BTW, thanks for the great info and help lnxconvrt
 
Old 04-29-2002, 08:52 AM   #4
lnxconvrt
Member
 
Registered: Mar 2002
Location: Houston
Distribution: FC3, Manrake 10.x, various others at times
Posts: 113

Rep: Reputation: 18
ping 127.0.0.1

One use of the loopback address is to test your NIC (network interface card). If you can't ping another address or your gateway (the router or computer that you go through to access computers not on your local subnet), then you can "ping 127.0.0.1". A successful response indicates that you at least have the tcp/ip protocol bound to your adapter.

Failure would probably mean that the NIC is not properly installed under the OS that you're running. Essentially you've pinged yourself, with failure meaning that you likely have a hardware installation issue rather than a network issue.
 
Old 04-29-2002, 08:44 PM   #5
Rampage2884
Member
 
Registered: Mar 2002
Posts: 84

Original Poster
Rep: Reputation: 15
Thanks for the help lnxconvrt.

There is only one thing, how can I change my hostname? This is what I got in my /etc/hosts file;


# Do not remove the following line, or various programs
# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost
**.***.**.** penguinbox.localdomain penguinbox


where * is my IP address.

What is wrong with this??


When I type hostname, i get this ----> x1-2-41-03-5a-59-27-3g
 
Old 04-30-2002, 12:56 AM   #6
lnxconvrt
Member
 
Registered: Mar 2002
Location: Houston
Distribution: FC3, Manrake 10.x, various others at times
Posts: 113

Rep: Reputation: 18
Quote:
Originally posted by Rampage2884

There is only one thing, how can I change my hostname? This is what I got in my /etc/hosts file;
What distro are you using?

I have 127.0.0.1 localhost followed by

192.168.1.101 myhostname.mydomainname (don't want to use the real name here). The 192.168.1.x is a private ip setup that I use for my computers on my home network, as I am separated from the internet by my router, which has a public ip assigned via DHCP from my ISP.

What the heck did I just say? Let me elaborate, just in case you need it, and apologies in advance if you don't and the explanation is boring. DHCP is when a server (like your isp's) tells your computer what ip to use. It's expensive to get a public ip (internet accessible) reserved, so ISPs lease you one temporarily through their DHCP server when you go online.

Your computer may have a public ip if you're directly connected to the internet, rather than via router. Basically, anything that doesn't start with 10. or 172. or 192. is a public ip.

To find out, type ifconfig from a terminal window. You may have to be root. Type "su -" followed by the root password when prompted.

Quote:

**.***.**.** penguinbox.localdomain penguinbox


DId you put that in? Maybe when your install program asked for a name for your computer?

Quote:

When I type hostname, i get this ----> x1-2-41-03-5a-59-27-3g
I have no clue--it looks sorta like a mac address. A what??? A mac address is the actual "physical" address of your network adapter...unique for every network adapter (or NIC if you prefer that term) in the world. Somehow you don't have a hostname set, I guess. Again, what distro? If Red Hat or SuSE I can probably find a graphical tool for you to set it with since, as I previously indicated, I think it may need to be in more than the hosts file.

BTW, I think that this question is raised in several other threads...you might look around the forums also.
 
Old 04-30-2002, 01:59 AM   #7
udayan
Member
 
Registered: Apr 2002
Location: India
Distribution: Linux Redhat 7.0
Posts: 62

Rep: Reputation: 16
login is not ip address

you dont put your ip address but your login name which is there. It can be login: root and then it'll ask for password.
 
Old 04-30-2002, 03:20 AM   #8
DMR
Member
 
Registered: Jun 2001
Location: Fairfax, California
Distribution: RH 9.0, RH 7.3, Mandrake 8.0
Posts: 986

Rep: Reputation: 30
Quote:
Originally posted by Rampage2884
This is what I got in my /etc/hosts file;

# Do not remove the following line, or various programs
# that require network functionality will fail.

127.0.0.1 localhost.localdomain localhost
**.***.**.** penguinbox.localdomain penguinbox
Hmm, Should I be flattered that someone is snarfing my box's hostname?
Code:
[root@penguinbox/sbin]# cat /etc/hosts
127.0.0.1       localhost.localdomain   localhost
192.168.0.2     penguinbox.localdomain  penguinbox


Look in /etc/sysconfig/network and see what's listed in the "HOSTNAME=" line; that is the network hostname that is actually being used by you machine; make sure it's correct, and that the line in /etc/hosts matches that.
 
Old 04-30-2002, 01:20 PM   #9
Rampage2884
Member
 
Registered: Mar 2002
Posts: 84

Original Poster
Rep: Reputation: 15
DMR, ROFLMAO

What are the chances.

Well, I got everything to work, thanks guys.
 
Old 04-30-2002, 02:45 PM   #10
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
side note: 127.0.0.1 is also useful for testing out your network programs if you dont have access to another computer on your network or not connected to a network. That's where i 1st learned about the loopback.
 
Old 04-30-2002, 04:19 PM   #11
gamernewbie
LQ Newbie
 
Registered: Apr 2002
Location: Sun Valley
Posts: 1

Rep: Reputation: 0
Well you can call it a loopback but it's not the NIC you are pinging you are pinging your own tcp/ip stack to see if it is live. Just wanted to add my 2 cents. I am one when it comes to LINUX but I do know windows and Netowrking I am here to learn the LINUX OS and hopefully learn how to configure my RedHat 7.2 for connectivity with a Linksys Router. Hasn't worked yet.
 
Old 04-30-2002, 04:26 PM   #12
DMR
Member
 
Registered: Jun 2001
Location: Fairfax, California
Distribution: RH 9.0, RH 7.3, Mandrake 8.0
Posts: 986

Rep: Reputation: 30
Quote:
Originally posted by Rampage2884
DMR, ROFLMAO

What are the chances.
With all these penguins sprouting up around here, the chances are just getting better.

 
Old 11-10-2010, 07:18 AM   #13
anishmp123
LQ Newbie
 
Registered: Nov 2010
Posts: 1

Rep: Reputation: 0
Unkown Host Fix /etc/hosts

I had the same problem , I solved it as follows.

If the hostname required is 'myhostname' and the fully qualified
hostname required is 'myhostname.mydomain.mytld' the /etc/hosts should look like this :

127.0.0.1 myhostname.mydomain.mytld myhostname localhost

The /etc/hostname should have :
myhostname

Now
# hostname
myhostname
# hostname -f
myhostname.mydomain.mytld
 
  


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
Hostname Unknown - using wvdial/dialup connection Sader Linux - Networking 3 07-09-2005 04:37 AM
i m getting the error unknown host while im pinging with the host name gunjan thakkar Linux - General 2 12-14-2004 01:19 PM
unknown host hondaglx Linux - Networking 1 04-30-2004 11:02 PM
Unknown hostname on router ToTLaugher Linux - Networking 1 02-10-2004 03:04 PM
Unknown Host <Linuxmachinename> / Unable to ping by host name nishi_k_79 Linux - Networking 4 11-01-2003 01:24 PM

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

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