Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 524686

Summary: net-misc/dhcp: add support for interface specific systemd service files
Product: Gentoo Linux Reporter: alexander haensch <alexander.haensch>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: normal CC: arthur
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description alexander haensch 2014-10-07 10:55:44 UTC
the systemd service files delivered with the package work fine, but start the DHCP server on all available interfaces. 
This is practical in many cases, but in some situations you want the DHCP server just listen on a specific interface.

I propose to add two additional service files that allow interface specific startup.

Reproducible: Always
Comment 1 alexander haensch 2014-10-07 10:57:15 UTC
on example for the dhcpv4@.service file could be:

[Unit]
Description=DHCPv4 Server Daemon on interface %I
Documentation=man:dhcpd(8) man:dhcpd.conf(5)
After=network.target
After=time-sync.target

[Service]
ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcp -group dhcp --no-pid %i

[Install]
WantedBy=multi-user.target


so the %i is appling the interface that is needed.
Comment 2 Chris Paras 2018-05-31 14:54:13 UTC
This will work fine when you specify just one interface for dhcpd to listen on, but i think it won't work for multiple interfaces.

Suggestion:


/etc/systemd/system/dhcpd[4,6]/service.d/00gentoo.conf

[Service]
Environment="DHCPD_IFACES=eth0 br0"

and in /etc/systemd/system/dhcpd4.service

[Service]
ExecStart=/usr/sbin/dhcpd -f -cf /etc/dhcp/dhcpd.conf -user dhcp -group dhcp --no-pid $DHCPD_IFACES

Basically its working like the /etc/conf.d/ files used to do for openrc.