Recently, we have had several people reporting that our instructions for setting up an ad-hoc network with the SBC3 do not work. I, as lead support at Phidgets, decided to investigate.
Yup, that’s broken.
There are two reasons this might not work. First, the instructions were written for the SBC2. It’s possible that some differences exist on the SBC3. Second, the newer WiFi adapter we have stocked since the SBC3 launched does not support ad-hoc mode. The most likely reason is the second. The SBC3 runs Debian Linux, so let’s see what the Debian team has to say about setting up ad-hoc networks:
That does not appear to work either, which more or less confirms my suspicion that the new WiFi adapter does not support ad-hoc mode. Is there a work around for this? For that matter, is an ad-hoc network even the best solution for communicating with the SBC in the absence of a proper local network? Maybe it makes more sense to set the SBC up as a wireless access point that other devices can connect to. For testing purposes, I am going to try using hostapd, which is a Linux utility designed for wireless access points and authentication servers.
hostapd on the SBC.
Now, configure the new network and set the path to the hostapd configuration file. Edit the file /etc/default/hostapd with a text editor like nano or vi. Uncomment the
DAEMON_CONF line and set it to
DAEMON_CONF = "/etc/hostapd/hostapd.conf"
Close that file. Now, check what interface the WiFi adapter is associated with. Run
ifconfig and it should list all the interfaces available on the system. The WiFi adapter will be something like
wlan1. Now open /etc/hostapd/hostapd.conf. Set the interface to be used, the driver that interface uses, and a few other options. A list of everything you might want can be found here, but I found the following options to be all that is actually necessary:
interface=wlan0 driver=nl80211 ##the driver you should use depends on the device. you can check the driver with lsmod## country_code=CA ##or whatever country you are in## ieee80211d=1 ssid=SBCAP ##this is the name of your network, you can call it whatever you like## hw_mode=g channel=1 wme_enabled=0 macaddr_acl=0 auth_algs=1 wpa=2
All that I had to do after this was give the interface a static IP address (you could let DNS take care of it, but then you have to install some more software, which I was too impatient to bother with). This is straight forward enough. Open /etc/network/interfaces in a text editor and add:
auto wlan0 ##or whichever number yours is## iface wlan0 inet static address 192.168.0.7 ##these are more or less randomly selected. you can select an appropriate one for your network## netmask 255.255.255.0 gateway 192.168.0.254
Finally I started the service, making sure to associate the config file I just madehostapd -dd /etc/hostapd/hostapd.conf
Now I can connect to the network from other computers with wireless capability:
Now, I should point something out. The driver used by our current WiFi adapter does not support AP mode or ad-hoc mode, from what I can tell. I was able to get this working with our older model and another random part we had lying around. Certainly, most 3rd party adapters would be suitable. The issue is that our current adapter uses a staging driver, which is basically beta software. There are plans to bring out a proper version of it in the future – near future even, according to some things I have read, but I don’t know how soon that actually means.