I get internet from my wireless wlan0 and I would like to forward it to eth0 which is connected to another laptop. How can I do that? Thanks.

Edit: my wireless card is intel:

0b:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)


You can enable routing. Run this as root

 echo 1 > /proc/sys/net/ipv4/ip_forward

Give manual ip addresses to both ethernet ports, the wireless-connected laptop's IP address becomes the "gateway IP" for the other one. make sure they have the same subnet masks. and the kernel would do the remaining magic.


Sounds like you want to bridge the connections. Depending on your distribution there is a "right" way to configure this such that it will come up on every boot.

Quick and dirty at the command-line, though:

brctl addbr br0
brctl addif br0 eth0
brctl addif br0 wlan0

More info: http://www.linuxfoundation.org/en/Net:Bridge

Not all wireless cards will work with this. Your wireless NIC needs to allow its sending MAC address to be "forged". Your mileage may vary.

If you want to keep communicating from the computer with the wireless NIC in it you're probably going to have to assign an IP address to the bridge, either statically or with DHCP. I don't recall exactly how Linux bridging works and I don't have a box handy.

Edit: I can't tell you if that card will work or not. Give it a try and see. If it doesn't, to kill the bridge do a:

brctl delbr br0
  • I tried that but it cut off my wireless connection. – jbunch Jul 2 '09 at 21:42
  • 1
    Bridging will only work if the wireless interface is in master or wds mode, not if it's in "managed" or "adhoc". Wifi essentially "abuses" the ethernet mac addresses as its own addresses, so you can't use it transparently as a bridge (that's what WDS mode is for). This is a feature. – MarkR Jul 2 '09 at 21:55
  • Hmm... Sounds like I'm off-base then. (I thought I recollected that some wireless NICs supported forging their MAC address.) I'm assuming that putting the NIC into AP mode would work, too, but I doubt that most wireless chipsets in PCs support AP mode. – Evan Anderson Jul 2 '09 at 22:18
  • tried setting my card to master or WSD but I get that: # iwconfig wlan0 mode master Error for wireless request "Set Mode" (8B06) : SET failed on device wlan0 ; Invalid argument. – jbunch Jul 2 '09 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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