Ubuntu – How to properly set up a network bridge using bridge-utils using wlan0 as the internet “source”

network-bridge

Hey everyone this is my first post so go easy on me.

I currently have a laptop with Ubuntu Studio 12.04 Beta 2 that is supplying a wireless internet connection to a windows 7 desktop computer that's connected directly to the laptop through Ethernet.
I'm using the "shared to other computers" method in network manager but I believe it doesn't work with what I want to do. I would like to have the windows computer on the same subnet as every other computer in my house (192.168.1.x) so I can use LAN applications (MIDI over WiFi, Bonjour etc.) on the windows computer without having to run a massive cable to the router.

I've been googling endlessly and tried multiple configurations in the /etc/network/interfaces file without success. All of them would report "cannot add wlan0 to bridge"

This is the last configuration I tried:

auto lo
iface lo inet loopback

auto eth0
auto wlan0
auto br0

iface wlan0 inet dhcp
    wireless-essid 3GF2
    wireless-key passw*rd
    wireless-mode managed

iface eth0 inet manual
up ip link set eth0 up

iface br0 inet manual
    bridge_ports wlan0 eth0

Is there a specific way to make this work? What am I missing?

Thank you

Best Answer

You can do the same thing by forwarding packets from ethernet card to wireless card. In order to do that, [wlan0 - wireless card; eth0 - ethernet card].

Do this on your ubuntu machine.

  1. ifconfig eth0 192.168.1.1 (or whatever you want)
  2. Enable ip_forward by echo 1 > /proc/sys/net/ipv4/ip_forward

  3. Enable forwarding in IPTABLES by iptables -A FORWARD --in-interface wlan0 -j ACCEPT

  4. Enable NAT mode to connect to internet by iptables --table nat -A POSTROUTING --out-interface eth0 -j MASQUERADE

On your windows machine set IP to 192.168.1.2 and gateway to 192.168.1.1 (ubuntu eth0 ip address)

No need to create bridges

Related Question