Score:1

Bridging LAN and wireless using netplan

rs flag

I want to extend my network trough wifi to ethernet connected device. I have PC with Ubuntu 20.04 connected to PC2.

This is my setup:

 --------       ------                    ------         ------
 |Router|  <--> | AP |  <~~~~> WIFI <~~~> | PC |  <---> | PC2 |
 --------       ------                    ------         ------

I created netplan config

  • Connect to wifi
  • Bridge wifi and 2 eth ports.

netplan config:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp5s0:      #for debugging purposes only
      dhcp4: yes
      dhcp6: no
    enp6s0:
      dhcp4: no
      dhcp6: no
    enp7s0:
      dhcp4: no
      dhcp6: no
    switchport:
      match:
        name: wlp2s0
      mtu: 1280

  wifis:
    wlp2s0:
      dhcp4: no
      dhcp6: no
      access-points:
       "WIFI SSID":
         password: "super_secret_wifi_password"

  bridges:
    br0:
      dhcp4: yes
      mtu: 1280
      interfaces:
        - switchport
        - enp6s0
        - enp7s0
      parameters:
        stp: true

IP address is not assigned to bridge (br0). But if I delete the bridge and enable DHCP on wlp2s0, interface(wlp2s0) gets address.

What am I doing wrong?


Update 1:

bridge-utils is already installed.

brctl show br0

bridge name     bridge id               STP enabled     interfaces
br0         8000.0001297d6efa            yes             enp6s0
                                                         enp7s0

brctl addif br0 wlp2s0:

can't add wlp2s0 to bridge br0: Operation not supported

brctl addif br0 switchport

interface switchport does not exist!

'''

Thanks for your help in advance :)

dummyuser avatar
uy flag
Please install `bridge-utils` (if not already installed) and add the output of the following commands to your question: `brctl show br0`, `brctl addif br0 wlp2s0`, `brctl addif br0 switchport`
new_linux_explorer avatar
rs flag
HI @dummyuser. Thanks for trying to help =) I added command outputs in original post under "update 1"
dummyuser avatar
uy flag
Looks as expected. Your `wlp2s0` interface is not part of the bridge `br0`. That’s why the bridge does not get an IP address via DHCP from wlan. Even adding the `wlp2s0` manually fails. There are some articles on the internet indicating that bridging with wlan interfaces is not allowed. Your workaround with the switchport interface does not work too. So we know the reason, but we do not have a solution.
bd flag
maybe this snippet can help: https://gist.github.com/Jiab77/76000284f8200da5019a232854421564
Score:1
us flag

It's not clear exactly what has gone wrong here, but you cannot "add" your WiFi interface to an ethernet device using match. You should be listing wlp2s0 directly as a bridge member, not trying to use a switchport as an indirection.

us flag
Also, nothing in your config should configure an address on wlp2s0! You may have some other network config on the system that's conflicting with netplan
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.