Unable to create bridge within alpine container
kuhball opened this issue Β· comments
Hi, thanks for developing ifupdown-ng!
I'm currently trying to use ifupdown-ng within an alpine container on preferably podman or docker, and I am struggling to create a bridge. Looking at the docs this seems to be implemented π
Regarding the bridge configuration I have tried quite a few different scenarios. None of them created a bridge showing up in ip link show
.
Steps to reproduce the issue:
- Create Container:
β― podman run -it --rm --privileged alpine sh
011dd18472b7:/# apk add ifupdown-ng
- Create ifupdown config:
011dd18472b7:/# cat /etc/network/interfaces
auto br_default
iface br_default
bridge-vlan-aware yes
bridge-vids 10 20
bridge-pvid 1
- Run ifup:
011dd18472b7:/# ifup -a -f
ip: ioctl 0x8913 failed: No such device
ip: can't find device 'br_default'
debug log
Output of ifup -a -f -v
:
Click to expand
011dd18472b7:/# ifup -f -a -v
ifupdown: lo: attempting to run link executor for phase depend
/usr/libexec/ifupdown-ng/link
+ is_vlan
+ '[' -z ]
+ return 1
+ '[' '=' veth -a ]
ifupdown: lo: attempting to run loopback executor for phase depend
ifupdown: br_default: attempting to run link executor for phase depend
/usr/libexec/ifupdown-ng/link
+ is_vlan
+ '[' -z ]
+ return 1
+ '[' '=' veth -a ]
ifupdown: br_default: attempting to run bridge executor for phase depend
/usr/libexec/ifupdown-ng/bridge
ifup: acquiring lock on /run/ifstate.lo.lock
ifup: changing state of interface lo to 'up'
ifupdown: lo: attempting to run link executor for phase create
/usr/libexec/ifupdown-ng/link
+ '[' '=' dummy ]
+ '[' '=' veth ]
+ is_vlan
+ '[' -z ]
+ return 1
ifupdown: lo: attempting to run loopback executor for phase create
ifupdown: lo: attempting to run link executor for phase pre-up
/usr/libexec/ifupdown-ng/link
ifupdown: lo: attempting to run loopback executor for phase pre-up
/bin/run-parts /etc/network/if-pre-up.d
ifupdown: lo: attempting to run link executor for phase up
/usr/libexec/ifupdown-ng/link
+ IF_LINK_OPTIONS=
+ '[' -n ]
+ '[' -n ]
+ ip link set up dev lo
+ '[' ]
ifupdown: lo: attempting to run loopback executor for phase up
/bin/run-parts /etc/network/if-up.d
ifupdown: lo: attempting to run link executor for phase post-up
/usr/libexec/ifupdown-ng/link
ifupdown: lo: attempting to run loopback executor for phase post-up
/bin/run-parts /etc/network/if-post-up.d
ifup: acquiring lock on /run/ifstate.br_default.lock
ifup: changing state of interface br_default to 'up'
ifupdown: br_default: attempting to run link executor for phase create
/usr/libexec/ifupdown-ng/link
+ '[' '=' dummy ]
+ '[' '=' veth ]
+ is_vlan
+ '[' -z ]
+ return 1
ifupdown: br_default: attempting to run bridge executor for phase create
/usr/libexec/ifupdown-ng/bridge
ifupdown: br_default: attempting to run link executor for phase pre-up
/usr/libexec/ifupdown-ng/link
ifupdown: br_default: attempting to run bridge executor for phase pre-up
/usr/libexec/ifupdown-ng/bridge
/bin/run-parts /etc/network/if-pre-up.d
ifupdown: br_default: attempting to run link executor for phase up
/usr/libexec/ifupdown-ng/link
+ IF_LINK_OPTIONS=
+ '[' -n ]
+ '[' -n ]
+ ip link set up dev br_default
ip: ioctl 0x8913 failed: No such device
+ '[' ]
ifupdown: br_default: attempting to run bridge executor for phase up
/usr/libexec/ifupdown-ng/bridge
/bin/run-parts /etc/network/if-up.d
ip: can't find device 'br_default'
ifupdown: br_default: attempting to run link executor for phase post-up
/usr/libexec/ifupdown-ng/link
ifupdown: br_default: attempting to run bridge executor for phase post-up
/usr/libexec/ifupdown-ng/bridge
/bin/run-parts /etc/network/if-post-up.d
Hey,
have you tried adding bridge-ports none
to your configuration? I think the bridge executor is bailing out because it doesn't find a bridge-ports directive (https://github.com/ifupdown-ng/ifupdown-ng/blob/main/executor-scripts/linux/bridge#L263). :-)
I also tried that, yes. Here is the output of the commands:
ddce240a1460:/# cat /etc/network/interfaces
auto br_default
iface br_default
bridge-vlan-aware yes
bridge-vids 10 20
bridge-pvid 1
bridge-ports none
ddce240a1460:/# ifup -f -a
Cannot find device "br_default"
Device "br_default" does not exist.
And also the verbose output:
Click to expand
ifupdown: lo: attempting to run link executor for phase depend
/usr/libexec/ifupdown-ng/link
+ is_vlan
+ '[' -z ]
+ return 1
+ '[' '=' veth -a ]
ifupdown: lo: attempting to run loopback executor for phase depend
ifupdown: br_default: attempting to run link executor for phase depend
/usr/libexec/ifupdown-ng/link
+ is_vlan
+ '[' -z ]
+ return 1
+ '[' '=' veth -a ]
ifupdown: br_default: attempting to run bridge executor for phase depend
/usr/libexec/ifupdown-ng/bridge
ifup: acquiring lock on /run/ifstate.lo.lock
ifup: changing state of interface lo to 'up'
ifupdown: lo: attempting to run link executor for phase create
/usr/libexec/ifupdown-ng/link
+ '[' '=' dummy ]
+ '[' '=' veth ]
+ is_vlan
+ '[' -z ]
+ return 1
ifupdown: lo: attempting to run loopback executor for phase create
ifupdown: lo: attempting to run link executor for phase pre-up
/usr/libexec/ifupdown-ng/link
ifupdown: lo: attempting to run loopback executor for phase pre-up
/bin/run-parts /etc/network/if-pre-up.d
ifupdown: lo: attempting to run link executor for phase up
/usr/libexec/ifupdown-ng/link
+ IF_LINK_OPTIONS=
+ '[' -n ]
+ '[' -n ]
+ ip link set up dev lo
+ '[' ]
ifupdown: lo: attempting to run loopback executor for phase up
/bin/run-parts /etc/network/if-up.d
ifupdown: lo: attempting to run link executor for phase post-up
/usr/libexec/ifupdown-ng/link
ifupdown: lo: attempting to run loopback executor for phase post-up
/bin/run-parts /etc/network/if-post-up.d
ifup: acquiring lock on /run/ifstate.br_default.lock
ifup: changing state of interface br_default to 'up'
ifupdown: br_default: attempting to run link executor for phase create
/usr/libexec/ifupdown-ng/link
+ '[' '=' dummy ]
+ '[' '=' veth ]
+ is_vlan
+ '[' -z ]
+ return 1
ifupdown: br_default: attempting to run bridge executor for phase create
/usr/libexec/ifupdown-ng/bridge
ifupdown: br_default: attempting to run link executor for phase pre-up
/usr/libexec/ifupdown-ng/link
ifupdown: br_default: attempting to run bridge executor for phase pre-up
/usr/libexec/ifupdown-ng/bridge
/bin/run-parts /etc/network/if-pre-up.d
ifupdown: br_default: attempting to run link executor for phase up
/usr/libexec/ifupdown-ng/link
+ IF_LINK_OPTIONS=
+ '[' -n ]
+ '[' -n ]
+ ip link set up dev br_default
Cannot find device "br_default"
+ '[' ]
ifupdown: br_default: attempting to run bridge executor for phase up
/usr/libexec/ifupdown-ng/bridge
/bin/run-parts /etc/network/if-up.d
Device "br_default" does not exist.
ifupdown: br_default: attempting to run link executor for phase post-up
/usr/libexec/ifupdown-ng/link
ifupdown: br_default: attempting to run bridge executor for phase post-up
/usr/libexec/ifupdown-ng/bridge
/bin/run-parts /etc/network/if-post-up.d
My target configuration would be something like this:
auto vni10
iface vni10
bridge-access 10
bridge-learning off
vxlan-id 10
auto vni20
iface vni20
bridge-access 20
bridge-learning off
vxlan-id 20
auto vlan10
iface vlan10
vlan-raw-device br_default
vlan-id 10
auto vlan20
iface vlan20
vlan-raw-device br_default
vlan-id 20
auto br_default
iface br_default
bridge-ports vni10 vni20
bridge-vlan-aware yes
bridge-vids 10 20
bridge-pvid 1
But the creation of the vlan interfaces fails due to the missing vlan-raw-device br_default.
Hm, if I put
auto vni10
iface vni10
bridge-access 10
bridge-learning off
vxlan-id 10
auto vni20
iface vni20
bridge-access 20
bridge-learning off
vxlan-id 20
auto vlan10
iface vlan10
vlan-raw-device br_default
vlan-id 10
auto vlan20
iface vlan20
vlan-raw-device br_default
vlan-id 20
auto br_default
iface br_default
bridge-vlan-aware yes
bridge-vids 10 20
bridge-pvid 1
bridge-ports none
into /etc/network/interfaces
and run ifup -a
here I get
8: vni10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/ether be:8f:57:05:86:83 brd ff:ff:ff:ff:ff:ff
9: vni20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 4e:bb:65:3a:a5:ec brd ff:ff:ff:ff:ff:ff
10: br_default: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/ether 76:eb:be:f6:53:bc brd ff:ff:ff:ff:ff:ff
11: vlan10@br_default: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 76:eb:be:f6:53:bc brd ff:ff:ff:ff:ff:ff
12: vlan20@br_default: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 76:eb:be:f6:53:bc brd ff:ff:ff:ff:ff:ff
The same config does not work for you? If so which version of ifupdown-ng
are you using? :-)
Hi, sorry for the late reply.
I did some more testing. Building ifupdown-ng on either debian or alpine results in a working environment. Both example configurations are working fine.
When using the ifupdown-ng from the alpine package repositories (0.12.1) the described issues appear. Looking at the mentioned executer script located at /usr/libexec/ifupdown-ng/bridge
the content seems incorrect:
#!/bin/sh
case "$PHASE" in
depend)
if [ "$IF_BRIDGE_PORTS" != "none" ]; then
echo "$IF_BRIDGE_PORTS"
fi
;;
esac
Oh OK, paging @kaniini for the Alpine bits :-)
apk add bridge
. Alpine does not yet use the ifupdown-ng bridge executor, but rather a stub.
Thanks for the response, after adding the bridge
package everything works like expected.