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

Pallissard, Matthew matthew.paul at pallissard.net
Thu May 5 14:33:51 UTC 2016


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
>


More information about the dhcp-users mailing list