Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just a little question.

My DNS Servers are updated by our DHCP Server (Microsoft Windows 2003 R2 SP2).

My clients are Debian Linux Distro's, and I have to modify my DHCLIENT.CONF file on it to send his Full Qualified Hostname.

BUT I've about 1600 computers and I don't want to modify each client one by one, then, Could I for exemple use a System Variable on the Config file?


send "$hostname"
where $hostname variable is the alias write on BASHRC for the hostname -f command.

If you need any more informations just tell me.

share|improve this question
up vote 1 down vote accepted

I guess you have a number of different approaches here. AFAIK, the dhclient.conf does not support variable expansion as you have listed. So that leaves two obvious options:

  1. Script to login to all hosts and build config file
  2. Configuration management (puppet/cfengine/chef)

Option 1. is ugly, it will get you past this hurdle but it will be difficult to maintain. Before you know it, you will regularly be writing scripts to login to all of your machines, which will take a long time, be error-prone (for instance how do you handle down hosts gracefully and come back later) and hard to maintain.

Option 2. is definitely what I would recommend, and I would recommend puppet as its far more flexible and easy to use relative to cfengine, yet relatively mature.

Here is your manifest (not tested)

class dhcp-client {
   file { "/etc/dhclient.conf":
       content => template("dhclient.conf")

And the template :

other dhclient.conf stuff
send "<%= fqdn %>"

and node config:

node default { 
   include dhcp-client
share|improve this answer
Is there any way to send automatically our Hostname to the DHCP?? Is quite strange, how the multinational under linux did to list and have a correct synchronisation between their Windows DNS/DHCP and their linux? IMO, normally the DHClient should be able to send his informations isn't it? I'll check your differents ways. – Dr I Mar 25 '10 at 12:28

The bleeding edge (4.2.x) versions of dhclient support this by providing a gethostname() function.

So with the latest dhclient alpha, you can put something like this in dhclient.conf

send host-name = gethostname();

Ubuntu have a patch in their version of dhclient which lets you do

send host-name = "<hostname>";

and it will replace it with the proper hostname.

Redhat patch their dhclient to provide -H and -F (-H = send host-name, -F = send fqdn.fqdn) command line options. So on Redhat you can run

dhclient -H $(hostname) 

and it will send the proper hostname.

I'm not aware of anything available for Debian though - you might want to look at patching your dhclient with the Ubuntu patch

share|improve this answer
Many thanks for your help, I've made a starting script in fact. – Dr I Mar 26 '10 at 12:12

Many thanks for everyone (you both), I've discovered a huge tools, named Puppet and increase my skills in scripting.

Subject Resolved.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.