Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 would like to shorten the bootup time of my CentOS Virtual Machines. They are spawn up automatically during our test cycle. We noticed that it could take up to 15 seconds to obtain an IP address from the DHCP server, and suspect it has to do with the DHCP broadcast discovery.

How do I hardcode the ip address of the DHCP server in CentOS 5.3 ?

[edit] I noticed that the dhclient man page has the "-s" options which allows to specify the exact DHCP IP address. However that does not affect the boot cycle of the VM.

share|improve this question
I take it you mean that you want to send a directed DHCP request to a specific IP address rather than broadcast, but you still want the DHCP server to send the IP config details to the client. That is an interesting question. – dunxd Feb 7 '12 at 13:04
My guess is that this won't work. The DHCP protocol… specifies a UDP packet sent to the broadcast address. What the OP is asking for sounds like a chicken-and-egg problem using information about the LAN before actually receiving information about the LAN. It might be better to figure out why DHCP broadcast isn't working quickly through the host machine. – cjc Feb 7 '12 at 13:21
cjc, I just edited the question to reference the dhclient man page which shows there is an option to specify the dhcp server ip adddress (-s) – Itai Frenkel Feb 7 '12 at 13:57
I stand corrected! – cjc Feb 7 '12 at 14:55
up vote 1 down vote accepted

Now that I've found out something about dhclient options, I took a look at /etc/sysconfig/network-scripts/ifup-eth. In the very worst case, you can edit that script to run dhclient with the -s option to specify the DHCP server.

There's also an optional /etc/dhclient.conf file, but looking at man dhclient.conf I don't see any option that corresponds to the "-s" command line switch.

share|improve this answer
I've added the following lines in the ifup-eth file and indeed it affected the boot sequence. We are now troubleshooting the DHCP issues themselves. DHCLIENTARGS="-s" – Itai Frenkel Feb 8 '12 at 10:52

For hardcode your IP address. I prefer to configure it static.

vim /etc/sysconfig/network-scripts/ifcfg-eth0 <interface-name> For each network interface, there is a corresponding interface configuration script. Each of these files provide information specific to a particular network interface

Add following

share|improve this answer
This isn't what the OP asked for. Also, it won't work in the OP's implied scenario, where he's booting up a bunch of VMs based on the same basic iamge. In that case, a static IP in the image will cause bad things to happen. – cjc Feb 7 '12 at 13:14

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.