0

I'd like to set up a home server with several responsibilities

  • Wireless AP for local networking
  • Ethernet switch for local networking of various devices (HTPC, networked printer, etc)
  • Home firewall and internet gateway
  • general file server and more (not related to this question)

I have a machine with a 4 port ethernet card, as well as two ethernet ports on the motherboard. I've plugged in a USB wireless adpator capable of AP mode.

root@dagda:~# ifconfig -a | grep flags
enp3s0f0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
enp3s0f1: flags=4098<BROADCAST,MULTICAST>  mtu 1500
enp4s0f0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
enp4s0f1: flags=4098<BROADCAST,MULTICAST>  mtu 1500
enp7s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
enp8s0: flags=4098<BROADCAST,MULTICAST>  mtu 1500
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
wlx24050ff70bf6: flags=4098<BROADCAST,MULTICAST>  mtu 1500

My fiber modem is connected to enp7s0 via ethernet, which has a static IP address of 10.0.0.2 where the modem is 10.0.0.1, set up via netplan

root@dagda~# cat /etc/netplan/01-netcfg.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    enp7s0:
      dhcp4: no
      dhcp6: no
      addresses: [10.0.0.2/24, ]
      gateway4:  10.0.0.1
      nameservers:
        addresses: [89.19.64.164, 89.19.64.36]

The wireless card is capable of access point mode

root@dagda:~# iw list | grep -A 5 "Supported interface modes"
    Supported interface modes:
         * IBSS
         * managed
         * AP
         * P2P-client
         * P2P-GO

and I have successfully managed to set up DNS and DHCP over the wireless interface directly so I know all that works, but what I'm trying to do is have one single IP address for the local networking side. I figured I should be able to bridge all the local interfaces (ethernet and wifi) then assign the bridge a static IP address and run dnsmasq on the bridge to provide DNS and DHCP to all local devices regardless of how they are connected, see diagram below

                         | ---------- home server ---------- |
                         |                                   |
                         |                 wlx24050ff70bf6   |
                         |                        ^          |
                         |                        |          |
internet <--> modem <--> | enp7s0 <--NAT--> br0 <-+          |
                         |                        |          |
                         |                        v          |
                         |                  enp[34]s0f[01]   |
                         |                                   |
                         | --------------------------------- |

My problem comes when I'm trying to create the bridge

root@dagda:~# brctl addbr br0
root@dagda:~# for p in 3 4; do
> for f in 0 1; do
> brctl addif br0 enp${p}s0f${f}
> done
> done
root@dagda:~# brctl show
bridge name bridge id       STP enabled interfaces
br0     8000.002655dbfd80   no      enp3s0f0
                            enp3s0f1
                            enp4s0f0
                            enp4s0f1
root@dagda:~# brctl addif br0 wlx24050ff70bf6
can't add wlx24050ff70bf6 to bridge br0: Operation not supported

I tried to find out why this might be happening, and came across this question on superuser in which an answer claims you can't bridge wifi and ethernet, however the weird thing is, if I set up the bridge in netplan (config below), I can add the wifi interface to the bridge, but then connecting to the wifi via my phone claims it's a WEP network, despite my settings in hostpad.conf explicitly allowing only WPA2. I cannot reproduce this now though, unfortunately.

I would like for my server to have an internal/local IP address of 192.168.0.1 regardless of which interface traffic comes in on. How can I achieve this?

https://superuser.com/questions/597834/bridging-wifi-to-ethernet-on-ubuntu-not-working

0

AHa! I figured it out. It's a matter of sequencing. hostapd needs to be running and to have put your wireless interface into AP mode. Once it's in AP mode, brctl ifadd br0 <wireless interface> works just fine.

Credit goes to mattbuford for this post

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.