Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Distribution: FC3, Manrake 10.x, various others at times
Posts: 113
Rep:
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).
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?
Distribution: FC3, Manrake 10.x, various others at times
Posts: 113
Rep:
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.
Distribution: FC3, Manrake 10.x, various others at times
Posts: 113
Rep:
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.
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.
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.
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.
If the hostname required is 'myhostname' and the fully qualified
hostname required is 'myhostname.mydomain.mytld' the /etc/hosts should look like this :
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.