<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, Apr 14, 2025, 17:03 Hadmut Danisch <<a href="mailto:hadmut@danisch.de">hadmut@danisch.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>

  

    
  
  <div>
    <p>Hi, <br>
    </p>
    <p>a technical question:</p>
    <p><br>
    </p>
    <p>I'd like to build a router on a machine with four ethernet and
      one wlan adapter,  using Ubuntu 24.04 server, coming with
      255.4-1ubuntu8.6.  I need to build a bridge with two of the
      ethernets and the wlan as an accesspoint, making use of as much
      default software as possible, i.e.  systemd, networkd, netplan. <br>
    </p>
    <p><br>
    </p>
    <p>Problem: </p>
    <p>It's easy to configure the wlan adapter as a client and put it in
      a bridge, but not as an access point.</p></div></blockquote></div></div><div dir="auto">I don't remember seeing client-mode wlan interfaces working as bridge members on regular Linux kernel. Did that change recently?</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p> <br>
    </p>
    <p><br>
    </p>
    <p>First attempt, straight forward, <span style="white-space:pre-wrap">/etc/netplan/60-bridge-lan.yaml</span></p>
    <pre>network:
  version: 2
  renderer: networkd
  
  ethernets:
    enp4s0:
      dhcp4: no
    enp5s0:
      dhcp4: no
      
  wifis:      
    wlp1s0:
      dhcp4: no
      access-points:
        "hurra":
           mode:  ap
           password: something
           
      
  bridges:
    lan:
      dhcp4: no
      addresses:
        - "<a href="http://192.168.122.1/24" target="_blank" rel="noreferrer">192.168.122.1/24</a>"
        - <a rel="noreferrer">"fdfc:1234:5678:1234::1/24"</a>
      interfaces:
        - enp4s0
        - enp5s0
        - wlp1s0


doesn't work:

ERROR: wlp1s0: hurra: networkd does not support this wifi mode</pre></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">As far as I know, the Linux kernel doesn't have a built-in implementation of WPA, and neither does networkd, so the only kind of AP that would be *technically possible* to configure this way would be the extremely obsolete WEP (i.e. static-keyed) – or of course a fully open network.</div><div dir="auto"><br></div><div dir="auto">This means that hostapd is effectively required in order to host an AP. (There are alternatives, I *think* iwd has support for being an AP, but hostapd is what you'll find in various off-the-shelf APs even.)</div><div dir="auto"><br></div><div dir="auto">For the same reason you can't manually set "ap" mode through the `iw` command either (technically you can, using the secret "__ap" keyword, but it won't do anything above WEP when configured that way).</div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><pre>




Second attempt, doing as many websites propose, running the wlan with hostapd and using it as a regular ethernet, i.e. removing the wifis section and using instead

  ethernets:
    enp4s0:
      dhcp4: no
    enp5s0:
      dhcp4: no
    wlp1s0:
      dhcp4: no

doesn't work either. Error message

2025-04-11T14:11:29.023613+00:00 mini20 systemd-networkd[1281]: wlp1s0:
Failed to set master interface: Device does not allow enslaving to a
bridge. Operation not supported


which is clearly wrong, since a manual

brctl addif lan wlp1s0

works properly</pre></div></blockquote></div></div><div dir="auto">These happen at different times, and it sounds like the interface is in different modes between the two commands. The same wlan interface can be bridged when it's in AP mode or in station+4addr mode, but cannot be bridged when it's in client mode.</div><div dir="auto"><br></div><div dir="auto">Let hostapd put the device in the bridge after it has switched it to AP mode; it has a dedicated option for that.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><pre>



Third attempt, not configuring the wifi with netplan at all, just listing it as a bridge interface, results in 

# networkctl 
IDX LINK   TYPE     OPERATIONAL SETUP     
  1 lo     loopback carrier     unmanaged
  2 enp3s0 ether    routable    configured
  3 enp4s0 ether    enslaved    configured
  4 enp5s0 ether    no-carrier  configured
  5 enp6s0 ether    off         unmanaged
  6 wlp1s0 wlan     degraded    unmanaged
  7 lan    bridge   routable    configured</pre></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">That doesn't sound like an issue. If I remember correctly, older networkd displayed 'degraded' for externally bridged interfaces, but newer versions don't?</div><div dir="auto"><br></div><div dir="auto">Either way, if the ports are bridged, they *definitely* don't need any IP-level configuration, so even if networkd thinks the interface is 'degraded' that is fine for a bridge port.</div><div dir="auto"><div class="gmail_quote gmail_quote_container"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><pre>


man pages  systemd.netdev and systemd.network don't help either.






So my question is: 


What is the correct and supposed way to build a bridge interface with ethernets and a wifi access point with systemd and networkd?




Thank you and best regards
Hadmut




</pre>
    <p></p>
  </div>

</blockquote></div></div></div>