# How to make an ethernet-wifi bridge ?

## Gabriel_Blake

I want to do the following and I don't know how to do it exactly.

- my laptop (Gentoo) is connected via wifi with dhcp

- my laptop uses wicd to manage wireless

- another device is connected to my laptop with a crossed ethernet cable 

I want my laptop to bridge(?) the ethernet network to the wifi network in such a way that they form one network. The ethernet device should get it's ip address via dhcp of the wifi network. How can this be done ?

Thanks for any help  :Smile: 

----------

## massimo

Maybe [1] gets you moving in the right direction.

[1] Bridging Network Interfaces

----------

## Gabriel_Blake

```

brctl addif br0 wlan0

can't add wlan0 to bridge br0: Operation not supported

```

So much of that... I works on eth0 but not on wlan0 - bridging wired adapters only apparently. 

Any other suggestions ?

----------

## Logicien

What you want to do is to put the Ethernet on the same network then the Wireless one using the Wireless Dhcp server to do it. In a bridge, all ifs share the same IP address. You cannot have one for Ethernet and an other for Wireless that way.

You do not have to create a bridge to share the Internet connection who come from Wireless with the Wire one. Set manually, I mean set statics locales IP addresses on the Ethernet network to a different subnet then the Wireless one. Than, use a firewall rule to allow Network Address Translation (NAT) for Ethernet requests.

I never had to put a wireless card in a bridge. I do not know the state of it. I could miss the solution you need.

----------

## Aiken

Have been doing this with my eeepc. I could not add wlan0 to br0 until I did "iw dev wlan0 set 4addr on". My ap is a normal computer running hostapd with a usb wifi adaptor. Authentication is wpa2 + ccmp. As the eeepc is normally a wifi client I have left it's normal network config alone and use a separate script to kill wicd and manually use wpa_supplicant to connect to the ap and setup the bridge.

```

wpa_supplicant -B -b br0 -i wlan0 -c wpa.conf -Dwext

iw dev wlan0 set 4addr on

brctl addif br0 wlan0

```

Earlier in the script makes sure all drivers are loaded, br0 is setup and later in the script uses dhcpcd to set up the eeepc's networking. Any computers I have had connected to eth0 had normal access to the rest of my network including their own configuration via dhcp.

The hostapd computer creates wlan0.sta and adds that it it's bridge when then eeepc turns 4addr on. Only problem I have had so far is when the eeepc gets turned off the hostapd computer removes both wlan0 and wlan0.sta from it's bridge which kills wifi for anything using that ap. At the moment I have something monitoring this bridge and if wlan0 is missing it adds it back to the bridge.

The other way I use this add a 2nd wifi adaptor to the eeepc and run up hostapd on the 2nd adaptor. This gives me a portable ap with a wireless link back to my main ap.

----------

