Making a WiFi Hotspot / Access Point using Linux & wifi lan card/USB adapter

If you have a wifi LAN card / USB adapter, then you can use it as an access point so that other machines can connect to the internet via your machine using Wifi. The process is fairly simple, but requires you to have a compatible set of drivers which allow a wifi lan card to come into “Master” mode.

It didn’t work well for

  • Linksys WUSB54GC v3 USB adapter. Till Ubuntu 10.04, there were no good drivers for use with hostapd (supporting mac80211 / nl80211). In Ubuntu 10.10, though the drivers were working, but the connection was highly unstable – in fact unusable. The drivers that I tried were rt2800usb (which allowed the adapter to come into Master mode), and rt2870sta which didn’t allow the adapter to come into “Master” mode. It always remained “Auto” or “Managed” (checked via iwconfig). Need to test in 11.04 when it arrives.

What worked pretty well

  • 02:00.0 Ethernet controller: Atheros Communications Inc. AR5001 Wireless Network Adapter (rev 01), using ath5k drivers. hostapd didn’t complain at all and all was smooth. This was in Ubuntu 10.04.

Concept

  1. There’s an application called hostapd which allows converting a wifi adapter into an access point and provide privileges such as WPA authentication and ssid name definition etc. I used it and it worked well.
  2. When a client connects to the access point, apart from authentication it’ll require IP addresses to be assigned. For that a DHCP server is used.
  3. You need to have 2 interfaces, one which accesses the net (e.g. eth0), and other which provides the access point services (e.g. wlan0).
  4. You start the wlan interface, assign it an IP address, start the dhcp server, setup firewall/nat and start hostapd. That’s all to it. Your devices would be able to use the wifi adapter as the access point.

Procedure

apt-get install dhcp3-server hostapd

Modify /etc/hostapd/hostapd.conf and put the following

interface=wlan0
driver=nl80211
ssid=MyAP
hw_mode=g
channel=11
wpa=1
wpa_passphrase=MyPasswordHere
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600

The dhcpd.conf section in /etc/dhcp3/dhcpd.conf would have something like the following

subnet 10.10.0.0 netmask 255.255.255.0 {
        range 10.10.0.25 10.10.0.50;
        option domain-name-servers 8.8.4.4, 208.67.222.222;
        option routers 10.10.0.1;
}

Modify /etc/default/dhcp3-server

INTERFACES="wlan0"

Check what name your adapter got via iwconfig. You can change the name also and make it persistent via /etc/udev/rules.d/70-persistent-net.rules so that it always gets a single type of name. In our example we’re assuming wlan0, but it could be changed. Make necessary changes in your configuration too.

Configure the new interface

ifconfig wlan0 10.10.0.1

The above could also be done in a better way via the /etc/network/interfaces file, but didn’t try it out. In any case if you shutdown hostapd, the network interface (wlan0) loses its address, so need to put a script which assigns it again before hostapd is started. An example could be

iface wlan0 inet static
 address 10.10.0.1
 netmask 255.255.255.0

Restart the dhcp3-server. It should now be ready to serve addresses and is also bound to the network interface too.

Allow ip masquerading

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Now start hostapd and see the messages that it shows

hostapd -dd /etc/hostapd/hostapd.conf

Wait for a few seconds, it should show some probes being done by other wifi devices. If it shows, then probably you’re in good luck.

Now try to connect via your device to this access point. It should work.

To make this work on boot, can put the relevant config in /etc/default/hostapd

RUN_DAEMON="yes"
DAEMON_CONF="/etc/hostapd/hostapd.conf"
DAEMON_OPTS="-dd"

and also put the firewall rules in /etc/rc.local (make sure its executable).

Remember – if you shutdown your hostapd, the network card would lose its address. So you have to assign that again before starting hostapd. The usual practice would be

  • Stop hostapd
  • Stop dhcp server
  • Restart network (or rather ifup wlan0 / ifconfig wlan0 10.10.0.1 would do)
  • Restart dhcp server
  • Start hostapd

Miscellaneous

  1. You can check the wifi interfaces via
    iwconfig
  2. To set a wifi adapter into master mode, try the following. If it doesn’t work and shows an error that it’s not possible or something, fret not – use hostapd as that’ll do that in any case.
    iwconfig wlan0 mode Master
  3. Network Manager could create issues, though in my test environment – instead of using an ethernet interface, I used two wlan interfaces, one being controlled by Network Manager for internet access, and other for making it an access point.
  4. modprobe -r ath5k / modprobe -r rt2800usb etc. is to be used for unloading the modules.
  5. If you wish to proceed without using authentication so that you can test it easy, then put the following in /etc/hostapd/hostapd.conf
    interface=wlan0
    driver=nl80211
    ssid=MyAP
    hw_mode=g
    channel=11

Recovering contacts from Backup.arc on Nokia Series 60 3rd edition devices

I have a Nokia E61 (Symbian Series 60 3rd Edition – v9.1). I usually take backups on my memory card in the phone (I’ve three of them) and restore them in case it’s necessary. However, today when I tried to do it, it wouldn’t restore and always ask for a “Restart” after flashing “Restoring…” screen for a split second. I tried all my other backups made during last 1 year and it just won’t work. I even hard-reset/formatted the phone by pressing *,3 and call key and then starting the phone, assuming that maybe there’s some issue with the firmware. It just didn’t work. I’d my latest backup available on my memory card and I couldn’t use it. After spending more than a few hours, I managed to retrieve information, more importantly my contacts.

Credit goes to

Here’s how I retrieved all the Contacts. It assumes you have a Backup.arc with you. If you’ve taken backup on the memory card and view the contents of the memory card on computer, you’ll see a Backup/ folder in which the Backup.arc would be there. If not, tough luck.

  1. It works only on Windows. I used Windows XP.
  2. Install NbuExplorer from http://nbuexplorer.sourceforge.net – it requires .Net Framework 2.0 which I downloaded from Microsoft website, so install the framework prior to opening NbuExplorer.
  3. Install Java 1.4.2 and Symbian SDK. As of now I’m not too sure that Java 1.4.2 would be necessary at all. For Symbian SDK, you need to be a member of Nokia Forum – the version that I downloaded was S60-SDK-0548-3.0-f.3.215f.zip
  4. Now open NbuExplorer and point it to the Backup.arc file. It should show the contents in it including pictures, sounds etc.
  5. You need to locate the file having the name Contacts and ending with the extension .cdb. In my case the name was DBS_100065FF_Contacts.cdb and it was under C: -> private -> 100012a5 within the NbuExplorer interface. Once you locate it, right-click on the file name and select ‘Export selected file(s)’. It’ll ask you for a location – you may select “Desktop”. Keep that file safe – it has all your contacts.
  6. Now close NbuExplorer and start Symbian Emulator. It would open a Symbian interface – you need to add a new contact in there. You can add anything. We just want it to build a contact database of its own which we’ll eventually replace with our own contact database. Once done, close the Emulator.
  7. Next step is to replace the contact database created by the emulator by our actual database which has our contacts. In my case I went to C:\Symbian\9.1\S60_3rd\Epoc32\winscw\c\private\100012a5. The file DBS_100065FF_Contacts.cdb was already present. I replaced it with my actual file which I’d retrieved via NbuExplorer.
  8. We’ll add a memory card to our Symbian Emulator. For that edit the file epoc.iniwhich is located in C:\Symbian\9.1\S60_3rd\Epoc32\Data and modify the following values so that they look like the following
    _EPOC_DRIVE_E \epoc32\winscw\e
    _EPOC_LocDrv_1 E: FAT
  9. Let’s start the Emulator now. If you go to contacts, if all goes well you should be seeing all your contact listing. Hurray! Step 1 done.
  10. Now we’ll need to transfer the contacts to the memory card. Mark all contacts and then select “Copy to memory card” from within the emulator interface. It should say that it has copied them to the memory card.
  11. Now go to the “e” drive created via epoc.ini, that is, in C:\Symbian\9.1\S60_3rd\Epoc32\winscw\e. There would be a folder called “Others” inside which there’d be “Contacts”. If all goes well, you should see a lot of .vcf entries inside it. Those are your contacts. Copy them to an actual memory card of the phone – in the same directory (Others\Contacts). Now put the memory card in your phone.
  12. In your phone, open “Contacts”, and then select the option Copy -> From memory card. The contacts would be copied. For me it retrieved all information with precision.

I had evaluated Nokisoft.com’s Noki Explorer application. There were two things I wasn’t sure of, (a) it retrieved 30 contacts in the trial version, but the data that was retrieved was not complete; and (b) it seemed to be a tad expensive for one time use. Nokisoft’s explorer may be easier to retrieve contacts – that you can decide.

Asterisk Basics, and Load Balancing via DUNDi

IMPORTANT: The configurations, that is, the code sections underneath are not wrapped. However, if you want to copy paste them, you can just select them and despite they being not visible to you, they’ll get copied into the clipboard. Otherwise you may want to refer to the PDF version.

Prepared by : Vivek Kapoor http://exain.com
Prepared on : 01 July 2010
PDF Version : Asterisk_Basics_Load_Balancing_DUNDi_Vivek_Kapoor

Purpose of this document

Asterisk is an open source PBX. Which means, you can setup your own little telephone exchange in your home/office environment. On a much larger usage, you may look forward to setting up a redundant phone setup wherein multiple boxes are interconnected with each other and provide some sort of failover capability and easier management, which is possible through something called DUNDi. This document aims to provide such a solution with a possibility of horizontal scaling instead of vertical scaling. So, this may mean that by using low-end commodity hardware, you can setup a strong telephone infrastructure which can cater to thousands of users.

Read the document carefully. Read it fully before you start implementing it. It is intentionally detailed so that you know what you’re doing.

Acknowledgements

All credit of this document goes to JR Richardson. I’m afraid I’ve not been able to find a suitable link for him, but his whitepapers and presentations are the ones which helped me move forward. And of course, Mark Spencer – the guy behind Asterisk. Without him this document wouldn’t have existed.

The writings by JR Richardson

Continue reading

Board800 – My first Flex and Red5 Application

A few months back I was not even aware that it was now possible to do Adobe Flex development on Linux. Adobe has made the Flex SDK freely available, and Red5 is the media server which can easily integrate with a Flex application.

The possibilities are endless, and I personally feel that this is the way future applications would be developed. What I thought Java Web Start could have achieved (had it been a bit faster and the plugin etc. didn’t involve huge download and cumbersome installation), now I see that in Adobe Flex.

Regardless, I spent last few months working on a Flex application, and it has now culminated into what I’ve named as Board800 (http://www.board800.com). It is an interactive multi-user whiteboard application, on the lines of Dabbleboard, though much simpler. You can use it to collaborate with other users, and also *purchase* it if you wish to deploy it on your own servers. Go check it out now! http://www.board800.com

WikiReader – End of the World doesn’t scare me now!

I got my shiny new WikiReader. For the uninitiated, it’s the entire Wikipedia (well, atleast the textual content of entire Wikipedia in English language) stored on a memory card (MicroSD), and visible from inside a touch screen device.

http://thewikireader.com/

I have always been fond of encyclopedias – when I was a kid, I loved the World Books, then when I grew up and got familiar with computers, had heard of Microsoft Encarta – but I think since childhood I wasn’t a big fan of MS, so went ahead and bought IBM Worldbook CDs. It was amazing, and helped much in the school projects.

Now, at this date, I’ll admit I am getting a lot paranoid. That is more related paranoia associated with 2012, End of the World and what not. I have always believed in stuff which is WITH YOU and in your reach WHEN YOU WANT. Internet is something which scares me – a lot of stuff I “need”, which is there, but as soon as you get offline, all’s gone (well, this scare has prompted me to setup 3 different ISP connections at my home, apart from the mobile wireless internet). I don’t want that. I had been attempting to understand and planning that I”ll download the entire Wikipedia some day, and set up on my machine so that I can access it offline. Well, it would have been cumbersome and real painful. I couldn’t believe when I read about WikiReader, and I realized that’s the device I need (originally I’d been reading about Openmoko and FreeRunner). So, I found out the dealers in India (IDA Systems), and immediately placed the order.

I have been so happy with the purchase that now I can concentrate on the other survival tactics for EoW 😉 I don’t think anyone wouldn’t want knowledge at their fingertips, in such a convenient and cheap manner. If you don’t have WikiReader, then I think you’re missing out on a lot of stuff that you could’ve learnt.