Cross-compile the firmware for your router from a ubuntu machine

A basic knowldge of the procedure of compiling a OpenWrt firmware and flashing your router is a prerequisite for this task.

Make sure that you have the needed software installed in your system.

sudo apt-get update
sudo apt-get install build-essential subversion git-core libncurses5-dev gawk wget gettext


First, we download OpenWrt. The version we tested this was svn revision 39211.

mkdir ~/openwrt
cd ~/openwrt
svn -r 39211 co svn:// workdir
cd workdir
# Revision 39211 needs patches:
wget -O - | patch -p1
./scripts/feeds update -a
./scripts/feeds install -a

Now download and apply a patch to the OpenWrt configuration files in order to make its build system download and build netsukuku.

wget -O - 2>/dev/null | patch -p0


We prepare to compile OpenWrt with Netsukuku.

make menuconfig

Select your Target, Subtarget and Profile (e.g. Atheros AR7xxx/AR9xxx - Generic - TP-LINK TL-WR1043N/ND)

We have to produce the binaries with eglibc instead of uClibc.
For this, select "Advanced configuration options".
Inside it, select "Toolchain Options".
Inside it, as C Library implementation choose eglibc 2.15.

Inside category Network, select package netsukuku

It is optional to activate the OpenWrt web interface. You find it inside LuCI, Collections, luci

Build with:

ionice -c 3 nice -n 20 make

After approx. 90 minutes (+ download time of various pkgs) you will find your new firmware in ./bin/ar71xx-eglibc.

Flash your router.

Then connect to it and configure as you like the usual bits. The password for root, the IP address of your LAN and the wireless settings (SSID, channel, security, ...)
For this steps refer to documentation of OperWrt that you can find online.

Configure Netsukuku

Connect to the router as root.

Edit the configuration file /etc/nsswitch.conf and place "andna [NOTFOUND=return]" before "dns" in the line for the database "hosts".

vi /etc/nsswitch.conf

Configure dnsmasq so that it listens on port 53 but only for its real IP, e.g.
The requests are to be forwarded to on port 53 where we will listen with dns-to-andna.

vi /etc/dnsmasq.conf

The file has to include these lines:


vi /etc/config/dhcp

Disable rebind-protection:

        option rebind_protection '0'

Configure /etc/resolv.conf so that it points to the real DNS server, e.g.
On OpenWrt /etc/resolv.conf is usually a symlink. Make it persistent and modify.

cd /etc
cp resolv.conf real.resolv.conf
rm resolv.conf
mv real.resolv.conf resolv.conf
vi resolv.conf

Configure /etc/ntkresolv/ntkresolv.ini so that DNS_TO_ANDNA listens to

vi /etc/ntkresolv/ntkresolv.ini

The file has to include the line:


Restart service dnsmasq and dns-to-andna:

        /etc/init.d/dnsmasq restart
        /etc/init.d/dns-to-andna restart

Start / stop the daemon

Open a terminal and connect to the router as root.

You have to know which network cards (NIC) you want to handle with netsukuku. For OpenWrt this is usually br-lan.

Find the name of the NICs with

ip l

Launch the daemon with the NICs you want to use.

ntkd -i br-lan

The daemon will not exit, so you have to leave the terminal open.

When you want to stop the daemon and exit netsukuku, press CTRL-C and it will remove all the configurations that it had set up.


Now you should be able to connect even a unsupported device (android, mac, windows) and reach netsukuku nodes.

Netsukuku_Dev/1_0/openwrt (last edited 2014-07-29 07:25:53 by lukisi)