dhcpd (via systemd) @boottime which does not wait for the interface..

Pallissard, Matthew matthew.paul at pallissard.net
Mon May 9 14:28:27 UTC 2016


I just tested this.  You're absolutely correct.

Matt Pallissard

On 05/09/2016 09:22 AM, Bill Shirley wrote:
> Correct me if I'm wrong, but ISC dhcpd for IPv4 uses raw sockets.  I think starting as
> root is required.  Thus the need for -user dhcpd and -group dhcpd on the command line.  It drops
> privileges after initializing.
>
> Bill
>
>
> On 5/5/2016 10:33 AM, Pallissard, Matthew wrote:
>> If you make the unit wait until network-online.target it /should/ wait until it gets a routable IP address.  If I understand
>> how network-online works correctly, I'd assume that it could be thrown off if you have multiple interfaces and some interfaces
>> come quickly while virbr0 isn't coming up in a timely manner.
>>
>> <2cents>
>> I don't see -user and -group in the man page.  Maybe I didn't read it that carefully but it seems that the flag's you'd use
>> would be -G and -U.  Personally, I usually specify the user within the unit file.  Also you'll probably want to declare it as
>> a forking service with a pid file.
>> </2cents>
>>
>>
>> Try something similar to this and see if it works.
>>
>>
>> [Unit]
>> Description=DHCPv4 Server Daemon
>> After=network-online.target
>>
>> [Service]
>> Type=forking
>> User=dhcpq
>> PIDFile=/path/to/dhcpd/pid/file
>> ExecStart=/usr/sbin/dhcpd -q -cf /etc/dhcp/dhcpd.conf -pf /path/to/dhcpd/pid/file interface
>> [Install]
>> WantedBy=multi-user.target
>>
>> Matt Pallissard
>>
>> On 05/05/2016 07:52 AM, lejeczek wrote:
>>> On Wed, 2016-05-04 at 09:45 -0500, Pallissard, Matthew wrote:
>>>> Can you share your unit file?
>>>>
>>> [Unit]
>>> Description=DHCPv4 Server Daemon
>>> Documentation=man:dhcpd(8) man:dhcpd.conf(5)
>>> Wants=network-online.target
>>> After=network-online.target
>>> After=time-sync.target
>>> After=libvirtd.service
>>> Requisite=libvirtd.service
>>>
>>> [Service]
>>> TimeoutStartSec=240s
>>> Type=notify
>>> ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcpd -group dhcpd --no-pid virbr0
>>>
>>> [Install]
>>> WantedBy=multi-user.target
>>>
>>> I've got some feedback from systemd list - libvirtd folks should know what happens and when interface is created/initialized.
>>> I wonder if this qualifies for bugzilla...
>>>
>>>> Matt Pallissard
>>>>
>>>> On 05/04/2016 06:46 AM, lejeczek wrote:
>>>>> hi users I have my dhcpd to serve nothing but virbr0 (libvirt), OS is Centos 7.2 Dhcpd would not start, complaining like
>>>>> this: No subnet declaration for virbr0 (no IPv4 addresses). ** Ignoring requests on virbr0. If this is not what you want,
>>>>> please write a subnet declaration in your dhcpd.conf file for the network segment to which interface virbr0 is attached. **
>>>>> and systemctl -l shows: ... systemd[1]: start request repeated too quickly for dhcpd.service ... but suffice to restart
>>>>> dhcpd and all works! I'v customized systemd's service conf, I've put: After=libvirtd.service Requisite=libvirtd.service but
>>>>> this did not help. Would you share your thoughts? many thanks. L. _______________________________________________
>>>>> dhcp-users mailing list dhcp-users at lists.isc.org <mailto:dhcp-users at lists.isc.org>
>>>>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>>>
>>>> _______________________________________________
>>>> dhcp-users mailing list
>>>> dhcp-users at lists.isc.org <mailto:dhcp-users at lists.isc.org>
>>>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>>
>>>
>>> _______________________________________________
>>> dhcp-users mailing list
>>> dhcp-users at lists.isc.org
>>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>>
>> _______________________________________________
>> dhcp-users mailing list
>> dhcp-users at lists.isc.org
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
>


More information about the dhcp-users mailing list