Julien Olivier wrote:
I'm very surprised, though, that your router gives you a different hostname every time, and isn't providing DNS services. Perhaps it does... Do you have the line:I'm sure that they have their reasons. But, I don't think that its required in /etc/hosts... Just reversible [that is, they can look up an IP address for your hostname].
Oh I see. Well, my DHCP server gives me the following hostname:
[root@rfc1918 julien]# hostname rfc1918.space.should.not.be.used.on.publicips
I think it's a weird hostname, and my modem probably does something wrong...
Anyway, such a hostname is probably not reversible unless I add it manually in /etc/hosts just next to 127.0.0.1, which works.
In my /etc/sysconfig/network file, I have the following:
NETWORKING=yes HOSTNAME=localhost.localdomain
Then, my /etc/hosts file has:
127.0.0.1 localhost.localdomain localhost
It works for me with DHCP.
I have exactly the same thing in /etc/sysconfig/network, but when the
eth0 connection is started, my hostname changes to this strange
"rfc1918.space.should.not.be.used.on.publicips".
PEERDNS=yes
in your /etc/sysconfig/network-scripts/ifcfg-eth0
If not, add it, and see what happens...
If you get the same behavior as before, then:
In the /etc/sysconf/network file, change localhost.localdomain to something else, like
my.own.private.hostname.com
Then, in you /etc/hosts file, add "my.own.private.hostname.com" to the 127.0.0.1 line, eg:
127.0.0.1 localhost.localdomain localhost my.own.private.hostname.com
This will prevent the DHCP client from asking the server for a hostname. Of course, if the router is giving you a different IP address every time, then home networking will be really messed up....
--
Keven Ring | "Oh no, Not Again..."
The MITRE Corporation | 7515 Colshire Drive | Bowl of Petunias -
McLean VA 22102-7508 | The Hitchhikers Guide to the Galaxy
PH: (703)883-7026 |