You are not logged in.

#1 2013-04-18 11:31:13

moscar
Member
Registered: 2012-03-12
Posts: 23

[SOLVED] How to start a bridge interface at boot with netctl?

How do I start a bridge interface at boot?

Right now I have netctl-ifplugd@<interface>.service enabled, and that works fine.

When I do

# netctl start bridge

It also works fine. But if i enable that profile and reboot I have no connection at the end of boot.

This is what ip addr outputs in the different stages described above: http://sprunge.us/MgKH

my two netctl profiles look like this:

bridge:

Description="KVM Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(enp9s0)
IP=dhcp
## sets forward delay time
#FWDDelay=0
## sets max age of hello message
#MaxAge=10

Ethernet:

Description='A basic static ethernet connection'
Interface=enp9s0
Connection=ethernet
IP=static
Address=('1.3.3.75/24')
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='1.3.3.7'
DNS=('8.8.8.8' '8.8.4.4')

## For IPv6 autoconfiguration
#IP6=stateless

## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

Am I doing something wrong, or is something not working like it should?

Last edited by moscar (2013-04-19 18:46:31)

Offline

#2 2013-04-18 18:50:54

Mantichore
Member
Registered: 2012-11-04
Posts: 19

Re: [SOLVED] How to start a bridge interface at boot with netctl?

Same problem here, but with solution:

The problem ist, ifplugd only recognizes the connection based on /proc/net/dev. br0 isn't listed in here, so you need to "map" your hardware to br0 in the scripts called by ifplugd. This is a quick and dirty solution for my needs (only one networkprofile for wired network), but should work for you as well.

First of all change /etc/ifplugd/netctl.action:

[[ "$Interface" == "$1" && "$Connection" == "ethernet" ]] || continue
#to
[[ "$Interface" == "br0" && "$Connection" == "bridge" ]] || continue

If you plug in your cable, ifplugd will execute this script. In each situation it will look for Interface=br0 and Connection=bridge.

Then you need to enable netctl-ifplugd@eth0.service, ifplugd@eth0.service and multi-user.target (multi-user.target seems not to be nessesary; just destroyed my kdm startup).

This should work with all profiles using bridge. Don't know if there are any problems when you use multiple wired profiles.

Last edited by Mantichore (2013-04-18 19:01:24)

Offline

#3 2013-04-18 22:31:51

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 948

Re: [SOLVED] How to start a bridge interface at boot with netctl?

@moscar:
When an interface is part of a bridge, you can't assign IP to it. So, you either start an ethernet profile, or a bridge, but not both. So, having br0 on DHCP and a real interface which is part of br0, on static IP makes no sense. What are you trying to accomplish?
@Mantichore:
If you use netctl-ifplugd@<iface>.service, you don't need ifplugd@<iface>.service. Also, the reason why multi-user.target disabled kdm is because kdm belongs to graphical.target (=runlevel 5), while multi-user.target is equivalent to runlevel 3.

So, I guess for your purposes you only need to change "ethernet" to "bridge", without touching "$1"... is this right?


Arch Linux is more than just GNU/Linux -- it's an adventure

Offline

#4 2013-04-19 18:46:19

moscar
Member
Registered: 2012-03-12
Posts: 23

Re: [SOLVED] How to start a bridge interface at boot with netctl?

@Leonid.l

This makes sense, I was trying to setup a bridge to use with virtual machines. I simply disabled everything netctl related and use: netctl enable bridge with the profiles listed above untouched. I don't know why I haven't tried this before, because it works fine.

Thanks for the help.

Offline

#5 2013-04-23 19:22:12

Mantichore
Member
Registered: 2012-11-04
Posts: 19

Re: [SOLVED] How to start a bridge interface at boot with netctl?

Leonid.I wrote:

So, I guess for your purposes you only need to change "ethernet" to "bridge", without touching "$1"... is this right?

Nope. This script is called "/etc/ifplugd/netctl.action $interface_which_changes_state $state". br0 is never $interface_which_changes_state because it is only a virtual interface.

messages.log:

...
Apr 23 20:07:39 chimaira ifplugd(eth0)[1028]: Executing '/etc/ifplugd/ifplugd.action eth0 up'.
...

Offline

#6 2013-04-23 21:47:49

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 948

Re: [SOLVED] How to start a bridge interface at boot with netctl?

I am clearly not getting something.. If you only change "ethernet" to "bridge", and then start netctl-ifplugd@br0.service, $1 will be br0, no? Why do you have to hardcode $1?


Arch Linux is more than just GNU/Linux -- it's an adventure

Offline

#7 2013-04-24 09:11:12

Mantichore
Member
Registered: 2012-11-04
Posts: 19

Re: [SOLVED] How to start a bridge interface at boot with netctl?

ifplugd calls ifplugd.action with the interface which comes up, this is eth0. There is no change on the state of br0 because it is down as long as I doesn't startup eth0. So how should netctl-ifplugd@br0.service be started without the physical interface is down?

Or in other words: You can't plug a cable into br0, so netctl-ifplugd@br0.service has no effect.

Offline

#8 2013-04-29 13:44:42

bsujja
Member
From: Thailand
Registered: 2013-01-27
Posts: 18

Re: [SOLVED] How to start a bridge interface at boot with netctl?

I'm trying to switch my kvm box from netcfg to netctl. I have only bridge profile like below:

Description="Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(eth0)
IP=dhcp

When I use:

netctl start bridge

It doesn't work. I can't get the proper error messages because I had to switch back to netcfg. From reading this thread, do I need another profile ethernet?:

Description='A basic dhcp ethernet connection'
Interface=eth0
Connection=ethernet
IP=dhcp

If both profiles are needed, how do I start the profiles and how do I enable auto start at boot?

Last edited by bsujja (2013-04-29 13:45:22)

Offline

#9 2013-04-29 19:38:54

Mantichore
Member
Registered: 2012-11-04
Posts: 19

Re: [SOLVED] How to start a bridge interface at boot with netctl?

What's the error message?

Offline

#10 2013-04-30 01:16:02

bsujja
Member
From: Thailand
Registered: 2013-01-27
Posts: 18

Re: [SOLVED] How to start a bridge interface at boot with netctl?

Ok I installed netctl and removed netcfg again. I have 2 profiles: br0 and eth0 as above. I then issued:

netctl start br0

and my putty screen stalled. Connection to the box no longer worked. I rebooted the box via vps control panel. Surprisingly, everything works again. I didn't even do "netctl enable br0" before reboot. Here are my netctl status reports:

[root@wisekvm1 ws]# netctl status eth0
netctl@eth0.service - Networking for netctl profile eth0
   Loaded: loaded (/usr/lib/systemd/system/netctl@.service; static)
   Active: inactive (dead)
     Docs: man:netctl.profile(5)

Apr 30 07:17:32 wisekvm1.wiselumen.com systemd[1]: Starting Networking for netctl profile eth0...
Apr 30 07:17:32 wisekvm1.wiselumen.com network[13069]: Starting network profile 'eth0'...
Apr 30 07:17:32 wisekvm1.wiselumen.com network[13069]: The interface of network profile 'eth0' is already up
Apr 30 07:17:32 wisekvm1.wiselumen.com systemd[1]: netctl@eth0.service: main process exited, code=exited, status=1/FAILURE
Apr 30 07:17:32 wisekvm1.wiselumen.com systemd[1]: Failed to start Networking for netctl profile eth0.
Apr 30 07:17:32 wisekvm1.wiselumen.com systemd[1]: MESSAGE=Unit netctl@eth0.service entered failed state.

[root@wisekvm1 ws]# netctl status br0
netctl@br0.service - Networking for netctl profile br0
   Loaded: loaded (/usr/lib/systemd/system/netctl@.service; static)
   Active: inactive (dead)
     Docs: man:netctl.profile(5)

Apr 29 06:43:52 wisekvm1.wiselumen.com systemd[1]: Started Networking for netctl profile br0.
Apr 30 07:11:59 wisekvm1.wiselumen.com systemd[1]: Starting Networking for netctl profile br0...
Apr 30 07:11:59 wisekvm1.wiselumen.com network[12973]: Starting network profile 'br0'...
Apr 30 07:12:00 wisekvm1.wiselumen.com network[12973]: Started network profile 'br0'
Apr 30 07:12:00 wisekvm1.wiselumen.com systemd[1]: Started Networking for netctl profile br0.
Apr 30 07:18:06 wisekvm1.wiselumen.com systemd[1]: Started Networking for netctl profile br0.
Apr 30 07:19:52 wisekvm1.wiselumen.com systemd[1]: Stopping Networking for netctl profile br0...
Apr 30 07:19:52 wisekvm1.wiselumen.com network[13112]: Stopping network profile 'br0'...
Apr 30 07:19:52 wisekvm1.wiselumen.com network[13112]: Stopped network profile 'br0'
Apr 30 07:19:53 wisekvm1.wiselumen.com systemd[1]: Stopped Networking for netctl profile br0.

Looks like I don't need eth0 profile?

Update
It seems one of the netctl services automatically created during installation is responsible for launching the profiles in /etc/netctl directory during boot.

[root@wisekvm1 ws]#systemctl list-unit-files

..........
netctl-auto@.service                   disabled
netctl-ifplugd@.service                disabled
netctl-sleep.service                   disabled
netctl.service                         disabled
netctl@.service                        static
.........

Update2

[root@wisekvm1 ws]#journalctl -b
..........
May 01 23:36:00 wisekvm1.wiselumen.com dhcpcd[136]: version 5.6.7 starting
May 01 23:36:00 wisekvm1.wiselumen.com dhcpcd[136]: forked to background, child pid 142
May 01 23:36:10 wisekvm1.wiselumen.com dhcpcd[142]: eth0: sending IPv6 Router Solicitation
May 01 23:36:10 wisekvm1.wiselumen.com dhcpcd[142]: eth0: rebinding lease of 23.29.127.116
May 01 23:36:11 wisekvm1.wiselumen.com dhcpcd[142]: eth0: acknowledged 23.29.127.116 from 192.211.50.194
May 01 23:36:11 wisekvm1.wiselumen.com dhcpcd[142]: eth0: checking for 23.29.127.116
..........

From above boot journal, netctl is not needed at all, and it is dhcpcd that does this simple wired connection through eth0 at boot. So I uninstalled netctl altogether and my kvm box stays connected even after reboot.

Last edited by bsujja (2013-05-01 02:06:06)

Offline

#11 2013-05-10 05:03:03

zatricky
Member
From: Cape Town
Registered: 2008-09-03
Posts: 55
Website

Re: [SOLVED] How to start a bridge interface at boot with netctl?

So is this a bug in the package? I'd prefer not to have to merge this fix every time I update netctl.

I was using a custom script that used brctl but I figured I should try using netctl.

In my case I think the correct fix may actually be to NOT enable netctl-ifplugd@br0 but rather to enable netctl-auto@br0. This is because -ifplugd specifically checks if the interface is plugged in, hence why the kludge appears to work. I'll test using netctl-auto is working on my next boot.


pacman russian roulette: yes | pacman -Rcs $(pacman -Q | LANG=C sort -R | head -n $((RANDOM % 10)))
(yes, I know its broken)

Offline

#12 2013-05-14 12:31:37

zatricky
Member
From: Cape Town
Registered: 2008-09-03
Posts: 55
Website

Re: [SOLVED] How to start a bridge interface at boot with netctl?

Well ... that didn't work. I'll just be using my old script which works out of the box. When there's documentation on how to do bridging without a kludge then maybe I'll try it with netctl. tongue


pacman russian roulette: yes | pacman -Rcs $(pacman -Q | LANG=C sort -R | head -n $((RANDOM % 10)))
(yes, I know its broken)

Offline

#13 2013-05-14 13:47:31

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,617

Re: [SOLVED] How to start a bridge interface at boot with netctl?

Maybe I don't understand the problem, because I switched from netcfg to netctl with no problem. I have two bridge profiles and an ethernet profile. Bridge profiles:

$ cat /etc/netctl/net0b
Description="Internet bridge"
Interface=net0b
Connection=bridge
BindsToInterfaces=(net0)
IP=dhcp

$ cat /etc/netctl/net3b
Description="Intranet bridge"
Interface=net3b
Connection=bridge
BindsToInterfaces=(net3)
IP=static
Address=('199.200.1.110/24')

I enabled each with netctl enable <profile>.

$ systemctl list-unit-files |grep netctl
netctl-auto@.service                   disabled
netctl-ifplugd@.service                disabled
netctl-sleep.service                   disabled
netctl.service                         disabled
netctl@.service                        static  
netctl@net0b.service                   enabled 
netctl@net1.service                    enabled 
netctl@net3b.service                   enabled

$ netctl status net0b
netctl@net0b.service - Internet bridge
   Loaded: loaded (/etc/systemd/system/netctl@net0b.service; enabled)
   Active: active (exited) since Tue 2013-05-14 08:53:23 EDT; 35min ago
     Docs: man:netctl.profile(5)
  Process: 346 ExecStart=/usr/lib/network/network start %I (code=exited, status=0/SUCCESS)
   CGroup: name=systemd:/system/netctl@.service/netctl@net0b.service
           └─533 dhcpcd -qL -t 10 net0b

$ netctl status net3b
netctl@net3b.service - Intranet bridge
   Loaded: loaded (/etc/systemd/system/netctl@net3b.service; enabled)
   Active: active (exited) since Tue 2013-05-14 08:53:18 EDT; 50min ago
     Docs: man:netctl.profile(5)
  Process: 343 ExecStart=/usr/lib/network/network start %I (code=exited, status=0/SUCCESS)

But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#14 2013-05-14 14:11:07

zatricky
Member
From: Cape Town
Registered: 2008-09-03
Posts: 55
Website

Re: [SOLVED] How to start a bridge interface at boot with netctl?

Not sure why you're doing a bridge interface if you're not bridging anything. Here's mine though, of course, I'm not actually using it:

$ cat /etc/netctl/br0
Description="Example Bridge connection"
Interface=br0
Connection=bridge
BindsToInterfaces=(eth0 eth1)
IP=dhcp

Last edited by zatricky (2013-05-14 14:11:41)


pacman russian roulette: yes | pacman -Rcs $(pacman -Q | LANG=C sort -R | head -n $((RANDOM % 10)))
(yes, I know its broken)

Offline

#15 2013-05-14 14:51:30

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,617

Re: [SOLVED] How to start a bridge interface at boot with netctl?

LOL, the other people who posted their profiles are doing the same thing. In my case (and OP's) the bridges are for use with qemu.

Anyway, the important thing is that I'm not using netctl-ifplugd as most people seem to be doing. I don't even have ifplugd installed. I simply enabled all my profiles with netctl enable <profile>.


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#16 2013-08-01 01:32:14

nharward
Member
Registered: 2012-03-10
Posts: 2

Re: [SOLVED] How to start a bridge interface at boot with netctl?

I've offered a patch to /etc/ifplugd/netctl.action to resolve this, see this bug report for the patch.
I'm also using bridging for QEMU only, and can now properly start/enable netctl-ifplugd@eth0.service, plugging and unplugging the cable to my heart's content.
If someone tries this patch and it fails please let me know - I only have one system I can test on with a single physical interface.
It may go haywire on a system with a real bridge using more than one (physical) interface.

Offline

Board footer

Powered by FluxBB