15 May 2015
Note: From AirOS version 5.6.9 and forward, the following is no
longer necessary, because you can reserve IP addresses directly from
the Nanostation’s web interface. 2017-01-11.
The Nanostation M5 from Ubiquity has a
comprehensive and beautiful web GUI interface that enables
customization of a large number of settings. Unfortunately,
reservation of IP addresses for specific hosts on the local network in
the Nanostation’s DHCP server is not possible via the GUI. This is a
bit strange, because the GUI does allow port-forwarding, an option
which is a bit useless without the possibility to reserve an IP
address on the LAN to forward traffic to.
Instead, you need to specify the DHCP reservations manually by making
a small change in the Nanostation’s operating system. Log on to the
Nanostation from a terminal:
The Nanostation runs a tiny Linux system (“AirOS”), and many of the
standard UNIX tools are available
via busybox.
Fortunately,
AirOS allows users to add scripts in
the /etc/persistent
directory of the Ubiquiti device.
Create a file /etc/persistent/reservations.conf
containing the
DHCP reservations:
# raspberrypi
dhcp-host=b8:27:eb:d2:7a:da,192.168.50.222
# my-laptop
dhcp-host=5c:96:9d:76:42:29,192.168.50.223
These statements will ensure that the device with the given Mac
address is given the same IP address every time it joins the network.
In order to prevent that other devices are given these adresses, they
should be chosen outside the range of IP addresses normally handed out
by the DHCP daemon. This range is defined in the Nanostation’s web
GUI.
The file /etc/dnsmasq.conf
is rewritten every time the Nanostation
boots, taking parameters from the GUI interface, so it is useless to
edit it manually. Create a boot-time script
/etc/persistent/rc.prestart
:
RES=/etc/persistent/reservations.conf
if test -r $RES; then
cat /etc/persistent/reservations.conf >> /etc/dnsmasq.conf
fi
Do a save:
(The command save
is an alias: save='cfgmtd -w -p /etc/'
)
Now, you can kill the dnsmasq
daemon, it is restarted automatically
by init (it is listed in /var/etc/inittab
). You can also reboot the
Nanostation:
When the Nanostation is back up, reboot your device or simply renew
the DHCP lease. Below is shown how this is done in Mac OSX 10.10.

02 May 2015
Unfortunately, Fabric
has not yet officilly been ported to Python 3. However, it is possible
to get it to work. Here is how I did it.
First, create a virtual environment to run fabric in. (If you haven’t
set up virtual environments
for Python, go ahead and do that now, then come back.) I have the
[fink environment] (http://finkproject.org) installed on my Mac, and
the Python 3 executable is in /sw/bin/python3
. If you have Python3
from homebrew or elsewhere, just put the correct path to the python3
executable after the --python
switch below:
$ mkvirtualenv --python=/sw/bin/python3 fabric
[ ... ]
Save the following lines in a file /tmp/requirements.txt
:
Babel==1.3
Jinja2==2.7.3
MarkupSafe==0.23
Pygments==2.0.2
Sphinx==1.3.1
alabaster==0.6.1
docutils==0.12
ecdsa==0.13
fudge==0.9.6
invocations==0.10.0
invoke==0.10.1
nose==1.3.6
paramiko==1.15.2
pycrypto==2.6.1
pytz==2015.2
releases==0.6.1
semantic-version==2.4.0
six==1.9.0
snowballstemmer==1.2.0
sphinx-rtd-theme==0.1.7
wheel==0.24.0
[Added 20150509] If you don’t care about running fabric’s unittests, you can actually get by with this list:
In the fabric
environment, install these packages:
(fabric)$ pip3 install -r /tmp/requirements.txt
Now, all you need is the last two requirements, which are not
available from PyPi, because they are
forked from the main developement line. Go to the place you store
your github clones:
First, clone and install the Python 3 version of rudolf
:
(fabric)$ git clone --depth=1 git@github.com:mok0/rudolf.git
(fabric)$ cd rudolf
(fabric)$ python3 setup.py install
(The --depth=1
switch gives a shallow clone. It is sufficient for most
cases, unless you are interested in the history of the repo.)
Next, clone the git repository from Sergey Pashinin, who has
ported fabric itself to Python 3:
(fabric)$ cd ~/github
(fabric)$ git clone --depth=1 git@github.com:pashinin/fabric.git
(fabric)$ cd fabric
See the tests, most of them run ok, but a few do fail :-(
(fabric)$ python3 setup.py nosetests
Even though some tests fail, fabric seems to work fine for most
things I have tried. Build and install:
(fabric)$ python3 setup.py install
Now, test out your fabric
installation. From the documentation,
try the following example. Place in /tmp/fabfile.py
:
from fabric.api import run
def host_type():
run('uname -s')
Now try to run it on localhost
(requires ssh):
(fabric)$ fab -H localhost host_type
[localhost] Executing task 'host_type'
[localhost] run: uname -s
[localhost] out: Darwin
[localhost] out:
Done.
Disconnecting from localhost... done.
(fabric)$
Deactivate the fabric
enviroment:
Whenever you need to use your fabric
installation, just issue the command:
(The latter requires that you have also installed virtualenvwrapper).
That’s all, good luck!