Using a Linux Laptop as a Wireless Bridge

Is it possible to use Linux for a Wireless Bridge? You bet! Last night one of our USB wireless adapters kicked the bucket. Being down one, I decided to see if I could come up with a creative solution rather than plunk down another $20 that I may or may not have right now. One of the things in my inventory is a Linux laptop (Remember Project 50/50?) that has no problem connecting to my WiFi.

I suspected that there would be a way to route Ethernet traffic from my desktop PC (running Windows 7) through the Ethernet on the laptop, and through its WiFi connection. The laptop already has CrunchBang Linux running on it (a Debian derivative.) Thanks to IPTables, this was a simple task.

First, I ran an Ethernet cable between the Ethernet port on my desktop PC and the laptop. Because of Modern Technology I didn’t even have to use a crossover cable. I configured the PC with the IP of 192.168.2.2, Subnet Mask 255.255.255.0, Gateway of 192.168.1.1 and DNS of 8.8.8.8 and 8.8.4.4.

Then, with the WiFi already connected via the Linux GUI, I ran the following shell script as root:

ifconfig eth0 up
ifconfig eth0 192.168.2.1
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -s 192.168.2.0/24 -j MASQUERADE

Voila! We have a bridged connection. The only trouble was that Network-Manager kept putting eth0 down because it was not configured. This was solved by running

sudo nm-connection-editor

and then selecting “Wired conneciton 1” and then “Edit…” and then unchecking “Connect Automatically.” This solved that problem.

Since this is only a temporary solution, I haven’t set it up to automatically do the routing every time the system boots. But, it works for now and is a simple, elegant solution. Plus it saved me $20!

I hope this works well for you. If you have any questions, please don’t hesitate to comment below! 🙂

 

 

 

4 comments

Skip to comment form

  1. Do you have a members list? Where is it if you have one for newsletters? My email address is: gig_lake27_lake@yahoo.com.

    Thank you.

    1. I don’t understand all that is below this “Comment” box so I probably don’t belong on your members list.

      I want you to know that I used your SFC.EXE /scannow about going through the Registry and adding the “I” I can’t remember the file. It worked and I am very grateful to you for that “scannow” tip.

      Thank you very much,

      Sincerely,

      Georgia Maples

  2. I don’t belong on your website. But I did want to thank you so much for the wrong disk, sfc.exe. how to fix it so I could use the sfc.exe /scannow. I used every once in a while.

    You wouldn’t know if there is a fix with the scannow, a command prompt where I can fix my shortcut files from LNK so I can open them. I can’t open them when they have the LNK on the end.

    If you could, I would appreciate it very much.

    Sincerely,

    Georgia Maples

    1. I’d be glad to help you fix the broken .lnk association. What error do you get when you try to open them?

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.