Discussion:
localhost.localdomain
Daniel Nilsson
2003-05-14 08:59:38 UTC
Permalink
Hi all,

My RedHat-installs has the following line in /etc/hosts (host1 is the
real hostname):

127.0.0.1 host1 localhost.localdomain localhost

Im running sendmail as null-client.
All root mail comes from ***@local.localdomain because sendmail thinks
this is the domain of the machine.

I see 2 solutions to this problem.

A) configure sendmail with the correct domainname. Not a very good idea,
this should be configured correctly by the OS I think.

B) change /etc/hosts to:

127.0.0.1 localhost.localdomain localhost
192.168.0.2 host1 host1.domain.com

To get the real hostname and the real FQDN tied to the real IP.

Comments? Why does RedHat use localhost.localdomain? And why is the
hostname set on 127.0.0.1 and not on the real ip?

Daniel
John
2003-05-14 09:16:50 UTC
Permalink
Post by Daniel Nilsson
Hi all,
My RedHat-installs has the following line in /etc/hosts (host1 is the
127.0.0.1 host1 localhost.localdomain localhost
Im running sendmail as null-client.
this is the domain of the machine.
I see 2 solutions to this problem.
A) configure sendmail with the correct domainname. Not a very good idea,
this should be configured correctly by the OS I think.
127.0.0.1 localhost.localdomain localhost
192.168.0.2 host1 host1.domain.com
To get the real hostname and the real FQDN tied to the real IP.
Comments? Why does RedHat use localhost.localdomain? And why is the
hostname set on 127.0.0.1 and not on the real ip?
How is this a kickstart issue?
--
Please, reply only to the list.

Join the "Linux Support by Small Businesses" list at
http://mail.computerdatasafe.com.au/mailman/listinfo/lssb
Jason Kohles
2003-05-14 13:45:04 UTC
Permalink
Post by Daniel Nilsson
Comments? Why does RedHat use localhost.localdomain? And why is the
hostname set on 127.0.0.1 and not on the real ip?
If your hostname is on the 127.0.0.1 line it means either you didn't configure
networking during the install, or the ip address you configured wasn't
resolvable by that host at that time.
--
Jason Kohles A witty saying proves nothing.
***@jasonkohles.com -- Voltaire (1694 - 1778)
http://www.jasonkohles.com/
John Beamon
2003-05-14 14:56:25 UTC
Permalink
Post by Jason Kohles
Post by Daniel Nilsson
Comments? Why does RedHat use localhost.localdomain? And why is the
hostname set on 127.0.0.1 and not on the real ip?
If your hostname is on the 127.0.0.1 line it means either you didn't configure
networking during the install, or the ip address you configured wasn't
resolvable by that host at that time.
Actually, I've seen this as well. I can manually install and specify a
static IP, and the only place it goes is
/etc/sysconfig/network-scripts/ifcfg-eth0. This is a valid point, IMHO.

-j
Jason Kohles
2003-05-15 02:04:33 UTC
Permalink
Post by John Beamon
Actually, I've seen this as well. I can manually install and specify a
static IP, and the only place it goes is
/etc/sysconfig/network-scripts/ifcfg-eth0. This is a valid point, IMHO.
Which means the machine was not able to resolve the ip address you entered,
this is the code that writes /etc/hosts during install:

# /etc/hosts
f = open(instPath + "/etc/hosts", "w")
localline = "127.0.0.1\t\t"

log("self.hostname = %s", self.hostname)

ip = self.lookupHostname()

# If the hostname is not resolvable, tie it to 127.0.0.1
if not ip and self.hostname != "localhost.localdomain":
localline = localline + self.hostname + " "
l = string.split(self.hostname, ".")
if len(l) > 1:
localline = localline + l[0] + " "

localline = localline + "localhost.localdomain localhost\n"
f.write("# Do not remove the following line, or various programs\n")
f.write("# that require network functionality will fail.\n")
f.write(localline)

if ip:
f.write("%s\t\t%s\n" % (ip, self.hostname))

If the hostname you entered was not resolvable to an ip address, then it
will get associated with the localhost address in /etc/hosts.
--
Jason Kohles A witty saying proves nothing.
***@jasonkohles.com -- Voltaire (1694 - 1778)
http://www.jasonkohles.com/
Daniel Nilsson
2003-05-15 12:54:00 UTC
Permalink
This code includes a call to self.lookupHostname(), this function totally
trashes /etc/resolv.conf in the anaconda-ramdisk and it will only work i
hostname i set to FQDN.

I have posted this to anaconda-devel-list, and think its a bug.

/// D
Post by Jason Kohles
Which means the machine was not able to resolve the ip address you entered,
# /etc/hosts
f = open(instPath + "/etc/hosts", "w")
localline = "127.0.0.1\t\t"
log("self.hostname = %s", self.hostname)
ip = self.lookupHostname()
# If the hostname is not resolvable, tie it to 127.0.0.1
localline = localline + self.hostname + " "
l = string.split(self.hostname, ".")
localline = localline + l[0] + " "
localline = localline + "localhost.localdomain localhost\n"
f.write("# Do not remove the following line, or various programs\n")
f.write("# that require network functionality will fail.\n")
f.write(localline)
f.write("%s\t\t%s\n" % (ip, self.hostname))
If the hostname you entered was not resolvable to an ip address, then it
will get associated with the localhost address in /etc/hosts.
Loading...