Differences between revisions 3 and 8 (spanning 5 versions)
Revision 3 as of 2014-05-02 14:29:50
Size: 1443
Editor: lukisi
Comment:
Revision 8 as of 2014-05-03 12:32:40
Size: 4152
Editor: lukisi
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Download and install netsukuku on a ubuntu machine = = Cross-compile the firmware for your router from a ubuntu machine =
Line 3: Line 3:
Install packages for building. 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.
Line 6: Line 9:
sudo apt-get install build-essential -y
sudo apt-get install pkg-config -y
sudo apt-get install libglib2.0-dev libpth-dev libgee-0.8-dev -y
sudo apt-get install libgcrypt20-dev -y
sudo apt-get update
sudo apt-get install build-essential subversion git-core libncurses5-dev gawk wget gettext
Line 12: Line 13:
Prepare a directory for compilation. == Download ==

First, we download !OpenWrt. The version we tested this was svn revision 39211.
Line 15: Line 18:
mkdir ~/netsukuku-dev
cd ~/netsukuku-dev
for pkg in tasklet-0.9.tar.gz zcd-0.9.tar.gz netsukuku-rpc-0.9.tar.gz \
       andns-rpc-0.9.tar.gz ntkresolv-0.9.tar.gz netsukuku-0.9.tar.gz
do
 wget http://download.savannah.gnu.org/releases/netsukuku/${pkg}
 tar xf ${pkg}
done
mkdir ~/openwrt
cd ~/openwrt
svn -r 39211 co svn://svn.openwrt.org/openwrt/trunk workdir
cd workdir
# Revision 39211 needs patches:
# http://patchwork.openwrt.org/patch/4588/
wget -O - http://patchwork.openwrt.org/patch/4588/raw | patch -p1
./scripts/feeds update -a
./scripts/feeds install -a
Line 25: Line 29:
Compile. Now download and apply a patch to the !OpenWrt configuration files
in order to make its build system download and build netsukuku.
Line 28: Line 33:
cd ~/netsukuku-dev/tasklet-0.9 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
make check &&
sudo make install
wget -O - http://download.savannah.gnu.org/releases/netsukuku/openwrt-39211-netsukuku-0.9.patch 2>/dev/null | patch -p0
}}}

== Build ==

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.
<<BR>>
For this, select "Advanced configuration options".
<<BR>>
Inside it, select "Toolchain Options".
<<BR>>
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, ...)
<<BR>>
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. 192.168.2.1.
<<BR>>
The requests are to be forwarded to 127.0.0.1 on port 53 where we will listen with dns-to-andna.

{{{
vi /etc/dnsmasq.conf
}}}

The file has to include these lines:

{{{
listen-address=192.168.2.1
bind-interfaces
no-resolv
server=127.0.0.1
}}}

Configure /etc/resolv.conf so that it points to the real DNS server, e.g. 8.8.8.8.
<<BR>>
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
}}}
Line 35: Line 118:
cd ~/netsukuku-dev/zcd-0.9 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
sudo make install
Configure /etc/ntkresolv/ntkresolv.ini so that DNS_TO_ANDNA listens to 127.0.0.1.
Line 40: Line 120:
{{{
vi /etc/ntkresolv/ntkresolv.ini
}}}
Line 41: Line 124:
cd ~/netsukuku-dev/netsukuku-rpc-0.9 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
sudo make install
The file has to include the line:
Line 46: Line 126:
{{{
DNS_TO_ANDNA=127.0.0.1
}}}
Line 47: Line 130:
cd ~/netsukuku-dev/andns-rpc-0.9 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
make check &&
sudo make install
== Start / stop the daemon and the DNS redirector ==
Line 53: Line 132:
Open a terminal and connect to the router as root.
Line 54: Line 134:
cd ~/netsukuku-dev/ntkresolv-0.9 &&
./configure --enable-logtasklet --prefix=/usr --sysconfdir=/etc &&
make &&
make check &&
sudo make install
You have to know which network cards (NIC) you want to handle with netsukuku.
For !OpenWrt this is usually {{{br-lan}}}.
Line 60: Line 137:
Find the name of the NICs with
Line 61: Line 139:
cd ~/netsukuku-dev/netsukuku-0.9 &&
./configure --enable-logtasklet --prefix=/usr --sysconfdir=/etc &&
make &&
make check &&
sudo make install
{{{
ip l
Line 67: Line 142:

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.

Open another terminal and connect to the router as root.

Launch the DNS redirector.

{{{
dns-to-andna
}}}

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

== Test ==

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

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

Download

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

mkdir ~/openwrt
cd ~/openwrt
svn -r 39211 co svn://svn.openwrt.org/openwrt/trunk workdir
cd workdir
# Revision 39211 needs patches:
#   http://patchwork.openwrt.org/patch/4588/
wget -O - http://patchwork.openwrt.org/patch/4588/raw | 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 - http://download.savannah.gnu.org/releases/netsukuku/openwrt-39211-netsukuku-0.9.patch 2>/dev/null | patch -p0

Build

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. 192.168.2.1.
The requests are to be forwarded to 127.0.0.1 on port 53 where we will listen with dns-to-andna.

vi /etc/dnsmasq.conf

The file has to include these lines:

listen-address=192.168.2.1
bind-interfaces
no-resolv
server=127.0.0.1

Configure /etc/resolv.conf so that it points to the real DNS server, e.g. 8.8.8.8.
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 127.0.0.1.

vi /etc/ntkresolv/ntkresolv.ini

The file has to include the line:

DNS_TO_ANDNA=127.0.0.1

Start / stop the daemon and the DNS redirector

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.

Open another terminal and connect to the router as root.

Launch the DNS redirector.

dns-to-andna

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

Test

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

Netsukuku_Dev/beta/ubuntu (last edited 2014-06-02 12:34:31 by lukisi)