In Ninux wireless community we use OLSRd to handle routes among wireless nodes.
To install olsrd into EdgeRouters, you have to:
$ sudo -i # echo 'deb http://ftp.de.debian.org/debian/ wheezy main contrib non-free' > /etc/apt/sources.list # export DEBIAN_FRONTEND=noninteractive # apt-get update && apt-get install wget # cd /tmp # wget http://test.ninux.org/~clauz/edgerouter/olsrd_0.9.0.3_mips.deb # wget http://test.ninux.org/~clauz/edgerouter/olsrd-plugins_0.9.0.3_mips.deb # dpkg -i olsrd_0.9.0.3_mips.deb olsrd-plugins_0.9.0.3_mips.deb
Then, the following config files, customized to reflect user needs, need to be inserted in the following paths
/config/scripts/post-config.d/boot.sh /etc/olsrd/launch4.sh /etc/olsrd/olsrd.conf
For the moment let's forget the ipv6 (launch6.sh) part, because it is not necessary to solve my problem.
Once you have configured VLANs, and you reboot the machine, you should see something like (keep in mind the bold line)
root@ubnt:~# ps aux | grep olsr root 1599 0.0 0.0 3012 1164 pts/0 S 15:46 0:00 /bin/bash /etc/olsrd/launch4.sh root 1600 0.0 0.0 3012 1172 pts/0 S 15:46 0:00 /bin/bash /etc/olsrd/launch6.shroot 1602 0.0 0.0 2636 1072 pts/0 S 15:46 0:00 /usr/sbin/olsrd -f /etc/olsrd/olsrd.conf -d 0 -nofork
me instead, I get
ubnt@ubnt:~$ ps aux | grep olsr root 1446 0.0 0.0 3008 1168 ? S 16:24 0:00 /bin/bash /etc/olsrd/launch4.sh
so there is no
root 1602 0.0 0.0 2636 1072 pts/0 S 15:46 0:00 /usr/sbin/olsrd -f /etc/olsrd/olsrd.conf -d 0 -nofork
If I move the
/config/scripts/post-config.d/boot.sh
file to another position, for example
/home/ubnt/boot.sh
and I do
# sh /home/ubnt/boot.sh
then I correctly get
root@ubnt:~# ps aux | grep olsr root 1599 0.0 0.0 3012 1164 pts/0 S 15:46 0:00 /bin/bash /etc/olsrd/launch4.sh root 1600 0.0 0.0 3012 1172 pts/0 S 15:46 0:00 /bin/bash /etc/olsrd/launch6.sh root 1602 0.0 0.0 2636 1072 pts/0 S 15:46 0:00 /usr/sbin/olsrd -f /etc/olsrd/olsrd.conf -d 0 -nofork
so I really do not understand where the problem is.
Files permissions
root@ubnt:~# ls -latr /config/scripts/post-config.d/boot.sh -rwxr-xr-x 1 ubnt users 1333 Oct 24 15:37 /config/scripts/post-config.d/boot.sh root@ubnt:~# ls -latr /etc/olsrd/ total 36 -rwxr-xr-x 1 ubnt users 43 Jan 1 2015 6olsr -rwxr-xr-x 1 ubnt users 49 Jan 1 2015 4olsr -rw-r--r-- 1 root root 1474 Nov 27 2015 olsrd.pud.position.conf -rw-r--r-- 1 root root 189 Nov 27 2015 olsrd.sgw.speed.conf -rw-r--r-- 1 root root 198 Oct 23 19:59 olsrd.conf -rwxr-xr-x 1 ubnt users 104 Oct 23 20:10 launch4.sh -rwxr-xr-x 1 ubnt users 105 Oct 23 20:10 launch6.sh drwxr-xr-x 1 root root 4096 Oct 24 10:00 . drwxrwxr-x 1 root vyattacf 4096 Oct 24 16:24 ..
# cat /config/scripts/post-config.d/boot.sh
root@ubnt:~# cat /config/scripts/post-config.d/boot.sh #!/bin/sh /etc/olsrd/launch4.sh & /etc/olsrd/launch6.sh & # tables: #110 local routes #111 RtTable #112 RtTableDefault #113 Special Table for /1 #114 blackhole table sleep 5 #Copy local routes only from table main 254 to table 110 ip route show table 254 | grep -Ev ^default | grep -Ev ^blackhole | while read ROUTE ; do MASK=`echo "${ROUTE}" | awk '{print $1}' | awk -F/ '{print $2}'` if [ "$MASK" -ne 16 ] ; then ip route add table 110 $ROUTE fi done #First evaluate local routes ip rule add from all lookup 110 pref 3 #Private routes to OLSR table ip rule add to 10.0.0.0/8 table 111 pref 4 ip rule add to 172.16.0.0/12 table 111 pref 4 ip rule add to 192.168.0.0/16 table 111 pref 4 #Ninux IP Addresses to OLSR table ip rule add to 176.62.53.0/24 table 111 pref 4 #Evaluate blackholes ip rule add from all table 114 pref 5 #Send traffic of public address to BGP border routers ip rule add from 176.62.53.0/24 table 113 pref 6 #Lookup default route first from user and then from OLSR ip rule add from all lookup 254 pref 7 ip rule add from all lookup 112 pref 8 #Blackhole private aggregates ip route add blackhole 10.0.0.0/8 table 114 ip route add blackhole 172.16.0.0/12 table 114 ip route add blackhole 192.168.0.0/16 table 114 #Blackhole Ninux aggregate ip route add blackhole 176.62.53.0/24 table 114 exit 0
# cat /etc/olsrd/olsrd.conf
root@ubnt:~# cat /etc/olsrd/olsrd.conf LinkQualityFishEye 0 Hna4 { 10.120.2.0 255.255.255.0 10.120.3.0 255.255.255.0 } Interface "eth0.3" { } LoadPlugin "olsrd_httpinfo.so.0.1" { } LoadPlugin "olsrd_jsoninfo.so.0.0" { }
# cat /etc/olsrd/launch4.sh
root@ubnt:~# cat /etc/olsrd/launch4.sh #!/bin/bash while true; do /usr/sbin/olsrd -f /etc/olsrd/olsrd.conf -d 0 -nofork sleep 60 done