netplan doesn't use bridge when connecting with wlan0

Bug #1769668 reported by shemgp
40
This bug affects 7 people
Affects Status Importance Assigned to Milestone
Netplan
Confirmed
Undecided
Unassigned

Bug Description

I plan to bridge wifis, ethernets, and lxd so that lxd can get IP from the network either through the wired network or wireless device whichever is connected. However, in my Ubuntu 18.04 laptop, both devices (wlan0 and eths) gets IPs and the bridge0 is not created.

Here's my config:

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp0s25:
      renderer: NetworkManager
      dhcp4: no
      dhcp6: no
  wifis:
    wlan0:
      renderer: NetworkManager
      match: {}
      access-points:
        "open network": {}
  bridges:
    bridge0:
      renderer: NetworkManager
      dhcp4: yes
      dhcp6: yes
      interfaces: [wlan0, enp0s25]

ifconfig
...
enp0s25: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
        inet 192.168.7.118 netmask 255.255.255.0 broadcast 192.168.7.255
        inet6 fd03:66e4:3fc5:0:6867:adf5:b827:ffd0 prefixlen 64 scopeid 0x0<global>
        inet6 fd03:66e4:3fc5::fec prefixlen 128 scopeid 0x0<global>
        inet6 fe80::347a:5d1a:a066:e888 prefixlen 64 scopeid 0x20<link>
        inet6 fd03:66e4:3fc5:0:f6b9:d6fc:d4e8:9914 prefixlen 64 scopeid 0x0<global>
        ether 3c:97:0e:e1:34:41 txqueuelen 1000 (Ethernet)
        RX packets 10601 bytes 8187079 (8.1 MB)
        RX errors 0 dropped 0 overruns 0 frame 0
        TX packets 10713 bytes 1395573 (1.3 MB)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
        device interrupt 20 memory 0xf2500000-f2520000
...
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
        inet 192.168.7.119 netmask 255.255.255.0 broadcast 192.168.7.255
        inet6 fd03:66e4:3fc5:0:e140:91d:72ea:1922 prefixlen 64 scopeid 0x0<global>
        inet6 fe80::bed0:6dff:57f8:6c83 prefixlen 64 scopeid 0x20<link>
        inet6 fd03:66e4:3fc5:0:4024:b6e:8329:e579 prefixlen 64 scopeid 0x0<global>
        inet6 fd03:66e4:3fc5::fec prefixlen 128 scopeid 0x0<global>
        ether 84:3a:4b:8e:e5:30 txqueuelen 1000 (Ethernet)
        RX packets 110 bytes 17212 (17.2 KB)
        RX errors 0 dropped 0 overruns 0 frame 0
        TX packets 134 bytes 39630 (39.6 KB)
        TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Thanks for the help.

Revision history for this message
Ryan Harper (raharper) wrote :

Hello shemgp ,

Thank you for your report and trying to help make Ubuntu better.

I need some additional information to help make progress on this bug.

1. Could include the steps to reproduce this state?
2. Did you run 'netplan apply' after creating the configuration you've included?
3. Could you attach the output from 'nmcli conn'
4. Could you attach the output from 'journalctl -b -u NetworkManager.service'

Thanks

Changed in netplan:
status: New → Incomplete
Revision history for this message
shemgp (shemgp) wrote :
Download full text (3.8 KiB)

Steps:
1. Removed ifupdown package
2. Added /etc/netplan/01-netcfg.yaml with the contents:
network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s25:
      renderer: NetworkManager
      dhcp4: no
      dhcp6: no
  wifis:
    wlan0:
      renderer: NetworkManager
      match: {}
      access-points:
        "open network": {}
  bridges:
    bridge0:
      renderer: NetworkManager
      dhcp4: yes
      dhcp6: yes
      interfaces: [wlan0, enp0s25]

3. Run sudo netplan generate
4. Run sudo netplan apply

Here's the output of nmcli conn:
NAME UUID TYPE DEVICE
anbox-net 2b948c29-7dee-4fd5-8945-ce55400c23b6 bridge anbox0
docker0 298acc1f-0486-4725-a75c-a34c6d69df62 bridge docker0
lidwo 04fdde89-b0f7-4a4c-8635-15b2abb9e345 wifi wlan0
lxdbr0 9020191f-c00c-4ad9-a1d7-f7d520cbab26 bridge lxdbr0
netplan-bridge0 82469cd2-fc51-3f75-93c3-6ca133ea7980 bridge bridge0
360 81ecdcfe-4324-4efd-9c64-5e3e58a46ac4 wifi --
AIIAS de47ba58-03ec-4254-bba4-5acb80a9613c vpn --
AIIAS-Auditorium a223ee38-2bfc-42d5-a273-7145ed04f0ba wifi --
AIIAS-Function Hall c39c7404-3aa1-4a9e-807a-60133d8e39f5 wifi --
AIIAS-GradSch 2G 1c7e7e24-ef9d-4022-8910-c3435c4412d4 wifi --
AIIAS-IT WiFi e35b55a5-803e-460d-98c1-c102ca29d6e9 wifi --
AIIAS-Unifi aca99a49-0bc6-4182-b4d6-80b86b133e77 wifi --
AIIAS-Unifi 1 f45fbc95-1c06-4605-9694-9248ea82582f wifi --
AIIAS-Unifi Academy 3b750b9f-ae0d-43a0-9f2b-4121ee4bf954 wifi --
AIIAS-Unifi Academy 1 3cd5dbe1-a3ae-4f1f-94be-2585d0586454 wifi --
AIIAS-Unifi Gym c7bb0057-57e8-4c7b-86b7-cac12c1f609b wifi --
AIIAS-WAP e94402ad-47c1-40cd-bf3a-1dd145ff26d0 wifi --
AIIAS-WAP 1 afc89158-5385-4d82-8fa5-20563b4e419d wifi --
ALLie Go-0359 8072082d-cb67-4d29-9484-2ee457c82605 wifi --
Aurea Pasamba f353db38-973a-4e8c-8cfd-e534d8d7bae3 wifi --
Captive portaled b4e54e69-75ec-4ef8-bfe3-62bd253c8f4f wifi --
ChinaNet-6041 beb81f88-0f41-4d32-8f5b-3793f701f4d6 wifi --
HUAWEI-9BAB-2.4G 2957d00a-0780-429b-8825-8a6883e9828b wifi --
Hotspot f7934408-2ba4-42c6-9d10-e636e291745f wifi --
Hotspot 0f806060-8f73-4e1a-b7ed-99664b520e22 wifi --
Hotspot b23a3805-7f6f-4145-89b7-df2adc428660 wifi --
LEDE 3e3ad8ba-5d55-4c4e-827a-b9a18f606e06 wifi --
PLDTHOMEFIBR_7f9370 7d1a0c88-32aa-4665-bf33-bdcfbcd69f49 wifi --
SM_Free_WiFi e01a04d4-9835-4bf8-9da1-b9cd5c799c1...

Read more...

Revision history for this message
shemgp (shemgp) wrote :

Here's the output of nmcli conn

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for netplan because there has been no activity for 60 days.]

Changed in netplan:
status: Incomplete → Expired
Daniel Axtens (daxtens)
Changed in netplan:
status: Expired → New
Trent Lloyd (lathiat)
Changed in netplan:
status: New → Confirmed
Revision history for this message
Trent Lloyd (lathiat) wrote :

I can confirm this on Ubuntu 19.04 (disco devel). I have a simpler configuration of creating a single bridge with a single Ethernet port.

When starting NetworkManager in debug mode (pass --debug) the files from /run/NetworkManager/system-connections don't seem to be parsed at all.

I noticed the files in this direction created by the system end in ".nmconnection" so I renamed the files "netplan-br0" and "netplan-switchports" to end in .nmconnection and restarted NetworkManager, then the files are read and some attempt at applying the configuration is applied.

It doesn't seem to work fully, in that eno1 still has an IP and is not on the br0 bridge. But the bridge is at least created. That suggests to me there is at least partly a problem in how the configuration is being applied to NetworkManager in terms of the name of the files - there may perhaps be other additional issues.

Here is a simplified configuration file I used to demonstrate the issue (my real configuration disables STP and uses a static IP instead of DHCP)

network:
  version: 2
  renderer: NetworkManager
  ethernets:
    switchports:
      match: {name: "eno1"}
      dhcp4: false
  bridges:
    br0:
      interfaces: [switchports]
      dhcp4: true
      parameters:
        stp: false

Revision history for this message
Trent Lloyd (lathiat) wrote :

I'm not sure this is the same bug.. as I found the cause for this and it shouldn't have affected 18.04. So I am creating a new bug:
https://bugs.launchpad.net/ubuntu/+source/netplan.io/+bug/1817655

There may still be separate issues with the bridge integration which I will come back to once this issue is fixed.

Revision history for this message
shemgp (shemgp) wrote :

One thing I've learned about netplan, when using it with NetworkManager and bridges, is to delete the connection created by NetworkManager, but not created by netplan, in NetworkManager using nmtui first. Then do netplan generate, and netplan apply, then, very important, restart NetworkManager.

Except that it doesn't work with wlan0 and eth0's[1] but Debian docs says it can be made to work 2 ways[2][3]. So I guess, I'm asking those to be implemented in netplan too. Thanks for you help.

[1] https://serverfault.com/questions/152363/bridging-wlan0-to-eth0
[2] https://wiki.debian.org/BridgeNetworkConnections#Bridging_with_a_wireless_NIC
[3] https://wiki.debian.org/BridgeNetworkConnectionsProxyArp

Revision history for this message
shemgp (shemgp) wrote :

Btw, with my technique, the wlan0 connects, but the bridge doesn't allow it to be added, and errors out with:

May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <info> [1557038833.0120] device (wlan0): supplicant interface state: associating -> completed
May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <info> [1557038833.0121] device (wlan0): Activation: (wifi) Stage 2 of 5 (Device Configure) successful. Connected to wireless network "lidwo"
May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <info> [1557038833.0123] device (wlan0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <warn> [1557038833.0128] platform-linux: do-change-link[3]: failure changing link: failure 95 (Operation not support
ed - Device does not allow enslaving to a bridge)
May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <warn> [1557038833.0128] device (wlan0): Activation: connection 'netplan-wlan0-lidwo' could not be enslaved
May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <info> [1557038833.0131] device (wlan0): state change: ip-config -> failed (reason 'unknown', sys-iface-state: 'managed')
May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <info> [1557038833.0136] manager: NetworkManager state is now DISCONNECTED
May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <info> [1557038833.0139] device (wlan0): released from master device br0
May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <warn> [1557038833.0141] device (wlan0): Activation: failed for connection 'netplan-wlan0-lidwo'
May 5 14:47:13 shemgp-x230t NetworkManager[26742]: <info> [1557038833.0144] device (wlan0): state change: failed -> disconnected (reason 'none', sys-iface-state: 'managed')

And that's how I got to know the different difficulties and solutions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.