Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 524686 - net-misc/dhcp: add support for interface specific systemd service files
Summary: net-misc/dhcp: add support for interface specific systemd service files
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-07 10:55 UTC by alexander haensch
Modified: 2018-06-05 19:22 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.