On 12/22/2013 08:26 PM, Nathan Coulson wrote: > On Sun, Dec 22, 2013 at 10:26 AM, Armin K. <kre...@email.com> wrote: >> On 22.12.2013 19:14, Armin K. wrote: >>> On 22.12.2013 18:49, Bruce Dubbs wrote: >> >> [snip] >> >>>> >>>> This brings up a question. How does systemd handle bringing up a bridge >>>> and attaching an ethernet connection? In BLFS we do: >>>> >>>> ONBOOT=yes >>>> IFACE=br0 >>>> SERVICE="bridge ipv4-static" # Space separated >>>> IP=192.168.0.22 >>>> GATEWAY=192.168.0.1 >>>> PREFIX=24 >>>> BROADCAST=192.168.0.255 >>>> CHECK_LINK=no # Don't check before bridge is created >>>> STP=no # Spanning tree protocol, default no >>>> INTERFACE_COMPONENTS="eth0" # Add to IFACE, space separated devices >>>> IP_FORWARD=true >>>> >>>> and the ifup, bridge, and ipv4-static scripts handle it. How is this >>>> done with systemd? >>>> >>>> -- Bruce >>>> >>> >>> Not sure, systemd runs "/sbin/ifup interface" at boot, but requires the >>> "/etc/sysconfig/ifconfig.interface" and interface in /sys/class/net or >>> whatever to be present in order to start it. We might need different >>> unit to configure bridge, and that one might need to have a dependency >>> on classic ifupdown service that configures the interface, so the bridge >>> configuration is started after the interface has been configured properly. >>> >>> I am curious is this how lfs does it? First, it brings up the interface >>> that's being bridged, then it creates the bridge? >> >> I've just looked at lfs /etc/init.d/network and it seems it does the >> same for every interface - runs ifup $interface if >> /etc/sysconfig/ifconfig.$interface exists. Systemd allows to enable >> ifup/ifdown per-interface, but it checks that network interface must be >> present in /sys/subsystem/net/device and I don't think that this would >> work for br0, since it is being created by ifup script, am I right? The >> workaround would be just to remove checking for interface in >> /sys/subsystem/net/device. IIRC, Debian doesn't check for it either. >> >> LFS systemd uses same ifup/ifdown scripts as in LFS, so everything >> should work as it does in standard LFS. Except that you'd need to run, >> eg systemctl enable ifupdown@br0 to enable bridge interface, and that >> /etc/sysconfig/ifconfig.br0 exists with the contents as bridge-utils-1.5 >> page describes in BLFS. >> >> dhclient script works flawlessly with this though, since I've tested lfs >> systemd in a VMware VM. >> >> The fix for bridge to work is simply to remove line 3 from the systemd >> service file: >> >> http://wiki.linuxfromscratch.org/lfs/browser/branches/systemd/BOOK/network-scripts/lfs/units/ifupdownat.service >> >> If anyone cares to verify this, I'd be grateful. I don't have either a >> static ip setup nor a need for bridging interfaces since I use a laptop >> with wifi. >> -- >> http://linuxfromscratch.org/mailman/listinfo/lfs-dev >> FAQ: http://www.linuxfromscratch.org/faq/ >> Unsubscribe: See the above information page > > Confirmed, removing the check to see if the interface exist is > necessary to create a network bridge. (either that, or create an > alternative ifupdown that does not check to see if the network device > exists) >
Well, it should be safe to just remove it, since udevadm trigger is ran in sysinit.target, whereas ifupdown is ran in multi-user.target. sysinit target won't be activated before udevadm trigger has finished because of this: Before=sysinit.target, and I believe that multi-user.target shouldn't start before sysinit.target has finished its startup. Thanks for verifying. -- Note: My last name is not Krejzi. -- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page