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

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

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

lejeczek
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
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

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

Simon Hobson
lejeczek <[hidden email]> wrote:

> Would you share your thoughts?

Complain to the SystemD camp that they've broken it. Sorry, but I'm in the camp that says SystemD isn't going near any of my systems - I like systems that work reliably and can be fixed in the event that something goes wrong and SystemD is the exact opposite of this.
Lennart Poettering's team broke it (along with loads of other stuff), they should fix it.

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

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

lejeczek
"complain" is wrongly chosen word in my view.
I'd have been still writing bash-whole-long scripts only to put & start/manage things together - I did not mind it, but with systemd I can go and script something else. I think systemd is one of few best things recently happened to Linux, earlier it was all jungle, everybody's own jungle.
I've gone to systemd list, lets see.

On Wed, 2016-05-04 at 12:52 +0100, Simon Hobson wrote:
lejeczek <[hidden email]> wrote:

Would you share your thoughts?
Complain to the SystemD camp that they've broken it. Sorry, but I'm in the camp that says SystemD isn't going near any of my systems - I like systems that work reliably and can be fixed in the event that something goes wrong and SystemD is the exact opposite of this. Lennart Poettering's team broke it (along with loads of other stuff), they should fix it. _______________________________________________ dhcp-users mailing list [hidden email] https://lists.isc.org/mailman/listinfo/dhcp-users

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

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

Pallissard, Matthew
In reply to this post by lejeczek
Can you share your unit file?

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
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

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

lejeczek
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 [hidden email] https://lists.isc.org/mailman/listinfo/dhcp-users
_______________________________________________ dhcp-users mailing list [hidden email] https://lists.isc.org/mailman/listinfo/dhcp-users

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

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

Pallissard, Matthew
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 [hidden email] <mailto:[hidden email]> https://lists.isc.org/mailman/listinfo/dhcp-users
>>
>> _______________________________________________
>> dhcp-users mailing list
>> [hidden email] <mailto:[hidden email]>
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

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

Bill Shirley
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 [hidden email] <mailto:[hidden email]>
>>>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>>
>>> _______________________________________________
>>> dhcp-users mailing list
>>> [hidden email] <mailto:[hidden email]>
>>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>
>>
>> _______________________________________________
>> dhcp-users mailing list
>> [hidden email]
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

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

Pallissard, Matthew
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 [hidden email] <mailto:[hidden email]>
>>>>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>>>
>>>> _______________________________________________
>>>> dhcp-users mailing list
>>>> [hidden email] <mailto:[hidden email]>
>>>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>>
>>>
>>> _______________________________________________
>>> dhcp-users mailing list
>>> [hidden email]
>>> https://lists.isc.org/mailman/listinfo/dhcp-users
>>>
>> _______________________________________________
>> dhcp-users mailing list
>> [hidden email]
>> https://lists.isc.org/mailman/listinfo/dhcp-users
>
> _______________________________________________
> dhcp-users mailing list
> [hidden email]
> https://lists.isc.org/mailman/listinfo/dhcp-users
>
_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users
Reply | Threaded
Open this post in threaded view
|

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

Jóhann B. Guðmundsson
In reply to this post by lejeczek

On 05/04/2016 11:46 AM, lejeczek wrote:

hi users

I have my dhcpd to serve nothing but virbr0 (libvirt), OS is Centos 7.2

Depending on how ancient the systemd release is in CentOS you have, if you dont need a full blown dhcp server like isc dhcp and are just using a simply setup with virtualization and containers you can use systemd networkd.

systemd-networkd supports DHCP (client/server), networks with static IP, bridges, tunnels, VLANs, Wireless (with wpa_supplicant) and you can use it with systemd-resolved as resolver with DNS cache and systemd timesyncd for network time synchronization.

Once networkd gets a bus interface you probably will see systemd based distribution start discussing dropping the legacy sysv initscript so you might want to familiarize yourself with it's configuration syntax, pros and cons and it's command line tools even if you dont need it or want it.

Here for example is a benchmarking comparison with isc dhcp [¹] for such simple setup but if you need something more heavyweight than simple, you should be using isc dhcp.

JBG

1. https://tlhp.cf/systemd-networkd-migration-and-benchmarks/

_______________________________________________
dhcp-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/dhcp-users