Linux – Bridging the laptop’s wireless and wired adaptors

bridgelinuxnat;networkingwindows

I would like to be able to connect a desktop computer that does not have a wireless adapter to my wireless network.

I could just run a network cable from my ADSL/wireless router to the desktop computer but sometimes this is not practical.

What I would really like to do is bridge my laptop's wireless and wired adapters in such a way that I can run a network cable from my laptop to a switch and another network cable from the switch to a desktop computer so that the desktop computer can access the Internet through my ADSL/wireless router via my latop:

+--------------------+
|ADSL/wireless router|
+--------------------+
    |
+-------------------------+
|laptop's wireless adaptor|
|                         |
|laptop's wired adaptor   |
+-------------------------+
    |
+------+
|switch|
+------+
    |
+-----------------------+
|desktop's wired adapter|
+-----------------------+

A bit of Googling suggests that I can do this by bridging my laptop's wireless and wired adapters.

In Windows XP's Network Connections I select both the Local Area Connection and the Wireless Network Connection, right click and select Bridge Connections.

From what I gather, this (layer 2?) bridge will examine the MAC address of traffic coming from the wireless network and pass it through to the wired network if it suspects that a network adapter with that MAC address may be on the wired side, and vice-versa.

If this is the case, I would assume that when the desktop computer attempts to get an IP address from a DHCP server (which is running on the ADSL/wireless router), it would send a DHCP broadcast packet which would pass through the laptop's bridge to the router and the reply would return through the laptop's bridge back to the desktop.

This doesn't happen.

With some more Googling I find some instruction how this can be done with Linux. I reboot to Ubuntu 9.10 and type the following:

sudo apt-get install bridge-utils
sudo brctl addbr br0
sudo brctl addif br0 wlan0
sudo brctl addif br0 eth0
sudo ipconfig wlan0 0.0.0.0
sudo ipconfig eth0 0.0.0.0

Once again, the desktop cannot reach the ADSL/wireless router.

I suspect that I'm missing some simple important step. Can anyone shed some light on this for me?

Best Answer

I would prefer to get the bridge working under Ubuntu so I'm still searching for answers, but I was able to get the bridge to work on Windows XP.

After bridging the Local Area Connection and the Wireless Network Connection I opened a command prompt and typed the following:

netsh bridge show a

This listed my Local Area Connection with an ID of 1 and my Wireless Network Connection with an ID of 2. The ForceCompatibilityMode of my Wireless Network Connection was shown as Unknown so I typed the following:

netsh bridge set a 2 e

This enabled my Wireless Network Connection. The desktop computer was able to get itself an IP address from the DHCP server on the router. As it turned out, the IP address that it got was the same as the IP address that my Wireless Network Connection usually gets which caused Windows to complain of an IP address conflict on the network. I gave my desktop computer a static IP address and all was well. The desktop computer and the laptop can now both use the Internet.

Related Question