Differences between revisions 4 and 7 (spanning 3 versions)
Revision 4 as of 2010-12-15 08:44:36
Size: 6130
Editor: lukisi
Comment:
Revision 7 as of 2010-12-15 12:15:09
Size: 5124
Editor: lukisi
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
The following commands have been tested in a Ubuntu environment.
<<BR>>
The procedure should work in any linux distro when you have installed the appropriate packages.
Line 6: Line 10:

The following commands have been tested in a Ubuntu environment.
Line 58: Line 60:
Now we install {{{andns}}}. Now, we install {{{andns}}}.
Line 69: Line 71:
Now we install {{{ntkresolv}}}. Now, we install {{{ntkresolv}}}.
Line 79: Line 81:
But we have to configure it. But we have to prepare its configuration directory.
Line 85: Line 87:
=== ANDNA ===

Confirm that the file {{{/etc/hostname}}} contains the name you want to register in the network. In my case:
{{{
luca@luca-primeur:~$ cat /etc/hostname
luca-primeur
luca@luca-primeur:~$
}}}

Issue the following commands to configure the DNS wrapper.
{{{
luca@luca-primeur:~$ sudo tee /etc/netsukuku/dnswrapper.conf <<EOF >/dev/null
andnsserver in-process
EOF
luca@luca-primeur:~$ sudo tee /etc/netsukuku/andnsserver.conf <<EOF >/dev/null
inetnameserver 8.8.8.8
EOF
luca@luca-primeur:~$ sudo tee /etc/netsukuku/libandns.conf <<EOF >/dev/null
andnsserver 127.0.0.1
EOF
luca@luca-primeur:~$
}}}
Line 87: Line 112:
In seguito, quando lanciamo una macchina virtuale, non avremo bisogno di una interfaccia di rete virtuale collegata ad Internet, ma di una o più interfacce virtuali collegate ad un "dominio di collisione" virtuale.

Creiamo una nuova directory e, dal suo interno, avviamo una macchina virtuale.
Open a terminal. Go to the "pyntk" directory, where you find the file "ntkd".
Launch the daemon with the Stackless interpreter and specify the NICs you want to manage.
Remember to disable any other manager that might interfere with the parameters of those NICs, such as {{{NetworkManager}}}.
Line 91: Line 116:
luca@luca-laptop:~/netkit/fs$ cd
luca@luca-laptop:~$ mkdir test-ntk
luca@luca-laptop:~$ cd test-ntk
luca@luca-laptop:~/test-ntk$ vstart pc1 --eth0=A --eth1=B --mem=64
}}}
Questa sintassi avvia una macchina virtuale con due schede virtuali (eth0 ed eth1) collegate a 2 domini diversi, uno chiamato "A" e l'altro "B".

Queste interfacce non vengono affatto inizializzate dal sistema operativo caricato nelle macchine virtuali di netkit. Questa quindi è la situazione ottimale per verificare che il demone ntkd le renda effettivamente utilizzabili.

=== Una semplice topologia di rete ===

Supponiamo di voler provare questa topologia di rete:
{{{

                    Collision Domain
                           A
                           |
                           V

                 pc1 ------------- pc2
                    \ /
                     \ /
Collision Domain \ / Collision Domain
             B ----> \ / <----- C
                        \ /
                         \ /
                          pc3
luca@luca-laptop:~$ cd netsukuku/pyntk
luca@luca-laptop:~/netsukuku/pyntk$ sudo /opt/stackless/bin/python2.6 ntkd -i eth0 eth1 -vvvv
Line 121: Line 120:
Possiamo farlo con questi comandi: The flag {{{-vvvv}}} make it to produce a very verbose output. You can redirect it to some file for later examination.
<<BR>>
This command will not fork itself in background, so you will not get the prompt back.

If you want (mostly you do) to be able to lookup for names into ANDNA, then
instruct the resolver to use 127.0.0.1 as DNS server. Open a new terminal, issue this command:
Line 123: Line 127:
luca@luca-laptop:~/test-ntk$ vstart pc1 --eth0=A --eth1=B --mem=64
luca@luca-laptop:~/test-ntk$ vstart pc2 --eth0=A --eth1=C --mem=64
luca@luca-laptop:~/test-ntk$ vstart pc3 --eth0=B --eth1=C --mem=64
luca@luca-primeur:~$ sudo tee /etc/resolv.conf <<EOF >/dev/null
nameserver 127.0.0.1
EOF
luca@luca-primeur:~$
Line 128: Line 133:
Si avviano 3 macchine virtuali le cui console appaiono in 3 finestre.

Scarichiamo nel nostro sistema da svn la versione corrente di Netsukuku.
<<BR>>
Mettiamo un link simbolico nella nostra home.
{{{
luca@luca-laptop:~/test-ntk$ cd
luca@luca-laptop:~$ mkdir -p sviluppo/netsukuku
luca@luca-laptop:~$ cd sviluppo/netsukuku
luca@luca-laptop:~/sviluppo/netsukuku$ svn co http://dev.hinezumi.org/svnroot/netsukuku/trunk .
luca@luca-laptop:~/sviluppo/netsukuku$ cd
luca@luca-laptop:~$ ln -s sviluppo/netsukuku netsukuku
}}}
Quindi {{{~/netsukuku/pyntk}}} è la directory che contiene la versione python di netsukuku.

Dalla console di ogni macchina virtuale che abbiamo avviata diamo questi comandi:
{{{
pc1:~# cd /hosthome/netsukuku/pyntk
pc1:/hosthome/netsukuku/pyntk# /opt/stackless/bin/python2.6 ntkd -i eth0 eth1 -vvvv
}}}

Ora si hanno le basi per provare il funzionamento di netsukuku.
<<BR>>
Ci sono anche delle scripts nel repository che aiutano a preparare ambienti complessi. In questo modo è possibile riprodurre automaticamente una certa situazione per fare debug o produrre dei log che possono aiutare a trovare anomalie o punti critici.
<<BR>>
[[../ScriptsWithNetkit|Questa pagina]] spiega nel dettaglio l'uso di queste script.
You might also want to further customize the file {{{/etc/netsukuku/andnsserver.conf}}} if you want
to proxy the requests that are for the Internet to a particular DNS server, instead of {{{8.8.8.8}}}.

HowTo test netsukuku daemon on real hardware

On Linux

The following commands have been tested in a Ubuntu environment.
The procedure should work in any linux distro when you have installed the appropriate packages.

Dependencies

Open a terminal and give these commands:

luca@luca-laptop:~$ sudo apt-get update
luca@luca-laptop:~$ sudo apt-get install build-essential
luca@luca-laptop:~$ sudo apt-get install swig
luca@luca-laptop:~$ sudo apt-get install openssl libssl-dev
luca@luca-laptop:~$ sudo apt-get install xsltproc tinc

Now, we install Stackless Python.

luca@luca-laptop:~$ wget http://www.stackless.com/binaries/stackless-262-export.tar.bz2
luca@luca-laptop:~$ tar xf stackless-262-export.tar.bz2
luca@luca-laptop:~$ cd stackless-2.6.2
luca@luca-laptop:~/stackless-2.6.2$ mkdir -p /opt/stackless
luca@luca-laptop:~/stackless-2.6.2$ ./configure --prefix=/opt/stackless
luca@luca-laptop:~/stackless-2.6.2$ make
luca@luca-laptop:~/stackless-2.6.2$ sudo make altinstall
luca@luca-laptop:~/stackless-2.6.2$ cd

Now, we install M2Crypto

luca@luca-laptop:~$ wget http://pypi.python.org/packages/source/M/M2Crypto/M2Crypto-0.20.1.tar.gz
luca@luca-laptop:~$ tar xf M2Crypto-0.20.1.tar.gz 
luca@luca-laptop:~$ cd M2Crypto-0.20.1/
luca@luca-laptop:~/M2Crypto-0.20.1$ /opt/stackless/bin/python2.6 setup.py build
luca@luca-laptop:~/M2Crypto-0.20.1$ sudo /opt/stackless/bin/python2.6 setup.py install
luca@luca-laptop:~/M2Crypto-0.20.1$ cd

Now, we install dnspython.

luca@luca-laptop:~$ wget http://www.dnspython.org/kits/1.7.1/dnspython-1.7.1.tar.gz
luca@luca-laptop:~$ tar xf dnspython-1.7.1.tar.gz
luca@luca-laptop:~$ cd dnspython-1.7.1
luca@luca-laptop:~/dnspython-1.7.1$ /opt/stackless/bin/python2.6 setup.py build
luca@luca-laptop:~/dnspython-1.7.1$ sudo /opt/stackless/bin/python2.6 setup.py install
luca@luca-laptop:~/dnspython-1.7.1$ cd

Get netsukuku

Get from the svn repository the current code of Netsukuku.

luca@luca-laptop:~$ svn co http://dev.hinezumi.org/svnroot/netsukuku/sandbox/lukisi/branches/multipleip netsukuku

So that ~/netsukuku/pyntk contains the current python version of netsukuku.

Now, we install andns.

luca@luca-laptop:~$ cd ~/netsukuku/ANDNS/andns
luca@luca-laptop:~/netsukuku/ANDNS/andns$ make
luca@luca-laptop:~/netsukuku/ANDNS/andns$ sudo make install
luca@luca-laptop:~/netsukuku/ANDNS/andns$ cd ~/netsukuku/ANDNS/pyandns
luca@luca-laptop:~/netsukuku/ANDNS/pyandns$ /opt/stackless/bin/python2.6 setup.py build
luca@luca-laptop:~/netsukuku/ANDNS/pyandns$ sudo /opt/stackless/bin/python2.6 setup.py install
luca@luca-laptop:~/netsukuku/ANDNS/pyandns$ cd

Now, we install ntkresolv.

luca@luca-laptop:~$ cd ~/netsukuku/ntkresolv
luca@luca-laptop:~/netsukuku/ntkresolv$ make
luca@luca-laptop:~/netsukuku/ntkresolv$ sudo make install
luca@luca-laptop:~/netsukuku/ntkresolv$ cd

We do not install netsukuku; we'll launch the daemon from its directory.
But we have to prepare its configuration directory.

luca@luca-laptop:~$ sudo mkdir -p /etc/netsukuku
luca@luca-laptop:~$ sudo ln -s $HOME/netsukuku/pyntk/setup/etc/netsukuku/tinc /etc/netsukuku

ANDNA

Confirm that the file /etc/hostname contains the name you want to register in the network. In my case:

luca@luca-primeur:~$ cat /etc/hostname 
luca-primeur
luca@luca-primeur:~$ 

Issue the following commands to configure the DNS wrapper.

luca@luca-primeur:~$ sudo tee /etc/netsukuku/dnswrapper.conf <<EOF >/dev/null
andnsserver in-process
EOF
luca@luca-primeur:~$ sudo tee /etc/netsukuku/andnsserver.conf <<EOF >/dev/null
inetnameserver 8.8.8.8
EOF
luca@luca-primeur:~$ sudo tee /etc/netsukuku/libandns.conf <<EOF >/dev/null
andnsserver 127.0.0.1
EOF
luca@luca-primeur:~$ 

Start pyntk

Open a terminal. Go to the "pyntk" directory, where you find the file "ntkd". Launch the daemon with the Stackless interpreter and specify the NICs you want to manage. Remember to disable any other manager that might interfere with the parameters of those NICs, such as NetworkManager.

luca@luca-laptop:~$ cd netsukuku/pyntk
luca@luca-laptop:~/netsukuku/pyntk$ sudo /opt/stackless/bin/python2.6 ntkd -i eth0 eth1 -vvvv

The flag -vvvv make it to produce a very verbose output. You can redirect it to some file for later examination.
This command will not fork itself in background, so you will not get the prompt back.

If you want (mostly you do) to be able to lookup for names into ANDNA, then instruct the resolver to use 127.0.0.1 as DNS server. Open a new terminal, issue this command:

luca@luca-primeur:~$ sudo tee /etc/resolv.conf <<EOF >/dev/null
nameserver 127.0.0.1
EOF
luca@luca-primeur:~$ 

You might also want to further customize the file /etc/netsukuku/andnsserver.conf if you want to proxy the requests that are for the Internet to a particular DNS server, instead of 8.8.8.8.

Netsukuku/eng/Testing (last edited 2011-01-12 11:41:29 by lukisi)