Ubuntu Gateway / Access Point Server
May 30, 2009 on 5:54 pm | 7 CommentsI’ve been wanting to play wifi king for a long time. Providing free wireless internet access to a reasonable sized area. Finally I got to have a play.
The basic idea is to have a server which shares the internet from a standard connection (e.g DSL) to anyone who connects wirelessly. “You mean a wireless access point, why can’t I just buy a £30 wireless AP?”
Well..
Benefits of running our server over buying a standard wireless access point (AP):
Many run of the mill wireless APs fail under high traffic – With our server, we can use a better processor and increase RAM as required.
Caching – If you’re serving a lot of users then you can save on bandwidth and speed up users browsing experience by using a caching proxy like squid. Basically, when one user views a video on youtube (depending on your squid cache file size settings), squid makes a copy of it and then serves its copy to any future requests. This is quicker than downloading it from youtube and serving it to the client again. You can configure file sizes and cache file life time.
Filtering – For bandwidth saving or corporate reasons you can setup a filter with squid to block access to certain sites, certain types of site or content-type. For example you could block access to youtube or block all video files completley.
Advertising – You can incporporate your own advertising into sites that you’re serving. If you wanted to get into the nitty gritty then you could monitor traffic and serve ads based on user behavour (like phorm, I guess)
What do I need?
The great thing is, to do something like this, you don’t need any pricey hardware.
What you need:
- A computer and operating system (In my case, Ubuntu 9.04)
- A network card that uses our connection from the ISP
- A wireless card that supports ‘master mode’ in linux.
1) The box I’m using in this example was originally used as my desktop system and is far more powerful than what you realistically need. I prefer using laptops (especially when going to and from work) so I’ve converted it for this project.
The specs are:
Processor – Intel Core 2 Quad Q6600 2.4ghz 8mb L2 cache
Motherboard – Intel BLKDG35EC
RAM – 8gb (4 x 2GB Kingston DDR2 PC800)
HD – Western Digital 320GB 7200RPM SATA
Graphics – Nvidia Inno3d 8600GT PCIE 512mb S-video/DVI/VGA
Network – Onboard gigabit ethernet, TP-LINK TL-WN651g
Case – Basic case
Power – ACBEL INTELLIGENT POWER 610W ACTIVE PFC
I’m running Ubuntu 9.04. For this example, I’ll be assuming that everyone is running Ubuntu 9.04 but it shouldn’t vary that much between different linux distros.
2) I’m using my onboard network card connected to a DSL modem. I actually want to replace this step with an internal PCI modem but I’m having trouble finding a suitable card right now.
3) This one took me a long time! I originally hoped I could use USB wifi adapters since this would make it easier to use many to service a big wireless area. I have tested many usb wifi adapters and had no problem getting them to act as access points/’master mode’ in Windows XP but not in Ubuntu! (For those interested, I had best success with adapters using the r8187 chipset).
It was a bit easier finding a PCI wifi card that would work in master mode. The easiest thing to do is find any card which uses an Atheros chipset and use madwifi drivers (explained later). I loaded a few local computer shop websites and then checked their stock against the madwifi compatibility list. I eventually ended up with a TP-LINK TL-WN651g.
Configuring the server
The first thing to do is install Ubuntu. Download the ISO, burn to DVD and install. I won’t go into detail on this because there’s nothing to do really.
Configure the network card to take connection from our ISP
Open a terminal and edit /etc/network/interfaces by adding the following:
#isp
auto eth0
iface eth0 inet dhcp
This assumes that you’re plugging this network card into a source that’s running a DHCP server such as a standard router/DSL modem. If you run ‘/etc/init.d/networking restart’ you should now be online, great!
Configure DNS
Since we’re going to act as an access point, we need to enter the DNS servers we’re going to use. You can enter your ISPs DNS servers or free ones like those provided by OpenDNS. In this example, I’ll assume you’re going to use OpenDNS.
Open a terminal and edit /etc/resolv.conf so that it reads as the following:
nameserver 208.67.222.222
nameserver 208.67.220.220
Configuring the wireless card with madwifi drivers
To get the wireless card to act as an access point we need special drivers known as madwifi. To set this up I simply plugged my pci wireless card into the server and then (in gnome session) I clicked ‘system>administration>hardware drivers’ where it automatically searched for drivers and offered me ‘Alternate Atheros “madwifi” driver. I simply selected and enabled this driver.
After this, I run the following command in a terminal:
apt-get install madwifi-tools
This installs a package of tools we need to configure the card as an access point.
To force the card to always go into AP mode, we’re going to edit file ‘/etc/modprobe.d/madwifi' by adding the following to it:
options ath_pci autocreate=ap
After adding the above, we’ll run ‘modprobe ath_pci'
Configure wireless card to setup access point
Again we’re going to open a terminal and edit our /etc/network/interfaces file by adding the following:
#wifi ap
auto ath0
iface ath0 inet static
wireless-mode master
wireless-essid linksys
address 192.168.1.1
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
If you run ‘/etc/init.d/networking restart’ and scan for wireless access points from another computer, you should now see an access point called ‘linksys’. We’re not done yet though! If you connect, nothing’s going to happen.
Configure the server to route the traffic from the wirless through our ISP connection (eth0)
In terminal run ‘echo boxer > /etc/hostname’
Edit ‘/etc/hosts’ to look the same as:
127.0.0.1 boxer localhost.localdomain localhost
192.168.0.100 boxer server# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
Make a new file ‘/etc/init.d/iptables’ and copy the following into it:
#! /bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -t nat -A POSTROUTING -o ath0 -j MASQUERADE
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
To make our new file executable, run ‘chmod +x /etc/init.d/iptables’ and then to make it run on startup run ‘update-rc.d iptables defaults ‘
Install DHCP server
We need to install a DHCP server so that when clients connect, they’re given an IP address. To do this, run
apt-get install dhcp3-server
After this is installed, edit ‘/etc/default/dhcp3-server’ so that INTERFACES=”ath0″
Next, add the following to the bottom of file ‘/etc/dhcp3/dhcpd.conf’
authoritative;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;
option domain-name-servers 208.67.222.222,208.67.220.220;
option routers 192.168.1.1;
default-lease-time 600;
max-lease-time 7200;
}
Reboot
Everything should now be installed and setup. Now we reboot, cross our fingers and hope everything worked.
Conclusion
I want to update this post with how to install and configure squid as a transparent caching proxy (no need to configure the clients). Right now this just feeds traffic straight through.
I also want to keep working on getting USB wifi adapters working in ‘master/AP’ mode since this would greatly help servicing a large area. Imagine, you can use multiple cheap USB wifi adapters with a different range of antennas connected.
I’m not a linux guru and a lot of this information I’ve learnt/collated from different forums, sites and such like. I can’t see that I’ve missed anything out but let me know if you run into any problems.
Paypal temporary mastercard / gift card
February 21, 2009 on 8:33 pm | 11 CommentsI just found out about a Paypal feature that I never knew existed! I really can’t believe I’d never known about this before..
You can download a plugin for firefox/IE which allows you to generate a temporary mastercard (mastercard gift card). Basically you want to pay for something which cost $50 but the place only takes credit cards, not Paypal.. no problem, this will generate some mastercard credit card details that will use your Paypal balance. Extremely useful!
If however you’re one of the smart people using Mac OS X..
Mac users cannot install the PayPal Plug-In at this time. However, you can still use the Secure Cards feature of the plug-in.
How it works:* Go to the Secure Cards page.
* Generate a unique MasterCard Secure Card number.
* Note the card number, expiration date, and the CVC2.
* Enter these details at checkout.
Another Euro Drive
November 9, 2008 on 11:31 am | 6 CommentsWoooo! Well It looks like I’ll be doing another drive across mainland Europe in January
The first time I did a drive across Europe I didn’t even bother taking a camera but the second time I did a little post on it with some pics.
I actually found an old MP3 which I recorded the night before I went on the drive. At the time I was doing SEO for an insurance company and because I wanted a break and I’m impatient I booked the ferry for the next day! The night before I saw my friend and we had a few drinks and he sang this on the fly.
The great thing about Europe is once you’re in, that’s basically it, no hassle! Just drive anywhere at anytime without any problems.
I’m torn between attempting a long drive to somewhere like Russia or visiting multiple countries. I like the idea of driving to Russia and back because its quite a challenge since its such a distance and you travel through a fair amount of countries but I wouldn’t really have time to do anything in the countries but have a quick nap before moving onto the next.
If however I decide to visit multiple countries then I’m thinking something..
Ferry from Dover(UK) to Dunkirk(France)
Dunkirk to Frankfurt(Germany)
Frankfurt to Zurich(Switzerland)
Zurich to Rome(Italy)
Rome to Geneva (France)
Geneva to Paris(France) or Dunkirk(France)… depending on timing
Not an easy drive to do in a short time (7 or 10 days) but that kinda makes it more challenging
If you have any suggestions on places to visit or changes to the route then feel free to comment! Nothings set in stone.
Quad Core Mac
October 16, 2008 on 9:34 am | 10 CommentsWell I finally got around to building a quad core mac!
>> SCREENSHOT (kalyway 10.5.2) <<
>> SCREENSHOT (ideneb 10.5.5) <<
I followed the OSx86 hardware compatibility list (HCL) to ensure the parts I bought were compatible with the mac operating system.
The motherboard of my macbook pro died a few months back and I’ve been missing the power ever since. Since it died I’ve been using an MSI wind laptop with mac os x 10.5.4 installed but the processor isn’t huge and its really meant more as a portable device than a daily work machine.
A lot of people still don’t realise that since Apple went over to the Intel platform a couple of years back, its quite easy to install the operating system on a whole range of standard desktop and laptop computers using either a retail disc or a special ‘hacked’ version such as kalyway 10.5.2 or Ideneb 10.5.5.
Because I used the OSx86 HCL, everything worked out of the box for me and was a breeze to setup. The only problem I had was finding a compatible wireless card. I tried a few usb wifi sticks I had laying around but couldn’t get any to work. I even tried buying a PCI wireless card which is meant to be compatible but couldn’t get that to work but to be fair I think this is an issue with the card or motherboard since it didn’t physically fit well in the first place! Eventually I managed to find a Netgear WG111 (version 3) and installed it using the RTL8187B drivers for Mac.
For those concerned about copyright/pirate etc. I do have a leopard license that currently isn’t being used so bah!
Hardware
Processor – Intel Core 2 Quad Q6600 2.4ghz 8mb L2 cache
Motherboard – Intel BLKDG35EC
RAM – 2 x 2GB Kingston DDR2 PC800
HD – Western Digital 320GB 7200RPM SATA
Graphics – Nvidia Inno3d 8600GT PCIE 512mb S-video/DVI/VGA
Case – Basic case
Power – ACBEL INTELLIGENT POWER 610W ACTIVE PFC
Networking – Netgear WG111 (version 3)
Total cost: About £380
Total time putting hardware together and installing OS: 2-3 hours
Namecheap checkout referal
October 1, 2008 on 9:36 am | 2 CommentsI actually can’t beleive this! I had to renew some domains in Namecheap so I sign in and choose to use funds already in the account. Should be a 1 minute job I think..
I get an error saying my checkout request was invalid.. so I hit back and click proceed again.. same error. Then I decide I have no choice but to read the error. You must have referral data turned on! WHAT THE HELL!? I have my browser referal data disabled in firefox and I can’t believe there are people out there using referal data for checkout/basket systems.
Get with the times namecheap!




