User Tools

Site Tools


Sometimes it is nice to have the Chumby serve as a wireless access point without routing anything to a back-haul network. An example might be where the Chumby is the communications hub in a robot – you want to easily connect to the robot, but the robot isn't actually routing any traffic for you and doesn't have a second network connection. Luckily, the Chumby already includes a script that enables it to act as a routing AP. Making a stand-alone AP is pretty much just a simple job of commenting out the parts that connect to the back-haul network, and you are done.

These instructions were written using a Chumby hacker board V1, as it shipped in January of 2011. They are based on this blog post by Eric Gregori.

First, make sure you have basic WiFi working as described in this tutorial: WiFi networking - Getting to the Internet via wireless 802.11b/g (in progress). Get up to the point where you see the RT73 reported as alive:

rt73usb 1-1.1:1.0: firmware: requesting rt73.bin
ADDRCONF(NETDEV_UP): wlan0: link is not ready

OK, got your basic WiFi working? Great. Now let's get it going as an AP.

The Chumby boot process looks for three user-supplied boot scripts: userhook0, userhook1, and userhook2. Each one is later in the boot process, depending on when you want to hook in. We want a late hook, so we'll edit userhook2.

Remount the file system with write access:

mount -oremount,rw /

Create the directory /psp/rfs1 if it does not already exist. This is where the boot scripts look for your scripts.

mkdir /psp/rfs1

Create your file userhook2, something like this:

chumby-:/psp/rfs1 # more userhook2 
# DBC 28-Jan-11
/bin/echo "**** Starting userhook2 ****"

# modified is stand-alone AP

/bin/echo "**** Ending userhook2 ****"

Don't forget to 'chmod 755' it. Now the Chumby boot scripts will execute userhook2 late in the boot process. We'll copy the regular from /usr/chumby/scripts and comment out some lines.

# Dave Curtis 28-Jan-11
# Staring with CHB V1 script, following mods by
# Eric Gregori
# Set up Chumby to be a wireless AP, with no back-haul routing.
# Chumby will be
# Chumby will hand out DHCP addresses

# DBC - turn off external interface
#EXTIF=$(route -n | grep ^ | awk '{print $8}')
#INTIF=$(ifconfig -a | egrep 'encap:(Ethernet|Point)' | awk '{print $1}' | grep -v ${EXTIF} | head -n 1)

# DBC - There won't be an external inteface.
## Ensure we have an internal and an external interface.
#if [ "x${INTIF}" = "x" -o "x${INTIF}" = "x" ]
#    echo "Only one interface detected.  Not starting router."
#    exit

At the top of the file, we'll comment out the EXTIF variable and the original setting for the INTIF variable, and point INTIF, the internal interface, at wlan0. Then, since there is no external interface, comment out all the code that insists on looking for one.

Now toward the bottom of the file, we'll fix up DHCP to give what we want. I wanted the Chumby to be, so I commented out the 10.x.x.x net address and added my own.

# Bring up the internal wifi interface.
#ifconfig ${INTIF}
ifconfig ${INTIF}

Next, this sets up DHCP so serve addresses in the to range:

# Run dnsmasq, which is a combination DNS relay and DHCP server.
mkdir -p /var/lib/misc      
#dnsmasq -i ${INTIF} -F,,15000 -K
dnsmasq -i ${INTIF} -F, -K

Finally, comment out all that silly routing we don't want:

# DBC - We're not routing nothing to nobody
## Set up IP forwarding     
#iptables -t nat -F         
#iptables -t nat -A POSTROUTING -o ${EXTIF} -j MASQUERADE
#echo 1 > /proc/sys/net/ipv4/ip_forward

It's a good idea to 'chmod 644' the original /usr/chumby/scritps/ so that it doesn't get executed when you aren't expecting it.

Reboot! At this point you should be able to get a DHCP address from your Chumby.

It sure would be nice if we could ssh into it now. Update userhook2 to start up the ssh daemon, it now should look something like this:

# DBC 28-Jan-11
/bin/echo "**** Starting userhook2 ****"

# modified is stand-alone AP

# start sshd
service_control sshd start

/bin/echo "**** Ending userhook2 ****"

After reboot, you should be able to ssh into port 22. If you want to change the port number, you should be aware that /etc/sshd_config is just a decoy – the real file that is honored by sshd is in /user/local/etc/sshd_config. You can change to a different port number by editing the 'Port' line:

chumby-:/psp/rfs1 # more /usr/local/etc/sshd_config 
Port 222

And that huge message of the day? It's in /etc/motd if you want to trim it down.

At this point, you will be running a wide-open wireless AP on a box with no root password. Now might be a good time to add a root password.

/home/ladyada/public_html/wiki/data/pages/stand-alone_wifi_ap_and_ssh.txt · Last modified: 2016/01/28 18:05 (external edit)