dhcp with /etc/network/interfaces

Denys Vlasenko vda.linux at googlemail.com
Tue Sep 20 15:45:15 UTC 2016


On Tue, Sep 20, 2016 at 5:31 PM, David Henderson
<dhenderson at digital-pipe.com> wrote:
> Hey Martin, thanks again for your help!  So I had to bring back
> 'sneaker-net' to get strace on the machine via flash drive (after
> locating one), but it is now on the machine!  I could not see anything
> in the 'ps' output (and it is the GNU version) regarding what was
> being called for contacting a DHCP server for the adapter.  I also
> tried running the command that Peter suggested, but the command he
> listed has invalid syntax.

An examlpe run works for me:

$ strace -f -e execve sh -c /bin/pwd
execve("/usr/bin/sh", ["sh", "-c", "/bin/pwd"], [/* 52 vars */]) = 0
execve("/bin/pwd", ["/bin/pwd"], [/* 52 vars */]) = 0
/tmp
+++ exited with 0 +++

You might have an old version of strace.

> After a few more calls and a ton of goop
> from 'strace'

We need the entire "ton of goop" from strace.
For example, the "strace -oLOG -f -tt -s99 COMMAND" is my favorite.


>, it appears that 'udhcpc' was being called as follows
> (at least on my dev machine):
>
> udhcpc -R -n -p /var/run/udhcpc.eth0.pid -i eth0
>
> (Just in case anyone else comes across this post)
>
> Now that I know what is being called, can anyone help with the other
> part of the original question?

Ok, the question:

> scripts that are run in the /etc/network/if-{,pre-,post-}{up,down}.d/
> directories.  Can/should I specify a script in the proper directory to
> execute the udhcpc binary (or another binary for that matter) with my
> own parameters for the interface without BB trying to use its own
> methods of obtaining an IP address automatically - effectively
> preventing the duplication of requests to the DHCP server for that
> interface?

My personal opinion is that as soon as "simple" ifup/ifdown setup
is too primitive for your needs, e.g.:
- you need many IPs on one iface,
- you need dynamical ifaces (ppp, vpn), and you need to redefine
  routing/firewalling based on what's up and what isn't,
- you need additional things to be started/stopped
  (WPA supplicant, babysitter)

at this point ifup becomes more PITA than help. It forces you
to do stuff in awkward ways.


More information about the busybox mailing list