Bridge wireless network to LAN

Posted on

Problem :

I have a Linux box which is connected to internet and serves as an access point/router.

Lately wireless connection has been quite unstable, so I attached an USB dongle to my PC (which is connected via cable; also runs Linux) and used connman tethering feature to create another access point.

However, devices connected to this access point are behind NAT, so other devices on the network can’t ‘see’ them.

Now to the actual question: is it possible to bridge the access point to LAN so that it becomes a part of same network?

To make it clearer, I’ll provide an example. I have several VirtualBox VMs on my PC, which have a ‘Bridged Adapter’. These VMs actually receive an IP address from the DHCP server running on my internet box and other devices ‘see’ them as ordinary computers on the network.

How do I achieve the same thing with devices connected to a wireless access point on my PC?

Solution :

Yes, it’s possible to bridge a WLAN AP. (It’s not possible to bridge a WLAN station, which also gets asked frequently here).

Just create a normal bridge, and put both the AP (say, wlan0) and your LAN interface (say, eth0) inside the bridge:

ip link add br0 type bridge
ip link set wlan0 master br0
ip link set eth0 master br0
ip link set br0 up

You then give br0 the same addresses/netmasks that your eth0 had (ip addr add ...), and use br0 where you’ve used eth0 before. (Think of the bridge as an external piece of hardware with three ports, where br0 is the port that goes to Linux).

Make sure you only have a single DHCP server in the resulting single network segment.

Once everything works, replicate the working configuration which whatever your distro uses or you prefer to work with.

Careful, VirtualBox “Bridge Adapters” do something similar, but are not the same as Linux bridges.

Leave a Reply

Your email address will not be published. Required fields are marked *