Differences between revisions 8 and 10 (spanning 2 versions)
Revision 8 as of 2014-05-03 12:32:40
Size: 4152
Editor: lukisi
Comment:
Revision 10 as of 2014-06-02 12:34:31
Size: 3536
Editor: lukisi
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Cross-compile the firmware for your router from a ubuntu machine = = Download and install netsukuku on a ubuntu machine =
Line 3: Line 3:
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.
Install packages for building.
Line 9: Line 6:
sudo apt-get update
sudo apt-get install build-essential subversion git-core libncurses5-dev gawk wget gettext
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 &&
echo ok
Line 13: Line 13:
== Download ==

First, we download !OpenWrt. The version we tested this was svn revision 39211.
Prepare a directory for compilation.
Line 18: Line 16:
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
mkdir ~/netsukuku-dev
cd ~/netsukuku-dev
for pkg in tasklet-0.9.1.tar.gz zcd-0.9.1.tar.gz netsukuku-rpc-0.9.1.tar.gz \
       andns-rpc-0.9.1.tar.gz ntkresolv-0.9.1.tar.gz netsukuku-0.9.1.tar.gz
do
 wget http://download.savannah.gnu.org/releases/netsukuku/${pkg}
 tar xf ${pkg}
done
Line 29: Line 26:
Now download and apply a patch to the !OpenWrt configuration files
in order to make its build system download and build netsukuku.
Compile.
Line 33: Line 29:
wget -O - http://download.savannah.gnu.org/releases/netsukuku/openwrt-39211-netsukuku-0.9.patch 2>/dev/null | patch -p0 cd ~/netsukuku-dev/tasklet-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
make check &&
sudo make install


cd ~/netsukuku-dev/zcd-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
sudo make install


cd ~/netsukuku-dev/netsukuku-rpc-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
sudo make install


cd ~/netsukuku-dev/andns-rpc-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
make check &&
sudo make install


cd ~/netsukuku-dev/ntkresolv-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr --sysconfdir=/etc &&
make &&
make check &&
sudo make install


cd ~/netsukuku-dev/netsukuku-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr --sysconfdir=/etc &&
make &&
make check &&
sudo make install
Line 36: Line 69:
== Build == == Configure machine to resolve names ==
Line 38: Line 71:
We prepare to compile !OpenWrt with Netsukuku. You can see a sample configuration of the resolver library in
/usr/share/doc/ntkresolv/ntkresolv.ini.sample

You have to edit the configuration file in
/etc/ntkresolv/ntkresolv.ini
Line 41: Line 78:
make menuconfig sudo vi /etc/ntkresolv/ntkresolv.ini
Line 44: Line 81:
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:
Configure like this:
Line 63: Line 84:
ionice -c 3 nice -n 20 make [NTKRESOLV]
ANDNASERVER=127.0.0.1
Line 66: Line 88:
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
To instruct your system resolver to use ANDNA edit the configuration file
/etc/nsswitch.conf and place "andna [NOTFOUND=return]" before "dns" in the
Line 85: Line 93:
vi /etc/nsswitch.conf sudo vi /etc/nsswitch.conf 
Line 88: Line 96:
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.
There should be a line like this:
Line 93: Line 99:
vi /etc/dnsmasq.conf hosts: files andna [NOTFOUND=return] dns
Line 96: Line 102:
The file has to include these lines: == Configure the daemon settings ==

There are a few settings that are configurable and influence the behaviour of the daemon.

See a sample file in
/usr/share/doc/netsukuku/ntkd.ini.sample

The settings are in
/etc/netsukuku/ntkd.ini

Change settings only if you do know what you are doing.
Line 99: Line 115:
listen-address=192.168.2.1
bind-interfaces
no-resolv
server=127.0.0.1
sudo vi /etc/netsukuku/ntkd.ini
Line 105: Line 118:
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.
== Start / stop the daemon ==
Line 109: Line 120:
{{{
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.
Open a terminal.
Line 135: Line 123:
For !OpenWrt this is usually {{{br-lan}}}. For instance you can have one or more ethernet ports in your computer.
<<BR>>
You can have a WiFi card. In this case connect to a wireless network before launching
the daemon.
Line 143: Line 134:
Launch the daemon with the NICs you want to use. Launch the daemon with the NICs you want to use (eth0, eth1, wlan0, ...)
Line 146: Line 137:
ntkd -i br-lan sudo ntkd -i eth0 -i eth1 -i wlan0
Line 154: Line 145:
Open another terminal and connect to the router as root. === Test the network ===
Line 156: Line 147:
Launch the DNS redirector. From another terminal check your IP configuration.
Line 159: Line 150:
dns-to-andna ip a
ip r list table ntk
Line 162: Line 154:
The redirector will not exit, so you have to leave the terminal open. Also verify that you have registered a name.
<<BR>>
For example, if your computer has hostname 'mylaptop' then it should have tried
to register the name 'mylaptop.ntk'.
Line 164: Line 159:
== Test ==

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

Download and install netsukuku on a ubuntu machine

Install packages for building.

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 &&
echo ok

Prepare a directory for compilation.

mkdir ~/netsukuku-dev
cd ~/netsukuku-dev
for pkg in tasklet-0.9.1.tar.gz zcd-0.9.1.tar.gz netsukuku-rpc-0.9.1.tar.gz \
       andns-rpc-0.9.1.tar.gz ntkresolv-0.9.1.tar.gz netsukuku-0.9.1.tar.gz
do
 wget http://download.savannah.gnu.org/releases/netsukuku/${pkg}
 tar xf ${pkg}
done

Compile.

cd ~/netsukuku-dev/tasklet-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
make check &&
sudo make install


cd ~/netsukuku-dev/zcd-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
sudo make install


cd ~/netsukuku-dev/netsukuku-rpc-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
sudo make install


cd ~/netsukuku-dev/andns-rpc-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr &&
make &&
make check &&
sudo make install


cd ~/netsukuku-dev/ntkresolv-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr --sysconfdir=/etc &&
make &&
make check &&
sudo make install


cd ~/netsukuku-dev/netsukuku-0.9.1 &&
./configure --enable-logtasklet --prefix=/usr --sysconfdir=/etc &&
make &&
make check &&
sudo make install

Configure machine to resolve names

You can see a sample configuration of the resolver library in /usr/share/doc/ntkresolv/ntkresolv.ini.sample

You have to edit the configuration file in /etc/ntkresolv/ntkresolv.ini

sudo vi /etc/ntkresolv/ntkresolv.ini

Configure like this:

[NTKRESOLV]
ANDNASERVER=127.0.0.1

To instruct your system resolver to use ANDNA edit the configuration file /etc/nsswitch.conf and place "andna [NOTFOUND=return]" before "dns" in the line for the database "hosts".

sudo vi /etc/nsswitch.conf 

There should be a line like this:

hosts:          files andna [NOTFOUND=return] dns

Configure the daemon settings

There are a few settings that are configurable and influence the behaviour of the daemon.

See a sample file in /usr/share/doc/netsukuku/ntkd.ini.sample

The settings are in /etc/netsukuku/ntkd.ini

Change settings only if you do know what you are doing.

sudo vi /etc/netsukuku/ntkd.ini

Start / stop the daemon

Open a terminal.

You have to know which network cards (NIC) you want to handle with netsukuku. For instance you can have one or more ethernet ports in your computer.
You can have a WiFi card. In this case connect to a wireless network before launching the daemon.

Find the name of the NICs with

ip l

Launch the daemon with the NICs you want to use (eth0, eth1, wlan0, ...)

sudo ntkd -i eth0 -i eth1 -i wlan0

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.

Test the network

From another terminal check your IP configuration.

ip a
ip r list table ntk

Also verify that you have registered a name.
For example, if your computer has hostname 'mylaptop' then it should have tried to register the name 'mylaptop.ntk'.

ping mylaptop.ntk

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