Problem with DHCP, /etc/hosts and GNOME
Keven Ring
keven at mitre.org
Thu Apr 8 16:56:54 UTC 2004
Julien Olivier wrote:
>>>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".
>>>
>>>
>>>
>>>
>>I'm very surprised, though, that your router gives you a different
>>hostname every time, and isn't providing DNS services.
>>
>>
>
>Before going any further, I'd like to clarify something. My router
>always gives me the *same* hostname
>(rfc1918.space.should.not.be.used.on.publicips). And after I have added
>it in /etc/hosts, it works forever without needing to tweak anything.
>
>My problem was: why do I need to add it to /etc/hosts the first time ?
>Isn't it possible to make my system aware of the new hostname
>automatically (by adding it automatically to /etc/hosts after the first
>connection) ?
>
>Sorry if I confused you.
>
>(snip)
>
>
>
That's a little easier.... That's what DNS is for.....
/etc/hosts is there to remove the burden from DNS when things are
*KNOWN*, ie, static IP addresses and hostnames.
DHCP, by definition, is dynamic. Furthermore, a DHCP server [your
router] is under no obligation to provide you with the same ip address
every time you boot up [or worse, every time your lease expires!!!].
Let's say that your lease time is 3600 seconds. Then, every hour, the
DHCP client is going to request a lease renewal. Usually, the DHCP
server says 'Fine, here ya go, keep the same one for another 3600
seconds'. However, it doesn't have to. It could turn around and say
'Too bad.. Deal with a new IP/Hostname'. Would you want *all* of those
to be added to your /etc/hosts? Because, now your old IP address is no
longer localhost...
--
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 |
More information about the fedora-list
mailing list