IPhone Tethering – Use and Abuse!

This is the geeky sequel to my last Linux to IPhone tethering episode where we used and abused the IPhone tethering function.

Some background, I’m one of those people who contracted (and got stuck) with the 50G SingTel Mobile Broadband Plan before the days of 12GB IPhone plan. My usage was about 4G per month, so none of the plans was suitable for me at that time.

Anyway, that aside. For some reasons my team had to work in a place where we had no internet access while we are building the network for high speed internet access. What irony! The only systems engineer in the team (me) decided that I had alot of data to spare, so here we go…use and abuse!

Configuration’s simple. First you have to setup tethering as per my previous post on IPhone tethering. Once you are done with that, do the follow steps. And again, it’s a 5 minute quick hack.

1. vi linux-router.sh

2. Paste the following into the shell script

#!/bin/bash
/sbin/ifconfig wlan0 192.168.0.1 255.255.255.0
/sbin/iptables -t nat -A POSTROUTING -o bnep0 -j MASQUERADE
/sbin/iptables -A FORWARD -i bnep0 -o wlan0 -m state –state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i wlan0 -o bnep0 -j ACCEPT

3. Save the file.
4. chmod 700 linux-router.sh
5. ./linux-router.sh
6. Done!

My colleagues are connected to a WIFI router, hence the use of wlan0 as the “inside” interface. bnep0 is the “outside” interface connected to the IPhone via bluetooth. All the machines point to my laptop as the gateway, which bears the IP address 192.168.0.1. All of them are NAT’d out from the outside interface.

I have 2Mbps for my plan. Good enough for the team to check email and do some simple web browsing for information.

There are other things you can do like transparent proxying so that you save abit of bandwidth.

Leave a comment if you have any questions on the configurations. Have fun!

Author: yibi

YiBi's numb :) YiBi writes about anything. Technology, Gossips, Rubbish YiBi's a half f%#k geek :P

Comments

Optimization WordPress Plugins & Solutions by W3 EDGE