Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 507754 - sys-apps/systemd systemd unit file for network bridge support
Summary: sys-apps/systemd systemd unit file for network bridge support
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo systemd Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-15 18:24 UTC by Joachim Herb
Modified: 2014-04-16 01:13 UTC (History)
0 users

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 Joachim Herb 2014-04-15 18:24:21 UTC
There is no systemd unit file to start up a network bridge. Here is a very rudimentary starting point (named bridge@.service)

[Unit]
Description=network bridge %I
After=network.target

[Service]
Type=oneshot
RemainAfterExit=yes

EnvironmentFile=/etc/conf.d/net

ExecStart=/sbin/brctl addbr %i
ExecStart=/bin/ifconfig %i ${config_%i} up
ExecStart=/bin/ifconfig ${bridge_%i} up
ExecStart=/sbin/brctl addif %i ${bridge_%i}
ExecStart=/bin/ip route add default via ${routes_%i}

ExecStop=/bin/ip route del default via ${routes_%i}
ExecStop=/bin/ifconfig ${bridge_%i} down
ExecStop=/bin/ifconfig %i down
ExecStop=/sbin/brctl delbr %i

[Install]
WantedBy=multi-user.target

It uses a config file /etc/conf.d/net:
# bridge ports defined empty to avoid DHCP being run for their configuration
config_eth0="null"
#Bridge-config
config_br0="192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255"
routes_br0="192.168.1.1"
brctl_br0="setfd 0 sethello 10 stp off"
bridge_br0="eth0"

This is an example to use for "internal" bridging to e.g. a LXR container and therefore only connects to one physical ethernet card. This example has to be extended for bridging more than one physical card. 

See also: https://wiki.gentoo.org/wiki/Network_bridge#Host_Configuration_.28using_systemd.29
Comment 1 Mike Gilbert gentoo-dev 2014-04-16 01:13:01 UTC
While I appreciate the effort, we are not going to add random units for network configuration.

With systemd-209+, we have systemd-networkd anyway, which makes this sort of ad-hoc configuration obsolete.