On 23 June 2014 06:24, Avi Cohen <av...@rad.com> wrote:
> Hello
> In my application  (it is a router in the access)  I'm initially  running
> dhclient daemon without any  interface specified for dhcp.
> Then - on user request - we  add  interfaces  to dhclient.conf on run-time
>
> I have 3 questions  - that I'll appreciate if you can answer

You can read dhclient(8) and dhclient.conf(5) man pages for details.
But to summarize ...

(You seem to ask 4 questions, so which one will you not appreciate an
answer to? :-))

>
> 1.       Is it possible to append  interfaces  to an existing dhclient.conf ?
> or just to add a new (for example)  dhclient.conf-eth1?  [BTW - where to
> locate this file ?]

You can append as many 'interface' statements as you like in the
dhclient.conf file. If you want to run with a separate config file for
a particular instance of dhclient you can use the '-c' option to
specify the non-default file.

>
> 2.        When the daemon will  start the dhcp-request for this new  interface
> ?

When you start it. Every interface's dhclient must be started
separately. If you start a dhclient without specifying the interface
it attempts to find an interface in the 'egress' group. If there is
one and only one such interface then dhclient will use it. For other
interfaces you must start other instances of dhclient, usually by
creating a /etc/hostname.<if> file for that interface. The
/etc/hostname.<if> file will be used at system startup or you can 'sh
/etc/netstart <if>' as root.

>
> 3.       Our application need to be informed whenever a new IP-address (dhcp)
> is assigned for the interface.  How to do it ? by polling the dhclient.leases
> ?  is there a notification from dhclient to  our application that we can use
> ?

The best way to do that is with a program that monitors the routing
socket, where you can see all address changes.

Alternatively you can monitor the leases file or use the '-L' option
to write out the offered and effective lease information if you want
complete information on what is being received and used. Some people
use the entr port (/usr/ports/sysutils/entr, http://entrproject.org/)
to monitor the file(s).

>
> 4.       4 - if I start the dhclient daemon without interface specified - I
> see that it sends  dhcp-request for all my exiting interfaces ? why ? how to
> disable this behavior and to send request for only
>
> Specified interfaces ? (but without specifying  it in the command line- but
> via dhclient.conf  ?

Now you make me doubt you are running OpenBSD. Our dhclient does not
send dhcp-request for all interfaces -- it sends dhcp-requests out one
and only one interface. At least for the last 10 years or more.

You must specify the interface via the command line, or have the
/etc/netstart command build the command line for you from a
hostname.<if> file.

.... Ken

>
>
>
> Regards,
> Avi

Reply via email to