Problem with DHCP, /etc/hosts and GNOME

Keven Ring keven at mitre.org
Thu Apr 8 20:35:34 UTC 2004


Rick Stevens wrote:

> Keven Ring wrote:
>
>> William Hooper wrote:
>>
>>> Satish Balay said:
>>>
>>>  
>>>
>>>> Ah.. I interptered it as - an option to dhcp-clinet (not server) to
>>>> ignore what dhcp server says - and use the provided value as the
>>>> hostname. Perhpas there should be some other option for this
>>>> functionality? (RFE)
>>>>
>>>> I don't like hostname changing (when you move laptop between networks)
>>>> - this changes xauth which messes up everything else..
>>>>   
>>>
>>>
>>>
>>> A quick browse through the networking scripts suggests that the 
>>> hostname
>>> will only change if it is "localhost".  I haven't looked too hard 
>>> though. I know that I don't have a problem with my laptop, which I 
>>> set the
>>> hostname on during install (but that was with RHL 9 and an upgrade to
>>> FC1).  It may be more of a case of the DHCP servers I'm using not 
>>> trying
>>> to change the hostname, though.
>>>
>>>
>>>  
>>>
>> It's in the /etc/sysconfig/network-scripts/network-functions script.  
>> There is a function called need_hostname().
>>
>> Returns 0 if the current hostname is "localhost", 
>> "localhost.localdomain" or "(none)".  Returns 1 otherwise.  This 
>> function is called in the /etc/sysconfig/network-scripts/ifup 
>> script.  However, again, just like everything else, just because the 
>> DHCP client *requests* a hostname, does not mean that the DHCP server 
>> is obliged to hand one back...
>
>
> And you're not "obligated" to accept it.  You can set
>
>     supersede host-name "your-host-name"
>
> in your /etc/dhclient/dhclient.conf file to override whatever the DHCP
> server gives you.  see "dhclient.conf(5)" and "dhcp-options(5)" for
> info.
>
Of course, if you tell the DHCP server what you want your hostname to 
be, *and* ask for the DHCP server to provide one back to you, *and* 
disregard the hostname that the DHCP server sends back, then you have an 
awfully friendly system... :)

DHCP Client:  Please set my host name to xxx.yyy.zzz.
DHCP Server:  No chance.  Your host name is aaa.bbb.ccc
DHCP Client:  Screw you.  I'm setting my hostname to mmm.nnn.ooo

Fine.  Is everyone happy now?

-- 
Keven Ring               | "Oh no,  Not Again..."
The MITRE Corporation    |   Bowl of Petunias -
7515 Colshire Drive      |   The Hitchhikers Guide to the Galaxy
McLean VA 22102-7508     |
PH: (703)883-7026        |







More information about the fedora-list mailing list