netctl icon indicating copy to clipboard operation
netctl copied to clipboard

Question: Add a new device "later" to the bridge

Open MaStr opened this issue 10 years ago • 3 comments

Hi, I want to know, If it is possible to create profiles like this:

bridge_interface

   Connection=bridge
   Interface=br0
   BindsToInterface=()
# As the device is running dhcp-server
   SkipForwardingDelay=yes

ethernet interface has two profiles lan_bridge_member

   Connection=ethernet
   Interface=eth0
   ExecUpPost="brctl add br0 eth0"    # Consider this as a working command, I haven't looked it up
   ExecDownPre="brctl  remove br0 eth0"  # Consider this as a working command, I haven't looked it up
   IP=no
   IP6=no

lan_dhcp

   Connection=ethernet
   Interface=eth0
   IP=dhcp

I want to have a more flexible configuration of PirateBox on the RaspberryPi, so I want to let all the PirateBox-Services run against br0. During the startup of PirateBox I'll add the hostapd-driven Hotspot interface wlan0 to the bridge br0.

The owner can easily decide, if he want to have a separate dhcp driven interface on the ethernet-port or should it be attached on the PirateBox-driven bridge with running the related netctl/systemd startup command

to make ethernet as a separate dhcp interface
netctl disable  lan_bridge_member
netctl enable lan_dhcp
to make ethernet as a part of PirateBox
netctl disable lan_dhcp
netctl enable  lan_bridge_member

(I would create a script for that, that uses is-enabled and so on)

Makes that sense? Is there an easier way then using ExecDown.. ExecUp... ?

Thanks for your feedback in advance

Matthias

MaStr avatar Aug 27 '14 07:08 MaStr

My use case for this: host-only networking for VMs. Bridge needs to start empty (no enslaved interfaces) at boot, then later the hypervisor adds tap* devices to it. Creating empty bridge works just fine in NetworkManager, but not in netctl:

~: cat /etc/netctl/bridgevm 
Description="Bridge for virtual machines"
Interface=bridgevm
Connection=bridge
BindsToInterfaces=()
IP=static
Address='10.152.152.1/18'
Gateway='10.152.152.1/18'
~: netctl start bridgevm 
Job for [email protected] failed because the control process exited with error code.
See "systemctl status [email protected]" and "journalctl -xe" for details.
~: systemctl status [email protected][email protected] - Networking for netctl profile bridgevm
   Loaded: loaded (/usr/lib/systemd/system/[email protected]; static; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2018-08-12 11:26:50 MSK; 5s ago
     Docs: man:netctl.profile(5)
  Process: 2306 ExecStart=/usr/lib/netctl/network start bridgevm (code=exited, status=1/FAILURE)
 Main PID: 2306 (code=exited, status=1/FAILURE)

Aug 12 11:26:50 arch systemd[1]: Starting Networking for netctl profile bridgevm...
Aug 12 11:26:50 arch network[2306]: Starting network profile 'bridgevm'...
Aug 12 11:26:50 arch network[2306]: Interface 'bridgevm' does not exist
Aug 12 11:26:50 arch network[2306]: Failed to bring the network up for profile 'bridgevm'
Aug 12 11:26:50 arch systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Aug 12 11:26:50 arch systemd[1]: [email protected]: Failed with result 'exit-code'.
Aug 12 11:26:50 arch systemd[1]: Failed to start Networking for netctl profile bridgevm.

alex3kov avatar Aug 12 '18 08:08 alex3kov

Your status messages include Interface 'bridgevm' does not exist. This message can only appear when the Connection= type is ethernet. Are you sure you are starting the profile you think you are?

joukewitteveen avatar Aug 29 '18 09:08 joukewitteveen

Your status messages include Interface 'bridgevm' does not exist. This message can only appear when the Connection= type is ethernet

Indeed, I had a second Connection= line in the config by accident, which I guess overrode the first one. Problem at 8th network level :)
Creating empty bridge works fine for me.

alex3kov avatar Aug 30 '18 09:08 alex3kov