0

Problem:

I want to change the timeout of dhclient for embedded Linux that doesn’t have DHCP.

What I did:

I have compiled DHCP from isc.org.  I have compiled it with this CFLAGS:

CFLAGS="-D_PATH_DHCLIENT_SCRIPT='\"/sbin/dhclient-script\"'         \
        -D_PATH_DHCPD_CONF='\"/etc/dhcp/dhcpd.conf\"'               \
        -D_PATH_DHCLIENT_CONF='\"/ISGv2/configs/dhclient.conf\"'"   

In my config file, /ISGv2/configs/dhclient.conf (which I designated as _PATH_DHCLIENT_CONF in my CFLAGS, shown above), I have specified a timeout of 3 seconds.

If I execute this command:

dhclient wlan0

It uses a timeout of <something other than 3 seconds>, so it must be reading the "defaults" settings from some other (unknown) config file.

If I execute this command:

dhclient wlan0 -cf /ISGv2/configs/dhclient.conf

it works as expected.

How can I determine what config file it is using by default?

  • 1
    What distribution? Did you compile dhclient or did it come from your distribution? – Mikel Aug 25 '17 at 14:52
  • I have compiled the dhclient from isc.org. I don't understand the "pid". If I use the dhclient.conf (dhcpd -cf /ISGv2/configs/dhcpd.conf), it's easy to configure the dhclient, but with when the system uses the dhclient.wlan0.pid wlan0, I don't know which .conf file is using. Thanks. – Kotik_o Aug 25 '17 at 15:00
  • 1
    As you compiled it yourself, the default path for the config file totally depends on how you have configured isc-dhcp before compilation. So no one can answer that except you. A typical location is /etc/dhcp/dhclient.conf. The option -pf gives a path to a file where it stores the pid, so it's easy for the system to find it later. This file has nothing to do with the config file. – dirkt Aug 25 '17 at 15:13
  • (1) Do you want to mention /var/run/dhclient.wlan0.pid or not?  If not, delete it from the title. (2) Have you tried using strace to see what files it accesses? – Scott Aug 26 '17 at 19:24
  • Thanks Scott. Using strace I find the problem:open("/etc/dhclient.conf", O_RDONLY) = -1 ENOENT (No such file or directory) – Kotik_o Aug 28 '17 at 8:39
0

Solution:

I don't know if there is a bug in the dhcp from isg.org, but it uses the dhclient.conf located here:

/etc/dhclient.conf

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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