Saturday, July 6, 2013

Quagga - installation and configuration

Installation and configuration steps:

Prerequisites:
Before configuring and installing quagga, the following packages need to be installed first:
awk (gawk works fine)
libzebra (or libidzebra)
libreadline6-dev (version 5 should work as well)
libreadline6 (version 5 should work as well)

After installing this libraries, you should run sudo ldconfig just to be sure to refresh the library path.

First, the default user quagga needs to be created. Another user can be specified to the configure script, but this shows how to configure quagga with the default user:

[root@fedora ~]# adduser quagga
[root@fedora ~]# mkdir /usr/local/quagga
[root@fedora ~]# chown quagga:quagga /usr/local/quagga

After this, you need to call the ./configure script:
[root@fedora ~]# cd /usr/local/src/quagga-0.99.11/
[root@fedora quagga-0.99.11]# ./configure --sysconfdir=/usr/local/quagga --localstatedir=/usr/local/quagga

If some of the implemented protocols aren't needed, they can be disabled. Also, isis has to be enabled manually:

[root@fedora quagga-0.99.11]# ./configure --enable-isisd --disable-ripd \
>   --disable-ripngd --disable-ospfd --disable-ospf6d \
>   --sysconfdir=/usr/local/quagga --localstatedir=/usr/local/quagga

If you want to use isis,
Next:
[root@fedora quagga-0.99.11]# ./make
[root@fedora quagga-0.99.11]# ./make install

You will notice that the installation script has created sample config files for each deamon in the /usr/local/quagga folder. In order to work, you need to create conf files both in /usr/local/etc and in /usr/local/quagga. The config file in use will be the one in the directory set at configure time, in our case /usr/local/quagga.

Example for isisd:

[root@fedora quagga-0.99.11]# sudo cp /usr/local/quagga/isisd.conf.sample /usr/local/quagga/isisd.conf
[root@fedora quagga-0.99.11]# sudo cp /usr/local/quagga/isisd.conf.sample /usr/local/etc/isisd.conf

Now, you can run a daemon by calling:
[root@fedora quagga-0.99.11]# sudo isisd -d
Additional, a script for configuring and installing quagga (an example):
#!/bin/sh

QPATH=~/QUAGGA/quagga-0.99.22
cd $QPATH

case $1 in

    build)
        make distclean
     ./configure --enable-isisd --disable-ripngd --disable-ospf6d --sysconfdir=/usr/local/quagga --localstatedir=/usr/local/quagga --enable-vtysh
 make
 ;;

    install)
     make install
 ;;

    clean)
     make clean

esac

Thursday, July 7, 2011

BSD improve IPv6

Some continuation to the previous post:

Ping from host with code using mac addresses for gw (ipv6 addr fd00::3/128):
fd00::1 (linux host)
ping6 fd00::1
PING6(56=40+8+8 bytes) fd00::3 --> fd00::1
16 bytes from fd00::1, icmp_seq=0 hlim=64 time=4.047 ms
16 bytes from fd00::1, icmp_seq=1 hlim=64 time=1.792 ms
16 bytes from fd00::1, icmp_seq=2 hlim=64 time=0.795 ms
^C
--- fd00::1 ping6 statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.795/2.211/4.047/1.360 ms

fd00::4 (freebsd host running original code)
ping6 fd00::4
PING6(56=40+8+8 bytes) fd00::3 --> fd00::4
no response

tcpdump -nei re0 output on host with original code:
10:07:21.720560 00:01:00:00:00:04 > 33:33:00:00:00:6d, ethertype IPv6 (0x86dd), length 158: fd00::4.698 > ff02::6d.698: OLSR, seq 0xd218, length 96
10:07:21.909741 00:01:00:00:00:04 > 02:21:30:ca:dd:35, ethertype IPv4 (0x0800), length 114: 10.0.0.4.22 > 10.0.0.99.36085: Flags [P.], ack 49, win 8326, options [nop,nop,TS val 1136371185 ecr 2080490], length 48
10:07:21.910094 02:21:30:ca:dd:35 > 00:01:00:00:00:04, ethertype IPv4 (0x0800), length 66: 10.0.0.99.36085 > 10.0.0.4.22: Flags [.], ack 35472, win 1002, options [nop,nop,TS val 2080648 ecr 1136371185], length 0
10:07:21.974657 00:01:00:00:00:03 > 33:33:ff:00:00:04, ethertype IPv6 (0x86dd), length 86: fd00::3 > ff02::1:ff00:4: ICMP6, neighbor solicitation, who has fd00::4, length 32
10:07:22.014421 00:01:00:00:00:04 > 33:33:ff:00:00:03, ethertype IPv6 (0x86dd), length 86: fd00::4 > ff02::1:ff00:3: ICMP6, neighbor solicitation, who has fe80::3, length 32

So the original code, doesn't know where to send the answer for the ICMP request, that's why the other host doesn't receive anything.

Also, I tested and the code using lonklocal address, but adds only a default route works the same as the one using mac addresse, but I'm nt sure if it is the best.

Wednesday, July 6, 2011

Improve olsrd on BSD: use linklocal address or not?

Olsrd before the improvements (no filtering, each node can see all others):
IPv4:

--- 20:53:00.042579 ---------------------------------------------------- LINKS

IP address       hyst         LQ       ETX
10.0.0.3         0.000  1.000/1.000    1.000
10.0.0.2         0.000  0.839/0.761    1.565
10.0.0.1         0.000  1.000/1.000    1.000

--- 20:53:03.216848 ----------------------- TWO-HOP NEIGHBORS

IP addr (2-hop)  IP addr (1-hop)  Total cost
10.0.0.3         10.0.0.1         2.000
                 10.0.0.2         3.117
10.0.0.1         10.0.0.2         3.582
                 10.0.0.3         2.000
10.0.0.2         10.0.0.3         2.128
                 10.0.0.1         2.595

netstat output:

netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
10.0.0.0/8         link#1             U           2    13258    re0
10.0.0.1/32        00:01:00:00:00:04  U           0        0    re0
10.0.0.2           10.0.0.3           UGH         0        5    re0 =>
10.0.0.2/32        00:01:00:00:00:04  U           0        0    re0
10.0.0.3           10.0.0.2           UGH         0        2    re0 =>
10.0.0.3/32        00:01:00:00:00:04  U           0        0    re0
10.0.0.4           link#1             UHS         0        0    lo0
127.0.0.1          link#4             UH          0        0    lo0

Aliases are also created and not deleted after closing olsrd.


IPv6:
--- 21:18:09.197225 ---------------------------------------------------- LINKS

IP address                               hyst         LQ       ETX
fd00::1                                  0.000  1.000/1.000    1.000
fd00::2                                  0.000  1.000/1.000    1.000
fd00::3                                  0.000  1.000/1.000    1.000

--- 21:18:09.197602 ----------------------- TWO-HOP NEIGHBORS

IP addr (2-hop)  IP addr (1-hop)  Total cost
fd00::3          fd00::2          2.000
                 fd00::1          2.000
fd00::1          fd00::3          2.000
                 fd00::2          2.000
fd00::2          fd00::3          2.000
                 fd00::1          2.000


netstat output:
Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                             ::1                           UGRS        lo0
::1                               ::1                           UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
fd00::/8                          link#1                        U           re0
fd00::1                           fe80::1%re0                   UGH         re0
fd00::2                           fe80::2%re0                   UGH         re0
fd00::3                           fe80::3%re0                   UGH         re0
fd00::4                           link#1                        UHS         lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%re0/64                     link#1                        U           re0
fe80::201:ff:fe00:4%re0           link#1                        UHS         lo0
fe80::%re1/64                     link#2                        U           re1
fe80::201:ff:fe00:d%re1           link#2                        UHS         lo0
fe80::%lo0/64                     link#4                        U           lo0
fe80::1%lo0                       link#4                        UHS         lo0
ff01:1::/32                       fe80::201:ff:fe00:4%re0       U           re0
ff01:2::/32                       fe80::201:ff:fe00:d%re1       U           re1
ff01:4::/32                       ::1                           U           lo0
ff02::/16                         ::1                           UGRS        lo0
ff02::%re0/32                     fe80::201:ff:fe00:4%re0       U           re0
ff02::%re1/32                     fe80::201:ff:fe00:d%re1       U           re1
ff02::%lo0/32                     ::1                           U           lo0


Olsrd with no aliases added:
IPv4:
netstat output:

netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
10.0.0.0/8         link#1             U           2     8707    re0
10.0.0.1/32        00:01:00:00:00:03  U           0        0    re0
10.0.0.2/32        00:01:00:00:00:03  U           0       11    re0
10.0.0.3           link#1             UHS         0        0    lo0
10.0.0.4/32        00:01:00:00:00:03  U           0        0    re0
127.0.0.1          link#4             UH          0        0    lo0

IPv6:
netstat output:

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                             ::1                           UGRS        lo0 =>
default                           fe80::4%re0                   U           re0
::1                               ::1                           UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
fd00::/8                          link#1                        U           re0
fd00::3                           link#1                        UHS         lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%re0/64                     link#1                        U           re0
fe80::201:ff:fe00:3%re0           link#1                        UHS         lo0
fe80::%lo0/64                     link#4                        U           lo0
fe80::1%lo0                       link#4                        UHS         lo0
ff01:1::/32                       fe80::201:ff:fe00:3%re0       U           re0
ff01:4::/32                       ::1                           U           lo0
ff02::/16                         ::1                           UGRS        lo0
ff02::%re0/32                     fe80::201:ff:fe00:3%re0       U           re0
ff02::%lo0/32                     ::1                           U           lo0


So, instead of routes, there is only one default route created, which is not deleted after closing olsrd.

Olsrd with no aliases, and MAC addresses for IPv6 gateways:
IPv4:
netstat output:
netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
10.0.0.0/8         link#1             U           2    20770    re0
10.0.0.1/32        00:01:00:00:00:03  U           0        0    re0
10.0.0.2/32        00:01:00:00:00:03  U           0        0    re0
10.0.0.3           link#1             UHS         0        0    lo0
10.0.0.4/32        00:01:00:00:00:03  U           0        0    re0
127.0.0.1          link#4             UH          0        0    lo0

IPv6:
netstat output:
Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                             ::1                           UGRS        lo0
::1                               ::1                           UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
fd00::/8                          link#1                        U           re0
fd00::1/128                       00:01:00:00:00:03             U           re0
fd00::2/128                       00:01:00:00:00:03             U           re0
fd00::3                           link#1                        UHS         lo0
fd00::4/128                       00:01:00:00:00:03             U           re0
fe80::/10                         ::1                           UGRS        lo0
fe80::%re0/64                     link#1                        U           re0
fe80::201:ff:fe00:3%re0           link#1                        UHS         lo0
fe80::%lo0/64                     link#4                        U           lo0
fe80::1%lo0                       link#4                        UHS         lo0
ff01:1::/32                       fe80::201:ff:fe00:3%re0       U           re0
ff01:4::/32                       ::1                           U           lo0
ff02::/16                         ::1                           UGRS        lo0
ff02::%re0/32                     fe80::201:ff:fe00:3%re0       U           re0
ff02::%lo0/32                     ::1                           U           lo0

Thursday, June 30, 2011

Strange olsrd behaviour running on 2 FreeBSD vms

So, the same code, same exec file, same config file for both vms running IPv6 mode; I used scp to be sure I have the same thing on both.
No packetloss script used, so I get more routes for one destination.
The output for the first one (used the most for testing):


Nothing wrong so far, but the netstat -rn output looks like this:

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::1                                      ::1                                 UH          lo0
fd00::/8                             link#1                           U             re0
fd00::3                              link#1                           UHS        lo0
fe80::%lo0/64                   link#4                           U             lo0
fe80::1%lo0                      link#4                           UHS        lo0
ff01:1::/32                        fd00::3                           U             re0
ff01:4::/32                        fe80::1%lo0                   U             lo0
ff02::%re0/32                   fd00::3                          U             re0
ff02::%lo0/32                   fe80::1%lo0                   U            lo0

re0 is the interface on which olsrd runs.
No IPv6 route added to the kernel routing table.

The output for the second vm:


The output for netstat -rn for this vm is:

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                                    ::1                                 UGRS        lo0
::1                                       ::1                                 UH            lo0
::ffff:0.0.0.0/96                   ::1                                 UGRS        lo0
fd00::/8                              link#1                           U               re0
fd00::1/0                            fe80::1%re0                  U               re0
fd00::2/0                            fe80::2%re0                  U               re0
fd00::3/0                            fe80::3%re0                  U               re0
fd00::4                               link#1                           UHS          lo0
fe80::/10                            ::1                                 UGRS         lo0
fe80::%re0/64                    link#1                          U                re0
fe80::201:ff:fe00:4%re0     link#1                          UHS          lo0
fe80::%re1/64                    link#2                          U                re1
fe80::201:ff:fe00:d%re1     link#2                          UHS          lo0
fe80::%lo0/64                     link#4                          U               lo0
fe80::1%lo0                        link#4                          UHS          lo0
ff01:1::/32                        fe80::201:ff:fe00:4%re0   U             re0
ff01:2::/32                        fe80::201:ff:fe00:d%re1   U             re1
ff01:4::/32                         ::1                                  U              lo0
ff02::/16                            ::1                                  UGRS       lo0
ff02::%re0/32                  fe80::201:ff:fe00:4%re0    U            re0
ff02::%re1/32                  fe80::201:ff:fe00:d%re1    U            re1
ff02::%lo0/32                    ::1                                  U              lo0

So, you can see the output is very different, this one is better, but not the best.

Sunday, June 26, 2011

FreeBSD vm configure

Since I had some trouble in configuring the FreeBSD vm, here are some basic steps into making a vm work for development:
1. install a package using
pkg_add -r {pkg-name}
portsnap fetch update - similar to apt-get update
portsnap extract
portsnap update
2. enable root ssh login:
edit /etc/ssh/sshd_config by adding PermitRootLogin option, and running /etc/rc.d/sshd reload to activate the change;
3. adding ipv6 net address using
# ifconfig {interface-name} inet6 {IPv6-Address} prefixlen {routed-bit}
4. for internet access configure dns, in /etc/resolv.conf, and gateway to be the same as for your host;
route add default {gw_ip_addr}
5. to run olsrd, the olsrd.conf must be edited and copied into /usr/local/etc;

Wednesday, May 18, 2011

Topology routing table view

On 10.0.0.1:

Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.1    10.0.0.3    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.3    YES    YES    NO    3    3

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.2/32    10.0.0.3    2    2.000    if02   
10.0.0.3/32    10.0.0.3    1    1.000    if02   
10.0.0.4/32    10.0.0.3    2    2.000    if02   
10.0.0.5/32    10.0.0.3    2    2.000    if02   

On 10.0.0.2:
Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.2    10.0.0.3    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.3    YES    YES    NO    3    3

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.1/32    10.0.0.3    2    2.000    if02   
10.0.0.3/32    10.0.0.3    1    1.000    if02   
10.0.0.4/32    10.0.0.3    2    2.000    if02   
10.0.0.5/32    10.0.0.3    2    2.000    if02   

On 10.0.0.3:
Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.3    10.0.0.5    0.00    1.000    1.000    1.000   
10.0.0.3    10.0.0.1    0.00    1.000    1.000    1.000   
10.0.0.3    10.0.0.2    0.00    1.000    1.000    1.000   
10.0.0.3    10.0.0.4    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.4    YES    NO    YES    3    0
10.0.0.5    YES    NO    YES    3    0
10.0.0.1    YES    NO    YES    3    0
10.0.0.2    YES    NO    YES    3    0

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.1/32    10.0.0.1    1    1.000    if02   
10.0.0.2/32    10.0.0.2    1    1.000    if02   
10.0.0.4/32    10.0.0.4    1    1.000    if02   
10.0.0.5/32    10.0.0.5    1    1.000    if02   

On 10.0.0.4:
Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.4    10.0.0.3    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.3    YES    YES    NO    3    3

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.1/32    10.0.0.3    2    2.000    if02   
10.0.0.2/32    10.0.0.3    2    2.000    if02   
10.0.0.3/32    10.0.0.3    1    1.000    if02   
10.0.0.5/32    10.0.0.3    2    2.000    if02   

On 10.0.0.5:
Table: Links
Local IP    Remote IP    Hyst.    LQ    NLQ    Cost
10.0.0.5    10.0.0.3    0.00    1.000    1.000    1.000   

Table: Neighbors
IP address    SYM    MPR    MPRS    Will.    2 Hop Neighbors
10.0.0.3    YES    YES    NO    3    3

Table: Topology
Dest. IP    Last hop IP    LQ    NLQ    Cost
10.0.0.3    10.0.0.1    1.000    1.000    1.000
10.0.0.3    10.0.0.2    1.000    1.000    1.000
10.0.0.1    10.0.0.3    1.000    1.000    1.000
10.0.0.2    10.0.0.3    1.000    1.000    1.000
10.0.0.4    10.0.0.3    1.000    1.000    1.000
10.0.0.5    10.0.0.3    1.000    1.000    1.000
10.0.0.3    10.0.0.4    1.000    1.000    1.000
10.0.0.3    10.0.0.5    1.000    1.000    1.000

Table: HNA
Destination    Gateway

Table: MID
IP address    Aliases

Table: Routes
Destination    Gateway IP    Metric    ETX    Interface
10.0.0.1/32    10.0.0.3    2    2.000    if02   
10.0.0.2/32    10.0.0.3    2    2.000    if02   
10.0.0.3/32    10.0.0.3    1    1.000    if02   
10.0.0.4/32    10.0.0.3    2    2.000    if02