Mini-How-To Turn My Laptop Into A Wifi Access Point

From Sfvlug

Yeah, right! I'm sitting in my hotel room with my wife and my brother-in-law and there's a note sitting on the table, Wifi Internet access is available, for only $12.95 per day per computer. Or, $11.95 per day in three day blocks. Do the math here folks, that's $358.50 per month. Do you pay that much at home? Of course not, so how do they justify such an exorbitant fee? I just happen to be a person who doesn't like getting ripped off, and that, to me, is a rip off. I also happen to be a person with an EVDO card. Plus I happen to be a Linux user, so here goes.

First of all, I just connect my laptop to the Internet with my EVDO card. That's fine, but my brother-in-law wants to get online as well, and he's got Vista (your pity is already understood). Next, I connect one of those Airlink AR-430W routers I brought with me to my ThinkPad.

So here's the situation with the AR-430W, it will act as a DHCP server to the wireless network it creates, as well as being a DHCP client to its uplink provider. My solution is to actually double NAT. I created a simple network between the router and my laptop, and also turned my laptop into a router.

Next, configure the ThinkPad as a router, DHCP server, and DNS server. It only takes three steps to make this happen, enable the sysctl for routing, masquerade the outbound packets, and fire up dnsmasq. I know the AR-430W router is issuing DHCP addresses on the 192.168.1.0/24 network, so I picked 172.16.1.0/24 as the middle network.

service NetworkManager stop
ifconfig eth0 172.16.1.1 up
dnsmasq -a 172.16.1.1 -F 172.16.1.2,172.16.1.2
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -o ppp0 -j MASQUERADE

Now, packets from the AR-430W NAT from their 192.168.1.x address to 172.16.1.2, and on their way to the Internet, NAT from 172.16.1.2 to whatever IP my EVDO card has. This is really simple stuff, actually. I just needed a place to write this down so next time I'm travelling and need this, I can easily access it.


Jeff

Personal tools