Tony's Site

Mobile Mini Wireless Server

Introduction

For what seemed a good reason at the time I decided to create a server. The requirements were:

I was interested in trying out an ITX solution with a built in wireless AP.

Status

Server created. I have now used this kit in anger and three problems arose:

I will wait until Squeeze becomes Stable and then investigate these further.

One of the problems of using Debian Testing is that things change. Although most things worked when I first set up, apart from the problems mentioned above, as Squeeze upgrades came through some things stopped working.

Hardware

My choice of hardware hasn't been terribly scientific. I had mocked up a solution using old PC kit - 200 MHz Pentium, 128MByte ram and 10GByte disk - and this ran OK'ish. So I was sure any modern kit would be fine. After some research on the Internet I chose an M350 case and Intel D945GSEJT Atom N270 1.6GHz Mini-ITX mainboard from LinITX. There is an I/O shield and riser card specific for this case/motherboard which allows fitting of a PCI card. When I bought this I had no plans for it at the time; thinking it might be useful in future; in fact it turned out to be essential. I planned to use a 2.5 inch disk I have already have.

The kit arrived promptly from LinITX and was easy to install once I had downloaded the manuals from the links above. Only slight problem was fitting the bracket for the PCI card as there were no instructions. Once I realised that part of the bracket protrudes outside the case it was easy.

Choosing the wireless card turned out to be the hardest part. The problem is that not all wireless cards that have Linux drivers can be used as an Access Point. I could find no clear information on this. I had intended to use a mini PCIe card - that was one of the reasons for the choice of motherboard but in the end used a PCI card fitted in the riser mentioned earlier. Finding a card that works and is available proved difficult, especially as manufacturers may change the chipset in cards. I finally made use of a D-Link DWL-G510, revision C2, from DABS.

Operating System

I installed Debian Squeeze from a USB stick. Instructions on how to do that can be found here. The boot.image.gz file mentioned can be found here and the ISO image here.

The system booted up from the USB stick and installed with no trouble. Due to various postings on the Internet I had half expected some problems with the network interface but none arose. At the time of installation Squeeze was still Testing and used 2.6.30 kernel; I believe there were problems with earlier versions. Subsequently I've upgraded to 2.6.32 and that works OK too.

Wireless AP

After the problems finding a card, getting it working was very easy. I fitted the card and then installed the wireless-tools and firmware-ralink packages. The latter is in the non-free repository so you will have to enable it in /etc/apt/sources.list if you haven't already. Reboot and test using these lines.

ifconfig wlan0 up
iwlist wlan0 scan

This should list any wireless networks in range. If it doesn't work you are on your own as it worked first time for me; told you it was easy!

You then have to install and configure the hostapd package. This has a complicated configuration file in /etc/hostapd/hostapd.conf most of which I didn't understand. I changed the following lines

interface=wlan0
driver=nl80211
ssid=MY SSID
country_code=GB
hw_mode=g
channel=11
wpa=2
wpa_passphrase=Something very secret

Set up the network configuration in /etc/network/interfaces

auto wlan0
iface wlan0 inet static
 address 192.168.10.1
 netmask 255.255.255.0
 network 192.168.10.0
 broadcast 192.168.10.255

Edit /etc/default/hostapd to allow the hostapd daemon to start and reboot. At this point your client PC should be able to see the SSID and connect using the password. Again this worked first time. However if your client wants a dynamic IP address it won't work until you set up DHCP. I installed dhcp3-server and changed the following lines in /etc/dhcp3/dhcpd.conf

authoritative;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
subnet 192.168.0.0 netmask 255.255.255.0 {
}
# This is a very basic subnet declaration.
subnet 192.168.10.0 netmask 255.255.255.0 {
  range 192.168.10.100 192.168.10.200;
}

Restart the DHCP server and everything seems to work. However, I've only done limited testing so need to gain confidence in the solution.

SMS Gateway

I want to be able to send and receive SMS messages, generating messages from my application. The system won't be connected to the Internet when in use so can't use one of the services provided that way. The volume is quite low, just generating a hundred or so messages at a time.

My solution makes use of an old Nokia 6230 mobile phone I had in a drawer. This is connected via a DKU-2 USB cable. It is driven using the Gnokii software. There are a number of ways of using this; I made use of a version driven by MySQL tables.

Installing the standard gnokii-smsd-mysql package brings in all the necessary dependencies. There is a detailed configuration file in /etc/gnokiirc in which I amended the following lines.

port=1
model = 6230
connection = dku2libusb 

You have to blacklist the cdc_phonet module. Insert a file in folder /etc/modprobe.d containing

blacklist cdc_phonet

Unusually for Debian there isn't a service started at boot time, instead you have to run the sofware your self - eg

smsd -d smsgw -c localhost -m mysql -u mysqluser -p mysqlpassword

Messages are sent/received via MySQL tables. The schema is provided in /usr/share/doc/gnokii-smsd-mysql/sms.tables.mysql.sql. To send a message just insert a row into the outbox. eg

insert into smsgw.outbox set number = "07777123456", insertdate=now(), text="my message"

To see the status of outgoing messages

select * from smsgw.outbox order by id desc

To receive, just read inbox

select * from smsgw.inbox order by id desc

Follow Up

The above describes the initial set up of this server. This has been used a number of times since for events and as a result I have changed a number of things.

I had continual problems with the wireless network. I could not identify whether this was a software or a hardware issue. Eventually I gave up and used a separate, cheap TP-Link AP instead, conected to the server by wired ethernet. This has worked fine.

The other problem was with the Gnokii software. This was unreliable - nearly every time I used it I had a number of crashes and had to nurse it through. This may be due to Gnokii being overkill for my needs - it is a bit of a Swiss Army Knife for Nokia phones, doing many things as well as SMS. I have now moved to SMS Server Tools which only does SMS. It is simple to use and has worked flawlessly.

The server is currently running on standard Debian wheezy.