5

Ubuntu 14.04

Basically I am trying to accomplish the following setup -

wireless internet ---> wlan0 of Ubuntu computer "bridged to" wlan1 of same Ubuntu computer ---> device with wifi

The reason for this setup is that the wireless internet is a WPA2 Enterprise network which my device with wifi cannot connect to. (The device with wifi also cannot connect to peer-to-peer networks or ad-hoc networks.) Also, the wireless internet source has no whitelist / blacklist and therefore there is no issue with it seeing the device's MAC address (if necessary), and no issue with it assigning an IP address to the device (if necessary). It is the device that has an issue with WPA2 Enterprise authentication.

[EDIT - As the device cannot successfully authenticate, the wireless internet source is NOT likely to assign an IP address to the device, and also likely to take issue with seeing the device's MAC address.]

wlan0 is an Intel wireless chipset / interface which cannot be set to either access point mode or master mode, and therefore is used to connect to the WPA2 Enterprise internet source.

wlan1 is to be set to access point mode.

Obviously, the "bridge" between wlan0 and wlan1 is not meant to be wireless, as both are on the same computer.

(1) I believe brctl cannot bridge a wireless interface (wlan0) to another wireless interface (wlan1). Is this correct?

(2) If brctl cannot be used, can I still use hostapd?

(3) If brctl cannot be used, what should I be looking for to accomplish the setup described above?

(4) Would any of the following be a part of the solution to my problem - (a) dnsmasq to serve DHCP (b) hostapd (c) static IP address (for wlan1 ???) (for the device connected to wlan1 ??) (d) NAT (Network Address Translation) (e) iptables (f) IP Masquerade (g) sudo iw set dev wlan0 4addr on (h) WDS (wireless distribution system) (i) IP Forwarding ?

Thank you.

5

(1) I believe brctl cannot bridge a wireless interface (wlan0) to another wireless interface (wlan1). Is this correct?

The requirement here is that all interfaces must be able to send packets with any source MAC address, and receive packets with any destination MAC (not just the device's own).

Wi-Fi AP interfaces can be bridged just fine (most "wireless routers" in fact have a plain Linux bridge between AP and Ethernet). Station-mode interfaces, however, cannot. So you can bridge wlan1 but not wlan0.

There's a way around it – the "4addr" mode aka "WDS" mode, which adds an extra MAC address field to Wi-Fi frames. You can enable it via iw, as long as your Wi-Fi driver supports it. Once enabled, you will be able to bridge wlan0 as well.

However, for security reasons, many APs don't allow 4addr mode by default. (Some have a general toggle, some have a MAC-based whitelist.) Will it work with your university AP? Try it and see.

(Another workaround is "arpnat" – like NAT but applied to MAC addresses – but it can confuse DHCP servers, and it's not supported by regular Linux anyway. Some APs, like PicoStation, support it in station mode.)

(2) If brctl cannot be used, can I still use hostapd?

Depends on your Wi-Fi driver. Most of them should support AP mode nowadays, but not all do. Use iw phy0 info, iw phy1 info to find out.

(3) If brctl cannot be used, what should I be looking for to accomplish the setup described above?

The most common alternative approach would be IP NAT (masquerading) using iptables.

In some cases, regular routing (without NAT) would also work.

(4) Would any of the following be a part of the solution to my problem

(a) dnsmasq to serve DHCP (b) hostapd (c) static IP address (for wlan1 ???) (for the device connected to wlan1 ??) (d) NAT (Network Address Translation) (e) iptables (f) IP Masquerade (g) sudo iw set dev wlan0 4addr on (h) WDS (wireless distribution system) (i) IP Forwarding ?

yes, no, no, yes, maybe, maybe, what, uh, are you just throwing assorted terms here?

3
  • The internet source disconnects wlan0 when wlan0 has 4addr turned on. I believe this means that the 4addr (WDS) suggestion will not work for me. Please correct me if I am wrong. I will pursue the IP-NAT-masquerading-iptables proposal, but just a quick check - what about ebtables instead? – sean Oct 14 '15 at 12:27
  • [Solved] iptables in place of brctl works. Issue closed. – sean Oct 16 '15 at 6:47
  • @sean can you please expand on your iptable solution? I tried this, but with ethernet for the 2nd interface, and I can't ping beyond the hardware wireless router. – James Hirschorn Jan 7 '17 at 20:03
0

You can bridge wireless interfaces using brctl without any problem:

brctl addbr br_name
brctl addif br_name wlan0
brctl addif br_name wlan1 

But you will need to refer the bridge br_name itself, not to the separate interfaces in you network config.

12
  • You will have br-name interface with it's own IP, etc. If you want to configure it e.g. in /etc/network/interfaces you need to refer the bridge as an interface. Same with dnsmasq, etc. – Pilot6 Oct 13 '15 at 9:48
  • My current config in /etc/network/interfaces is - auto br0 iface br0 inet static address 192.168.1.252 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.254 bridge-ports wlan0 wlan1 Given that I'm specifying the details of br0 in /etc/network/interfaces (see above), how do I "refer (to) the bridge as an interface"? Is the above config for /etc/network/interfaces ok? Will br0 have an IP add of 192.168.1.252, and is it ok to specify bridge-ports wlan0 wlan1 ? Can wlan0 receive a dynamic IP from the internet source? What is wlan1 IP? – sean Oct 13 '15 at 10:13
  • If you bridge two interfaces, they will not have separate IPs. The bridge will have the IP for both ports. – Pilot6 Oct 13 '15 at 10:23
  • wlan0 has to receive a dynamic IP when connecting to the internet source. Do I then specify iface br0 inet dhcp instead of iface br0 inet static and also remove all specific IP address numbers from /etc/network/interfaces ? – sean Oct 13 '15 at 10:41
  • That's correct. – Pilot6 Oct 13 '15 at 10:43

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.