Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux HostsFree MagazinesJobs
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Desktop / X-Windows
Reload this Page Any ideas?
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Desktop / X-Windows Anything X. Gnome, KDE, remote desktop's, XGames etc.

Reply
 
Thread Tools Display Modes
Old 01-11-2003   #11 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,575
Do you actually get a hostname setting from your DHCP server that differs from the one that you send then? Also, just because it works with dhcpcd doesn't mean it works with dhclient. The best way is probably to find an option for dhclient that tells it not to update the hostname, and if a such doesn't exist, to add a hook that restores the hostname after completion of the lease.
Dolda2000 is offline   Reply With Quote
Old 01-11-2003   #12 (permalink)
Linux Engineer
 
Join Date: Jan 2003
Location: Lebanon, pa
Posts: 994
All I am doing is making gnome think that is my hostname. I am setting what is in hostname as an alias to my box in /etc/hosts.
genlee is offline   Reply With Quote
Old 01-11-2003   #13 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,575
But gnome doesn't read the hostname from /etc/hostname. It uses gethostname(2), if I'm not mistaken, and if dhclient updates the hostname via sethostname(2) without updating /etc/hosts, it won't work anyway.
Dolda2000 is offline   Reply With Quote
Old 01-11-2003   #14 (permalink)
Linux Engineer
 
Join Date: Jan 2003
Location: Lebanon, pa
Posts: 994
ok then run hostname "pick one" then set an alias to it in your hosts file. I don't think dhclient will overwrite your set hostname. Only one way to find out.
genlee is offline   Reply With Quote
Old 01-11-2003   #15 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,575
Apparently it does, since it's precisely that it seems to have done. Possibly it only overwrites the default "inappropriate" hostnames, but that was just what majorwoo and I suggested earlier today, though, by setting the HOSTNAME setting in /etc/sysconfig/network.
Dolda2000 is offline   Reply With Quote
Old 01-11-2003   #16 (permalink)
Linux Engineer
 
Join Date: Jan 2003
Location: Lebanon, pa
Posts: 994
ok if it removes invalid hostnames, adding the alias to it in /etc/hosts like I said should fix that then since it will be valid.
genlee is offline   Reply With Quote
Old 01-11-2003   #17 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,575
Not if the alias doesn't match the hostname as stored in the kernel.
This is a probably chain of events, as I've managed to gather:
1. The system boots and there is no HOSTNAME setting in /etc/sysconfig/network, so rc.sysinit sets the hostname to "localhost.localdomain" or something similar.
2. The dhcp daemon is run on the network interface. It transmits a DHCPDISCOVER message to the DHCP server with the hostname option containing the locally set hostname, namely "localhost.localdomain".
3. The DHCP server returns something else, such as "dchp-966-63" or whatever it was (see the first post). It does this either because the sysadmins thought it to be appropriate or because it doesn't like one of its configured clients to have a hostname similar to "localhost". Note that the returned hostname is a random name, and is likely to change when a new lease is requested.
4. dhclient updates the locally set hostname (using sethostname(2)) to the one received from the DHCP server. It does this either because it programmed to do so whatever it receives, or because it deems it better than something similar to "localhost".

Note, that at this point, it doesn't matter what alias you have previously set in /etc/hosts, since the new random hostname is very unlikely to match it, and even if it does, it does so by chance.
The fixes to this are several: If the new hostname is set because the previous one was "localhost*", it can be fixed by setting the HOSTNAME setting to something nice. If it's the default behaviour of dhclient and the configured behaviour if the DHCP server to always do so, the best would be to find an option to dhclient that makes ignore the hostname option from the server. If there is no such option, the hostname would have to be reset after dhclient is invoked. That's less elegant, however.

This is how I've interpreted the previous posts. If I've missed something, please tell me.
Dolda2000 is offline   Reply With Quote
Old 01-11-2003   #18 (permalink)
Linux Engineer
 
Join Date: Jan 2003
Location: Lebanon, pa
Posts: 994
That is why you put a hostname in that file like I have said numerous times. If you do what I said in my original post(setting hostname and then adding an alias to it) gnome will not complain at all.
genlee is offline   Reply With Quote
Old 01-11-2003   #19 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,575
Of course, but then again, that's a one time solution, since the hostname will change once again the next time you request a lease from the DHCP server.
Dolda2000 is offline   Reply With Quote
Old 01-11-2003   #20 (permalink)
Linux Guru
 
Join Date: Oct 2001
Location: Täby, Sweden
Posts: 7,575
Unless your /etc/hostname file was supposed to be the same is the HOSTNAME setting, and you had also thought of that it might be that it replaces an obvious "default-like" hostname? I'm suspecting that we aren't synced in this discussion.
Dolda2000 is offline   Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
useradd script ideas? jwilliams Linux Programming & Scripting 7 06-04-2006 11:07 PM
Good ideas / bad ideas for everyone Mazza The Coffee Lounge 4 09-10-2005 02:19 AM
Slackware A setup only, not working, any ideas? Dredd2032 Slackware Linux Help 3 09-10-2004 10:05 AM
Ideas to make installs simpler. - Anonymous Installation 1 03-18-2004 05:22 PM
programming ideas big_k105 Linux Programming & Scripting 10 11-11-2003 03:43 AM

Free Magazines
Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe
Systems Management News, the newspaper for IT systems administration and data center managers!
Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe
The Enterprise Newsweekly
eWeek is the essential technology information source for builders of e-business.
subscribe
Oracle Magazine
Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe
Total Telecom
Total Telecom is "The Economist of the communications industry".
subscribe
More free magazines »



All times are GMT. The time now is 06:07 AM.




© 2000 - 2008 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.2.0