Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

When running Windows I was able to bridge my wifi connect through my laptops Ethernet connection so a range of ethernet only devices could piggy back off my wifi (Raspberry Pi, Xbox etc etc). I am now trying to do the same within Ubuntu, i.e the set up would be:

Wireless Router ---> Wifi on laptop ---> bridge to Ethernet ---> Device that needs internet plugged into Ethernet port

Now I have been trying to get this working in Ubuntu using brctl

I used the below command:

sudo brctl addif br0 eth0 wlan0

And get the following error:

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

I am hoping someone can help as I refuse to believe something I can do in windows very easily can't be done in Linux.

If you need any more info do let me know. Thanks

share|improve this question
    
Very similar Problem handled in [askubuntu.com/questions/155041/… –  Legionair May 20 '13 at 22:11

4 Answers 4

This cannot be done. You cannot bridge a WiFi client connection. If you could, we wouldn't need WDS, we'd just bridge.

The problem is very simple -- an access point is prohibited by the WiFi specifaction from broadcasting traffic over the WiFi network unless something authorizes that transmission. This is largely a relic from the days when WiFi networks were very slow and had poor, if any, security.

The bridge only has a client connection to the access point. This only authorizes the access point to transmit traffic bound for the bridge. Because any machines connected to the bridge are not clients of the access point, the access point has no reason to send traffic bound for them over the WiFi link. So it will not do so.

Unfortunately, WiFi is enough like Ethernet that it's easy to expect it to act like Ethernet. But it's just different enough to bite you.

WDS configuration is a specific authorization for an access point to send traffic not bound for any of its clients. When both ends support WDS, they include the address of the bridging endpoint as well as the address of the destination, authorizing the access point to send the traffic.

You have to use something other than bridging to do this. Routing with NAT, for example. You can also use four address mode, if both ends of the WiFi link support it.

share|improve this answer
1  
You can solve this problem by re-writing the mac addresses with ebtables –  ccarton Oct 26 '13 at 11:24

I think what you really need is not a bridge but either:

  • SNAT (if WLAN has a static IP) (see this page )

or

  • MASQUERADE (if WLAN has dynamic IP - that is, IP changes)

1) create forwarding_enable_file.sh with the following content:

#!/bin/bash
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

2) Run the file:

sudo ./forwarding_enable_file.sh

3) on the rest of the host specify your Ubuntu box as a gateway NOTE: if some of the boxes are also running Linux you can do it with this command:

sudo ip route add default via ubuntu-ip

where ubuntu-ip should be replaced by your ubuntu-box IP address i.e. 192.168.1.10

4) try pinging some IP, i.e. 8.8.8.8 from other hosts:

ping 8.8.8.8

5) check your DNS settings by pinging some domain, i.e.:

ping slivkoed.ru

6) if step 4) works and 5) doesn't, than you have problems with your DNS settings. in such case run with root privileges:

# echo "nameserver 8.8.8.8" > /etc/resolv.conf

Run step 5) again.

More information on resolv.conf can be found here.

share|improve this answer

You need to bring down the interfaces before bridging them.

ifconfig eth0 down

ifconfig wlan0 down

share|improve this answer
1  
Still get the same error with both interfaces down –  Zac Powell May 20 '13 at 20:30
    
@Zac Powell are you using Network-Manager? I had some past experiences that it might interfere. In that case you can try stopping the service, and bring it back up again afterwards –  Legionair May 20 '13 at 21:20
    
Yes I am, ok so i should try bringing them both down and stopping network-manager then doing the birdge and then bring everything back up? –  Zac Powell May 20 '13 at 21:21
    
yes, with service network-manager stop, then do your thing, start it again with service network-manager start –  Legionair May 20 '13 at 21:23
    
still not working :/ everything is shut down but still get the same error –  Zac Powell May 20 '13 at 21:26
sudo iw dev wlan1 set 4addr on
share|improve this answer
    
Care to explain how this solve OP's problem? –  Braiam Oct 13 '13 at 2:48
    
@Braiam My answer pretty much explains why this would work if it was supported by the AP. –  David Schwartz Oct 13 '13 at 3:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.