7

I am working on an embedded system and it uses udhcpc as its DHCP client. It seems to be running with the following parameters:

/usr/share/udhcpc # ps | grep dhcp 5366 root 2432 S udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0

I want to change the parameters or run my own DHCP client. I searched and I think it has something to do with ifup and /etc/network/interfaces.

iface eth0 inet dhcp

But I don't see a way to modify the DHCP client.

I would like to know

  1. how to change the parameter to udhcpc, and
  2. if it is possible to run my own DHCP client without killing udhcpc

Thanks!

6
  • is your OS openwrt? Commented Feb 12, 2016 at 19:44
  • No. I am actually not sure what flavor of Linux it is. Commented Feb 12, 2016 at 20:14
  • can you tell me the full udhcpc path please? Commented Feb 12, 2016 at 20:18
  • /sbin/udhcpc is the full path, right? Commented Feb 12, 2016 at 20:20
  • it is just /sbin/udhcpc and it is linked to /bin/busybox Commented Feb 12, 2016 at 20:20

3 Answers 3

3

Your system seems a lightweight version/variation of Debian, based in busybox.

busybox is typically used either for recovery medium, or for embedded systems with limited resources.

For modifying the parameters, you can invoke udhcpc automatically.

You can change /etc/network/interfaces as:

iface eth0 inet manual pre-up /sbin/udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0 

As for running another DHCP client, you would have to install it; however you would have to switch it with udhcpc unless you have other interfaces.

Bear in mind as udhcpc is part of busybox, it is just a link to a global binary that provides you with a work environment, and as such, you won't save any space switching DHCP clients.

2

The solution proposed by Martin Trenkmann didn't work for me (using udhcpc_opts). However, on my system adding the following lines to /etc/network/interfaces worked:

auto eth0 iface eth0 inet dhcp hostname myhostname 

This made BusyBox to execute:

$ ps aux| grep dhc 1685 root /sbin/udhcpc -n -p /run/udhcpc.eth0.pid -i eth0 -x hostname:myhostname 

(Found at https://wiki.alpinelinux.org/wiki/Udhcpc)

1

How to change the parameter to udhcpc?

You can use udhcpc_opts for this.

iface eth0 inet dhcp udhcpc_opts -t 10 ... 

The example above tells udhcpc to try at most 10 times to get a lease.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.