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! 🙂

 

 

 

libgcc_s.so.1 must be installed for pthread_cancel to work — cPanel Apache error

The other day I ran into the error “libgcc_s.so.1 must be installed for pthread_cancel to work.” Apache on this cPanel server would produce “Internal Server 500” for any web page. When I checked the /usr/local/apache/logs/error_log, I found the following entry:

[Thu Jul 17 03:51:41 2014] [error] [client 12.34.56.78] libgcc_s.so.1 must be installed for pthread_cancel to work
[Thu Jul 17 03:51:41 2014] [error] [client 12.34.56.78] Premature end of script headers: index.php
[Thu Jul 17 03:51:42 2014] [error] [client 12.34.56.78] libgcc_s.so.1 must be installed for pthread_cancel to work
[Thu Jul 17 03:51:42 2014] [error] [client 12.34.56.78] Premature end of script headers: index.php
[Thu Jul 17 03:51:42 2014] [error] [client 12.34.56.78] libgcc_s.so.1 must be installed for pthread_cancel to work

The fix was only a Google search away. cPanel’s own forum had the fix here. I’ve consolidated the fix into a short shell script that you can just copy and paste. But first, understand what it does. In WHM, you can go to Home » Service Configuration » Apache Configuration » Memory Usage Restrictions and setup Resource Limits (RLimitMEM and RLimitCPU) to, well, limit CPU and memory resources.

The problem comes when sometimes, it doesn’t work as intended. So, you have to remove it. The easiest way is to edit /usr/local/apache/conf/httpd.conf, remove or comment out the RLimit lines, distill it and restart Apache. That’s what this script does, using sed to make the edit. It’s faster and it’s more precise, and it’s reversible (since I only commented out the lines rather than remove them.)

sed -i 's/^RLimit/#RLimit/g' /usr/local/apache/conf/httpd.conf
/usr/local/cpanel/bin/apache_conf_distiller --update
service httpd restart

You only need to log in to a shell prompt as root, and paste in the script. Make sure to press Enter after the “service httpd restart” to make sure Apache restarts. This should eliminate the error “libgcc_s.so.1 must be installed for pthread_cancel to work”.

Did this fix work for you? Share it with your friends using the link below, and leave a comment and let me know!

Mechanical Keyboard Review: Monoprice Mechanical Gaming Keyboard

Mechanical Keyboard: A long time coming (back)

That’s how I’d describe my journey to the mechanical keyboard. But before I go into that, lets back up about 20 years to the mid 90’s. Or even farther, to about 1991. I was a teenager at the time and making money refurbishing XT/AT’s and 286’s. I came across a lot of derelict machines but I always paid attention when I saw an old IBM Model M mechanical keyboard. Those things were heavy, loud, and pretty nice to type on. I wasn’t much of a touch typist back then though and didn’t really think much about them.

Eventually I quit seeing those in my day to day work and they somewhat faded from the scene. Fast forward to “modern” times, around 2010. The mechanical keyboard is enjoying a surge in popularity. I looked at the price of such gems as “das keyboard” and about choked. No, I can’t justify spending (or afford to spend) more than $100 on a keyboard when a $15 keyboard will suffice. But that wasn’t the end of it.

IBM Model M Keyboard

IBM Model M Keyboard

My interest was still piqued and I kept an eye out for articles. I came across this article at ARS Technica: “Why I use a 20-year-old IBM Model M Keyboard” last year and that made me wonder even more why these keybaords have such a following. I didn’t remember a mechanical keyboard as being that amazing.

Present Day

I type a lot at work. I’m now a supervisor at a really awesome web hosting company, and so I communicate with customers and also with employees and coworkers, and since I work from home, about 98% of that communication is via chat. So yeah. I type a lot these days. I’ve been using Microsoft’s “Comfort Curve 3000 for Business” for several years and have found these keyboards to be ok for the most part. I like the ergonomics of them and they generally work. Recently though they have not done ok. A few months ago the keyboard started getting sticky, and I attributed that to several soda and food spills over time. So, I purchased a new one. Oddly, it was the same way. I took my old one apart, lovingly washed it in the sink and let it dry and put it all back together. It was the same. Typing was becoming a real chore. So, I decided that it was time to look into a mechanical keyboard again.

I did some basic google searches and came up with this excellent guide on Reddit: “So you want to buy a mechanical keyboard” and saw an option I’d never seen before: The Monoprice Mechanical Gaming Keyboard. I checked the site, and it was only $60! I had been researching standard keyboards from Logitech and they were in the $45 range, and so this mechanical keyboard was hardly a stretch. And, it wasn’t over $100 like many others.

It got great reviews at Monoprice, so I went ahead and plunked down the cash. On checkout, I saw a spot for a coupon code, and a quick Google search awarded me a 10% off coupon. With shipping I paid $61 and change. So, how is it?

The Review

UPS arrived right in the middle of a shift, and I hurredly unplugged my current Microsoft keyboard and plugged in the new Monoprice Mechanical Keyboard. The first thing I noticed: This sucker is heavy! Its not some plastic hunk of junk keyboard. It has some heft to it!

The Monoprice Mechanical Keyboard

The Monoprice Mechanical Keyboard

I had been concerned about the Cherry MX Blue switches being a bit on the loud side, but the clickety-click of my typing is not bad at all. In fact, my wife is a little jealous of it. That’s a good thing- I was worried it would annoy her to death, since my office is in our bedroom.

Typing is very nice. The best part is that you don’t have to completely depress a key in order for it to type. And you know each time a finger triggers a key because its a real difference in feel when the key actually engages. The spring that holds it up gives way in a very distinct way (its called a Collapsing Spring mechanical keyboard for a reason) and its quite pleasant to type on. I find myself floating along the keys rather than pounding them. Gone is that sticky feeling of the Microsoft keyboard.

The only negative thing about this mechanical keyboard is that because it is marketed to gamers, it has blue LED’s for Num Lock, Caps lock and Scroll lock. You know, those blue ones that light up a whole room at night. I often work in low light and found them to be quite distracting. My solution? Some electrical tape over the lights, with a small notch cut out so that just a little bit of light peeks through. Even so, I have to make sure that the Num Lock is turned off at night or there is a huge blue spot on the ceiling.

Overall I’m very happy with my purchase. I’ve never shopped at Monoprice before and so it was good to be exposed to another vendor that I can use in the future. The mechanical keyboard is great and is honestly everything I though it would be. I hope you enjoy yours!