Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 492394 - sys-apps/systemd Needs to provide service unit for static IP addressing
Summary: sys-apps/systemd Needs to provide service unit for static IP addressing
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo systemd Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-23 21:57 UTC by Reuben Martin
Modified: 2014-08-21 00:58 UTC (History)
2 users (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 Reuben Martin 2013-11-23 21:57:55 UTC
systemd currently does not provide an IP addressing (that I am aware of) and relies on service units provided by packages like networkmanager, netctl, dhcp client or something similar to manage network connections.

There are many scenarios where services like this are overkill. I would like to propose that it would be prudent to provide a service file with the systemd package that would allow setting a static IP. It would depend on sys-apps/iproute2

I've been using the following based on quick googling:


/usr/lib/systemd/system/static-ip.service:
============================================
[Unit]
Description=Static Network Addressing
Wants=network.target
Before=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/net.systemd
ExecStart=/bin/ip link set dev ${interface} up
ExecStart=/bin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/bin/ip route add default via ${gateway} dev ${interface}
ExecStop=/bin/ip addr flush dev ${interface}        
ExecStop=/bin/ip link set dev ${interface} down

[Install]
WantedBy=multi-user.target
============================================

/etc/conf.d/net.systemd
============================================
interface=foobar
address=w.x.y.z
netmask=w.x.y.z
broadcast=w.x.y.z
gateway=w.x.y.z
============================================


Reproducible: Always
Comment 1 Mike Gilbert gentoo-dev 2013-11-23 22:34:37 UTC
I don't think it makes any sense for us to invent yet another way to configure networking with systemd.

Also, you think netctl is overkill, I think you haven't even looked at it.
Comment 2 Franz Trischberger 2013-11-26 18:27:37 UTC
Seems like >systemd-208 will get a "networkd". Reading the commit message of the initial commit [*] this might be what you are looking for...

[*] http://cgit.freedesktop.org/systemd/systemd/commit/src/network?id=f579559b3a14c1f1ef96c372e7626c4733e6ef7d
Comment 3 Duncan 2014-08-21 00:56:45 UTC
(In reply to Franz Fellner from comment #2)
> Seems like >systemd-208 will get a "networkd".

With nothing below systemd-212 in-tree any longer, this bug should most likely be resolved/obsolete.
Comment 4 Mike Gilbert gentoo-dev 2014-08-21 00:58:49 UTC
Indeed.