What's new

Bridging wifi to lan on an acces point

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

EricW

New Around Here
For years I have always wanted to bridge my wifi interface to my lan network on my access point (or media server that also works as AP). The access point is then connected over ethernet cable to the router. I would like it that wifi clients connecting to the access point are connected to the exact same local network as if the were connected to the router. However access points do not work in this way. They set up their own local network. Trying to bridge anyway I found that in windows it is prohibited to add a wifi device to a bridge. In linux you can add it but it does not work well. The problem lies in layer 2 switches that are used on all local networks.

I finally programmed not one but two different solutions. As I have not found these solutions on the net before, I would like to share them to anyone that is interested. The following are solutions to the problems that appear when you have added the wifi interface on the same bridge as the lan ports and have connected a lan port of your router through ethernet cable to a lan port on the access point.

Why doesn't it work as expected? Why do you need to IPforward or use a NAT or something similar? When you add the wifi interface to the AP bridge the following happens:

Your wifi client was first connected to your wireless router. Let's say you use your phone to test it. Look at the Forwarding DataBase (FDB) on both your router and AP by typing 'bridge fdb show' on a command prompt when possible. Locate your phones MAC address and see how network packets get send through the bridges on your network.

Now connect your phone to the wifi on your AP (make it forget about the router wifi so it does never try to connect to it again). The wifi connection to the AP is made but there everything stops. No IP is retrieved through dhcp. Why not? Look at the FDB on both bridges again and notice that nothing has changed. All network packet are still being send to the router as if your phone is still connected to your router. This is why network traffic is not working at the moment. Of course you would be googling for and trying for some answers and after a X amount of minutes, you found it, it works again somehow, but you cannot figure out why. Look at your bridges FDB again and see the situation has changed. All packets are now send to the AP and everything works, including DHCP and other services that only work on local network like DLNA and mDNS, etc. But now if you connect to the router again this connection does not work anymore.

What happened is after a certain amount of minutes the FDB entries are cleaned up if they have not been used and everything works again until you switch from AP to wireless router or from wireless router to AP.

If you want to change from router to AP more smoothly you will need to apply some fix. I have 2 solutions for this problem.

1. FDB Deamon It deletes the MAC address from the FDB on all bridges whenever a wifi client connects/disconnects to hostapd for a wifi connection. You need to be able to install the bridgefdbd program on your AP AND also on your wireless router. Your wifi client gets the same MAC and IP number on router and AP.

2. Mc Spoof It applies a technique called MAC spoofing. Your wifi client gets a different MAC and IP number on the wireless router then on the AP. It adds a fixed number to the mac address of the wifi client. You only need to install it on all AP's and wireless router, except one, usually your wireless router. If you cannot install custom software on your wireless router, this is the way to go. It is however more of a hack and is likely to break more easily.

I hope sharing these program source codes is of your interest.
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top