3

I've setup a DHCP server on one of my centos boxes, and I have several computers that are going to connect (also centos) and hopefully make use of the DHCP. On start-up I'd like to check whether a DHCP server is available, or if the computer will have to fall back onto a static IP.

My first idea is to modify the file under /etc/sysconfig/network via a script that would run on startup...is there an easier way to do this though? I would have hoped somewhere in the DHCP config there would be a way to specify a fallback point in the event no DHCP server is found. Thanks!

1 Answer 1

4

You can add a fixed "lease" definition to the DHCP client configuration, as discussed here: http://www.mail-archive.com/[email protected]/msg52652.html

The basic form is:

lease {
  interface "eth0";
  fixed-address 172.16.0.66;
  option subnet-mask 255.255.255.0;
  option routers 172.16.0.1;
  option domain-name-servers 80.58.0.33;
  renew 2 2022/1/12 00:00:01;
  rebind 2 2022/1/12 00:00:01;
  expire 2 2022/1/12 00:00:01;
} 

Add that to your dhclient.conf file and you should get the behaviour you want.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .