systemd / systemd/systemd

feature request: for .netdev devices or .network interfaces enable or disable should be possible

Open
#8,028 1 comment 15 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

network RFE 🎁
Dominant language
C
Stars
16.7k
Forks
4.7k
Avg merge
1d 6h
Merged PRs (30d)
140

Description

Why not the same mechanism for network interfaces or devices as for services, timers, mounts, ... ?

My use case is a (infrequently) used vm via libvirt. I have a qemu hook script which sets up a bridge device where the physical eth and the virtual interface of the vm connects to. After stopping the vm, the network is set back to standard setup as defined in /etc/systemd/network .

So my idea is to store the br0.netdev, br0.network and upstream.network as units together with my standard config eth.network in /etc/systemd/network, where only eth.network is enabled and the other units are deactivated, e.g., by something like:

systemctl enable eth.network
systemctl disable br0.netdev
systemctl disable br0.network
systemctl disable upstream.network # binding eth to br0

So only the eth network interface is brought up automatically by systemd-networkd while booting. Later, e.g., when starting the vm, I would call from the hook something like the following:

systemctl stop eth.network
systemctl start br0.netdev
systemctl start upstream.network
systemctl start br0.network

Maybe this could also be done by networkctl instead of systemctl. This feature may also be useful, e.g., for wifi connections, which one may want to start only manually, like it is done via NetworkManager. The syntax would fit perfectly into the ecosystem of systemd.

May be another/or additional option would be to have a "noauto" config flag in the unit files, similar as for mountpoints in /etc/fstab.

OT: At least under Debian configs in /usr/local/lib/systemd/network seems not to be found. That is inconsistent to the other units which do for /usr/local/lib/systemd/system.

Thanks for systemd!

Chris

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the systemctl and networkctl entry points for .netdev and .network units, along with the /etc/systemd/network configuration paths described in the issue. Define and test one consistent mechanism for controlling automatic activation, including the proposed noauto alternative, and verify that the libvirt hook workflow works.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux
Domain
networking, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.