localhost hostname problem

Nifty Hat Mitch mitch48 at sbcglobal.net
Sat Jul 3 01:20:03 UTC 2004

On Sat, Jun 26, 2004 at 09:46:17PM -0600, Eric Diamond wrote:
> >From James Lawrence's reply to paul at sark.us on Saturday, June 26, 2004
> 6:07 PM:
> > 
> > Paul wrote:
> > 
> > >I'm having a devil of a time: running FC2 through eth0 RCA modem on 
> > >comcast.net.  That connection did something, now instead of being 
> > >localhost at login, I'm x1-6-04-4f-00 or something like that, which 
> > >happens to be the hw addy of the eth0.  How do I change this, or at 
> > >least nickname it, to get back to localhost?  I'm a newbie 
> > wanting to 
> > >learn! :)  Thanks.
> localhost at localdomain is not really a valid hostname in a networked
> environment. Comcast has strict internal guidelines requiring unique
> hostnames thoughout their network. They have set up their DHCP servers
> to force a unique hostname whenever they find a machine without one
> (either no name at all or one that is currently in use). I'm not sure
> which category they group localhost in, but since customers are not
> allowed to use it the distinction is mute.

Erik is correct.  note the '@' sign should be a dot.

The key thing here is that each network connection has a name
and that the system inherits a name almost as a side effect.

The first interesting line in /etc/hosts looks like:       localhost.localdomain  localhost

This line names the special case, local loopback interface (lo0).
i.e. lo0 is an interface:

One common edit of this line might look like.       localhost.localdomain  localhost box1.paul.localdomain box1

And now the system admin can use an alias "box1.paul.localdomain" or
"box1" for the system.  This may confuse things later but, the alias
maps back to the address and the localhost.localdomain name.
In the file "/etc/sysconfig/network" you might do this with a line
that looks like:

  or perhaps


When the system boots it picks up the host name and matches it
to a line in the hosts file (/etc/hosts;.  See /etc/sysconfig/network
and eventually all these other files too:


There may be hard links to /etc/hosts that should not be broken.
While exceptions apply, 
Some of us will see:


Note the same inode number:

   # ls -il /etc/sysconfig/networking/profiles/default/hosts /etc/hosts
   6734009 -rw-r--r--  2 root root 2619 Jun 16 07:30 /etc/hosts
   6734009 -rw-r--r--  2 root root 2619 Jun 16 07:30 /etc/sysconfig/networking/profiles/default/hosts

Timing is important.  Names and numbers for the important interfaces
mostly need to be in /etc/hosts to bootstrap the process.  X-server
connections will be made to so this must exist and be
correct.  Once connected to the internet the domain name service DNS
can look up additional host name and IP address pairs as needed.
Some of this can be discovered with a broadcast help packet
which is how DHCP works.

Next when you connect to Comcast, for your ethernet link, as the
connection process begins you first get an additional interface
activated (commonly eth0).  Next a dynamic host name process (DHCP)
fetches an IP address and the public name for this interface. It names
it and brings it up.  Other network hints for DNS and routing are
shared via this DHCP process.  If you did not name localhost via the
HOSTNAME variable you correctly can expect to get a host name that
looks like x1-6-04-4f-00 or something at this stage.

Now you have two named interfaces.  One name you appear to have
control of on lo0 and the other is assigned to you by your ISP
dynamically each time you connect on eth0. 

If you attempt to lookup the IP address associated with
box1.paul.localdomain you should get  If anyone else
attempts to look it up they will not get a good answer.  This is what I
mean that you appear to have control of the host name.

The x1-6-04-4f-00 or something name should work for both internal and
external connections.  It is this :x1-6-04-4f-00 or something" named
interface that your 'services' will use to connect to and from the
world.  The nature of DHCP is that this will change so you do not need
to write it down.  You should not  expect it to be a constant!

The HOSTNAME= line is important because it decides which name to use
for system services even if there are twohundredfortyfive named
network interfaces (chill, Linux does not support that many by default).

The key point is that you will commonly have two active network
connections: localhost.localdomain on lo0 and another on eth0,
genericname.yourisp.toplevel.  Again it is the interfaces that have

The devices lo0 and eth0 are only two of a long list of names for 
devices that map to a kernel device driver. On FC1 see /etc/modules.conf:

	alias   eth0 via-rhine

In FC2 see /etc/modprobe.conf:

	alias	eth0 via-rhine

If your hardware is different you will see different driver names.
If you have multiple network cards you can see multiple lines 
sort of like this:
   $ grep eth /etc/mod*
   /etc/modules.conf:alias eth0 via-rhine
   /etc/modules.conf:alias eth1 tulip

   The key thing to recall is that network connections have names.

<end part A, Lesson 1, chapter 1>

	T o m  M i t c h e l l 
	/dev/null the ultimate in secure storage.

More information about the users mailing list