posted 24 years ago
Just to make sure this is as clear as possible; "localhost" is a special name which always refers to the machine itself. Some operating systems (ie Windows) enforce this, some (ie Linux) may allow you to change it (but that would be a mad thing to do!).
A machine on a network is known by several things. To itself it is known by the name "localhost" and the special IP address "127.0.0.1". To all machines on the network it is known by whatever other names and IP addresses it may have been assigned.
As a concrete example. I have a Linux machine on my home network which acts as a dial-up router, web server, DNS server, DHCP server, mail host and general box. To itself it is "localhost" and "127.0.0.1". In its "hostname" it has the name "aylesbury". Its primary IP address is "172.16.1.4". In its "domain" it has "efsol.com". From my other machines on the network, I can refer to this machine as "aylesbury", "aylesbury.efsol.com", or "172.16.1.4".
When it dials up the internet it is dynamically assigned an extra name and IP address by the remote system, so it may also be something like "modem456.ntl.com" and "199.1.2.4" I never use this name or address (it changes every time I connect up), but it is still there while I'm connected.