LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
Search this Thread
Old 03-26-2008, 12:54 PM   #1
Mark_667
Member
 
Registered: Aug 2005
Location: Manchester, England
Distribution: Ubuntu 12.10
Posts: 257

Rep: Reputation: 25
Automatically renew DHCP address on RHEL4


I need it to report it's hostname to the DHCP server to create a DNS entry for it. I've tried a few things but no luck so far.

dhclient gives command not found
dhcpcd also command not found
as does netconf

/etc/sysconfig/network is a file
there is no dhco file in /etc/sysconfig/

from http://www.novell.com/coolsolutions/trench/16013.html

ifcfg-eth0 (under /etc/sysconfig/network-scripts)
already has
BOOTPROTO="dhcp"
 
Old 03-26-2008, 06:27 PM   #2
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
If you just want it to send its hostname when requesting dhcp assigned IP you should be able to do this with the DHCP_HOSTNAME variable in the ifcfg-eth* file.

Code:
BOOTPROTO=dhcp
...
DHCP_HOSTNAME=myhost.domain.local
This should then create a file /etc/dhclient-eth*.conf with something like:
send host-name "myhost.domain.local"; that dhclient will use when requesting an IP.
 
Old 03-27-2008, 05:46 AM   #3
Mark_667
Member
 
Registered: Aug 2005
Location: Manchester, England
Distribution: Ubuntu 12.10
Posts: 257

Original Poster
Rep: Reputation: 25
after adding the line you specify and rebooting I did
Code:
ls /etc | grep dhclient
dhclient-eth0.conf
resolv.conf.predhclient
the first file contains the following
Quote:
send host name "<machine-name>.domain.local"; #temporary RHL ifup addition
The second contains
Quote:
; generated by /sbin/dhclient-script
nameserver <ip-address>
nameserver <ip-address>
dhclient is clearly installed but I still get a command not found when trying to launch it from command line (as root)? Also it says it's temporary, I need it to do it every time. Is there some way of making it permanent? thanks for the information so far .
 
Old 03-27-2008, 06:38 AM   #4
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
I'm fairly sure it is /sbin/dhclient. When you are "as root" are you a)logging in as root, b) su to root, or c) su - (or su - root)? It sounds like your $PATH may not be properly set...

As far as having it permanent that is what adding the line in the network-scripts/ifcfg-ethX file does for you. The line in the dhclient-ethX.conf _is_ temporary in-so-much as it added by an external script (ifup) and can be removed by it (ifdown) when shutting down the interface. However, as long as the variable persists in the ifcfg-ethX file it will always be added to the dhclient-ethX.conf when ifup is run on the interface.

Last edited by rayfordj; 03-27-2008 at 06:44 AM.
 
Old 03-27-2008, 10:33 AM   #5
Mark_667
Member
 
Registered: Aug 2005
Location: Manchester, England
Distribution: Ubuntu 12.10
Posts: 257

Original Poster
Rep: Reputation: 25
Thanks for clarifying that rayfordj, it's been a big help. And to answer your question, I su to root as needed. I'll also take a look at that $PATH variable you mention.

Thanks again,
Mark
 
Old 03-27-2008, 04:14 PM   #6
rayfordj
Member
 
Registered: Feb 2008
Location: Texas
Distribution: Fedora, RHEL, CentOS
Posts: 475

Rep: Reputation: 73
if you just use 'su' then you keep your user's $PATH rather than sourcing root's $PATH. 'su -' (or 'su - root') will, among other things, source root's $PATH so that you get all of the sbin directories.
 
  


Reply

Tags
dhcp, dns, renew


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FreeBSD 6.2: How can I renew my DHCP IP address? neilcpp *BSD 1 10-09-2007 09:28 AM
Release and Renew DHCP abridge Linux - Newbie 4 11-11-2006 08:43 PM
renew ip address distantlyyours Slackware 2 02-08-2004 01:08 PM
renew ip address distantlyyours Slackware 4 02-08-2004 12:54 PM
dhcp renew? murray_linux Mandriva 1 11-06-2003 02:59 PM


All times are GMT -5. The time now is 11:57 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration