OpenWrt Forum Archive

Topic: Zigbee-style dynamic routing mesh network? (OSPF, Quagga)

The content of this topic has been archived on 24 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I've been trying to set up a simple, Zigbee-style mesh WLAN with three Fonera+s running 8.09, r14511 as nodes, placed thus:

RAP-1001:
    wan: eth0.1            Connected to 192.168.254.254 (Internet AP)
    lan: eth0.0 (disconnected), wifi0    192.168.1.1

RAP-1002:
    lan: eth0.0 (disconnected), wifi0    192.168.1.2

RAP-1003:
    lan: eth0.0 (disconnected), wifi0    192.168.1.3

For testing the nodes have been arranged so that:
192.168.1.1 can reach 192.168.1.3 only
192.168.1.2 can reach 192.168.1.3 only

(192.168.1.3 can reach both nodes)
(Very occasional direct connectivity between 192.168.1.1 and 192.168.1.2 occurs, but the link quality is less than 1/70)

Desired behaviour: Dynamic routing should route connections via reachable nodes, eg connections from 192.168.1.1 to 192.168.1.2 should be routed via 192.168.1.3 while the direct link is unavailable.

I'm out of my depth on this one but it seemed that OSPF seemed a sensible routing protocol, usable with the quagga-ospfd package. I ran through a couple of tutorials, unfortunately it seems I'm missing something somewhere..

On each node the setup is thus:

/etc/config/network

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ifname' 'eth0.0'
        option 'ipaddr' '192.168.1.1' (.2 , .3)
        option 'defaultroute' '0'
        option 'peerdns' '0'
        option 'netmask' '255.255.255.0'

config 'interface' 'wan'
        option 'ifname' 'eth0.1'
        option 'proto' 'dhcp'

/etc/config/wireless

config 'wifi-device' 'wifi0'
        option 'type' 'atheros'
        option 'diversity' '0'
        option 'disabled' '0'
        option 'channel' '10'
        option 'hwmode' '11b'

config 'wifi-iface'
        option 'device' 'wifi0'
        option 'key' 'routingtest'
        option 'ssid' 'Routing Test'
        option 'network' 'lan'
        option 'mode' 'adhoc'
        option 'bssid' 'RoutingTest'
        option 'hidden' '1'
        option 'encryption' 'psk2'

/etc/quagga/ospfd.conf (identical for all 3 nodes except for IP and hostname)

!
! Example /etc/zebra/ospfd.conf configuration file
!
! Change the hostname to the name of your Access Point
hostname RAP-1001

! Set both of these passwords
password xyz
enable password xyz

! Turn off welcome messages
no banner motd

! Create an access list that allows access from localhost and nowhere else
access-list access permit 127.0.0.1/32
access-list access deny any

! Enable access control on the command-line interface
line vty
    access-class access

! Use authentication key for Access Point to Access Point communication
interface wlan0
    ip ospf authentication-key kiwifi

! Enable routing for the entire wireless network
router ospf
    network 192.0.0.0/8 area 0

! Set the router ID to the IP address of WLAN0
    ospf router-id 192.168.1.1

! Enable authentication on the wireless network
    area 0 authentication

! Enable RFC-1583 compatibility to avoid routing loops
    compatible rfc1583

! Enable logging
log file /tmp/ospfd.log

/etc/quagga/zebra.conf  (identical for all 3 nodes except IP and hostname)

!
! Example /etc/zebra/zebra.conf configuration file
!
! Change the hostname to the name of your Access Point
hostname RAP-1001

! Set both of these passwords
password xyz
enable password xyz

! Turn off welcome messages
no banner motd

! Interface definitions

! Loopback
interface lo
    description loopback interface

! Wired interface
interface lan
    description wired interface
interface wlan0
    description wireless interface

! Set this to the IP address of your Access Point uses on your wireless network, usin
! the network allocation from your wireless administrator (10.x.x.1/24)
    ip address 192.168.1.1/24

! Don't send out routing information to uninterested wireless client systems.
    multicast

! Create an access list that allows access from localhost and nowhere else
access-list access permit 127.0.0.1/32
access-list access deny any

! Enable access control on the command-line interface
line vty
    access-class access

! Enable a static route. Set this to the router on your wired network
ip route 0.0.0.0/0 192.168.254.254

! Enable logging
log file /tmp/zebra.log

The configuration runs, but no routing occurs (a ping request from 192.168.1.1 to 192.168.1.2 is not routed via 192.168.1.3). With Quagga running on 192.168.1.2 and 192.168.1.3, I restarted Quagga on 192.168.1.1 and queried the logs after 5 minutes:

root@RAP-1001:~# /etc/init.d/quagga start
quagga.init: Starting zebra ... done.
quagga.init: Starting ospfd ... done.
quagga.init: Starting watchquagga ... done.

root@RAP-1001:~# cat /tmp/ospfd.log
2009/04/11 10:20:37 OSPF: OSPFd 0.98.6 starting: vty@2604
2009/04/11 10:20:37 OSPF: interface 192.168.1.1 join AllSPFRouters Multicast group.
2009/04/11 10:20:37 OSPF: interface 192.168.254.31 join AllSPFRouters Multicast group.
2009/04/11 10:20:38 OSPF: Link State Update: Unknown Neighbor 192.168.1.3 on int: br-lan:192.168.1.1
2009/04/11 10:20:39 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:20:39 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:20:39 OSPF: DR-Election[1st]: Backup 192.168.1.1
2009/04/11 10:20:39 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:20:39 OSPF: DR-Election[2nd]: Backup 192.168.1.1
2009/04/11 10:20:39 OSPF: DR-Election[2nd]: DR     192.168.1.3
2009/04/11 10:20:39 OSPF: interface 192.168.1.1 join AllDRouters Multicast group.
2009/04/11 10:20:39 OSPF: Packet[DD]: Neighbor 192.168.1.3 Negotiation done (Slave).
2009/04/11 10:20:44 OSPF: Link State Acknowledgment: Unknown Neighbor 192.168.1.2.
2009/04/11 10:20:44 OSPF: nsm_change_state(192.168.1.3, Loading -> Full): scheduling new router-LSA origination
2009/04/11 10:20:49 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:20:49 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:20:49 OSPF: DR-Election[2nd]: Backup 192.168.1.1
2009/04/11 10:20:49 OSPF: DR-Election[2nd]: DR     192.168.1.3
2009/04/11 10:20:59 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:20:59 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:20:59 OSPF: DR-Election[2nd]: Backup 192.168.1.1
2009/04/11 10:20:59 OSPF: DR-Election[2nd]: DR     192.168.1.3
2009/04/11 10:21:09 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:21:09 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:21:09 OSPF: DR-Election[2nd]: Backup 192.168.1.1
2009/04/11 10:21:09 OSPF: DR-Election[2nd]: DR     192.168.1.3
2009/04/11 10:21:16 OSPF: DR-Election[1st]: Backup 192.168.1.1
2009/04/11 10:21:16 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:21:16 OSPF: Packet[DD]: Neighbor 192.168.1.2 Negotiation done (Slave).
2009/04/11 10:21:16 OSPF: nsm_change_state(192.168.1.2, Exchange -> Full): scheduling new router-LSA origination
2009/04/11 10:21:17 OSPF: DR-Election[1st]: Backup 192.168.254.31
2009/04/11 10:21:17 OSPF: DR-Election[1st]: DR     192.168.254.31
2009/04/11 10:21:17 OSPF: DR-Election[2nd]: Backup 0.0.0.0
2009/04/11 10:21:17 OSPF: DR-Election[2nd]: DR     192.168.254.31
2009/04/11 10:21:17 OSPF: interface 192.168.254.31 join AllDRouters Multicast group.
2009/04/11 10:21:19 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:21:19 OSPF: DR-Election[1st]: DR     192.168.1.2
2009/04/11 10:21:19 OSPF: DR-Election[2nd]: Backup 192.168.1.3
2009/04/11 10:21:19 OSPF: DR-Election[2nd]: DR     192.168.1.2
2009/04/11 10:21:19 OSPF: interface 192.168.1.1 leave AllDRouters Multicast group.
2009/04/11 10:22:07 OSPF: nsm_change_state(192.168.1.2, Full -> Init): scheduling new router-LSA origination
2009/04/11 10:22:07 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:22:07 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:22:09 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:22:09 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:22:09 OSPF: DR-Election[1st]: Backup 192.168.1.1
2009/04/11 10:22:09 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:22:09 OSPF: DR-Election[2nd]: Backup 192.168.1.1
2009/04/11 10:22:09 OSPF: DR-Election[2nd]: DR     192.168.1.3
2009/04/11 10:22:09 OSPF: interface 192.168.1.1 join AllDRouters Multicast group.
2009/04/11 10:22:19 OSPF: Link State Acknowledgment: Neighbor[192.168.1.2] state Init is less than Exchange
2009/04/11 10:22:19 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:22:19 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:22:19 OSPF: DR-Election[2nd]: Backup 192.168.1.1
2009/04/11 10:22:19 OSPF: DR-Election[2nd]: DR     192.168.1.3
2009/04/11 10:22:29 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:22:29 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:22:29 OSPF: DR-Election[2nd]: Backup 192.168.1.1
2009/04/11 10:22:29 OSPF: DR-Election[2nd]: DR     192.168.1.3
2009/04/11 10:22:39 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:22:39 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:22:39 OSPF: DR-Election[2nd]: Backup 192.168.1.1
2009/04/11 10:22:39 OSPF: DR-Election[2nd]: DR     192.168.1.3
2009/04/11 10:22:48 OSPF: DR-Election[1st]: Backup 192.168.1.1
2009/04/11 10:22:48 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:22:48 OSPF: Packet[DD]: Neighbor 192.168.1.2 Negotiation done (Slave).
2009/04/11 10:22:48 OSPF: nsm_change_state(192.168.1.2, Exchange -> Full): scheduling new router-LSA origination
2009/04/11 10:22:49 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:22:49 OSPF: DR-Election[1st]: DR     192.168.1.2
2009/04/11 10:22:49 OSPF: DR-Election[2nd]: Backup 192.168.1.3
2009/04/11 10:22:49 OSPF: DR-Election[2nd]: DR     192.168.1.2
2009/04/11 10:22:49 OSPF: interface 192.168.1.1 leave AllDRouters Multicast group.
2009/04/11 10:23:48 OSPF: nsm_change_state(192.168.1.2, Full -> ExStart): scheduling new router-LSA origination
2009/04/11 10:23:53 OSPF: Packet[DD]: Neighbor 192.168.1.2 Negotiation done (Slave).
2009/04/11 10:23:58 OSPF: Packet[DD] [Slave]: Neighbor 192.168.1.2 packet duplicated.
2009/04/11 10:24:08 OSPF: Packet[DD] [Slave]: Neighbor 192.168.1.2 packet duplicated.
2009/04/11 10:24:13 OSPF: Packet[DD] [Slave]: Neighbor 192.168.1.2 packet duplicated.
2009/04/11 10:24:13 OSPF: nsm_change_state(192.168.1.2, Exchange -> Full): scheduling new router-LSA origination
2009/04/11 10:24:29 OSPF: nsm_change_state(192.168.1.2, Full -> Down): scheduling new router-LSA origination
2009/04/11 10:24:29 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:24:29 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:24:49 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:24:49 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:24:49 OSPF: DR-Election[1st]: Backup 192.168.1.1
2009/04/11 10:24:49 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:24:49 OSPF: DR-Election[2nd]: Backup 192.168.1.1
2009/04/11 10:24:49 OSPF: DR-Election[2nd]: DR     192.168.1.3
2009/04/11 10:24:49 OSPF: interface 192.168.1.1 join AllDRouters Multicast group.
2009/04/11 10:24:50 OSPF: DR-Election[1st]: Backup 192.168.1.1
2009/04/11 10:24:50 OSPF: DR-Election[1st]: DR     192.168.1.3
2009/04/11 10:24:50 OSPF: Packet[DD]: Neighbor 192.168.1.2 Negotiation done (Slave).
2009/04/11 10:24:55 OSPF: Packet[DD] [Slave]: Neighbor 192.168.1.2 packet duplicated.
2009/04/11 10:25:00 OSPF: nsm_change_state(192.168.1.2, Exchange -> Full): scheduling new router-LSA origination
2009/04/11 10:25:09 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:25:09 OSPF: DR-Election[1st]: DR     192.168.1.2
2009/04/11 10:25:09 OSPF: DR-Election[2nd]: Backup 192.168.1.3
2009/04/11 10:25:09 OSPF: DR-Election[2nd]: DR     192.168.1.2
2009/04/11 10:25:09 OSPF: interface 192.168.1.1 leave AllDRouters Multicast group.
2009/04/11 10:26:02 OSPF: nsm_change_state(192.168.1.2, Full -> Init): scheduling new router-LSA origination
2009/04/11 10:26:02 OSPF: DR-Election[1st]: Backup 192.168.1.3
2009/04/11 10:26:02 OSPF: DR-Election[1st]: DR     192.168.1.3

root@RAP-1001:~# cat /tmp/zebra.log
2009/04/11 10:20:37 ZEBRA: Zebra 0.98.6 starting: vty@2601
root@RAP-1001:~#

And viewing the ospdf daemon from 192.168.1.1:

root@RAP-1001:~# nc localhost ospfd

User Access Verification

ÿûÿûÿþ"ÿýPassword:

RAP-1001> show ip ospf neighbor
show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface           RXmtL RqstL DBsmL
192.168.1.2       1   Init/DROther    00:00:25    192.168.1.2     br-lan:192.168.1.1     0     0     0
192.168.1.3       1   Full/DR         00:00:37    192.168.1.3     br-lan:192.168.1.1     0     0     0
RAP-1001> show ip ospf neighbor
show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface           RXmtL RqstL DBsmL
192.168.1.2       1   Init/DROther    00:00:35    192.168.1.2     br-lan:192.168.1.1     0     0     0
192.168.1.3       1   Full/DR         00:00:37    192.168.1.3     br-lan:192.168.1.1     0     0     0
RAP-1001> exit
exit
root@RAP-1001:~# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2): 56 data bytes
64 bytes from 192.168.1.2: seq=6 ttl=64 time=10.875 ms
64 bytes from 192.168.1.2: seq=12 ttl=64 time=10.807 ms
^C
--- 192.168.1.2 ping statistics ---
35 packets transmitted, 2 packets received, 94% packet loss
round-trip min/avg/max = 10.807/10.841/10.875 ms
root@RAP-1001:~#

from 192.168.1.2...

RAP-1002> show ip ospf neighbor
show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface           RXmtL RqstL DBsmL
192.168.1.3       1   Full/Backup     00:00:38    192.168.1.3     br-lan:192.168.1.2     0     0     0
RAP-1002> exit
exit
root@RAP-1002:~# ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=14 ttl=64 time=21.694 ms
64 bytes from 192.168.1.1: seq=25 ttl=64 time=9.490 ms
^C
--- 192.168.1.1 ping statistics ---
37 packets transmitted, 2 packets received, 94% packet loss
round-trip min/avg/max = 9.490/15.592/21.694 ms

and from 192.168.1.3...

RAP-1003> show ip ospf neighbor
show ip ospf neighbor

Neighbor ID     Pri   State           Dead Time   Address         Interface           RXmtL RqstL DBsmL
192.168.1.1       1   Full/DROther    00:00:37    192.168.1.1     br-lan:192.168.1.3     0     0     0
192.168.1.2       1   Full/DR         00:00:36    192.168.1.2     br-lan:192.168.1.3     1     0     0
RAP-1003>

Really confused. Each node appears to be aware of its neighbour, but no routing is taking place. I'm new to routing in general as well as OSPF so I've absolutely no idea where to look for next. I've got a sinking feeling that it's something obvious. Can anyone point me in the right direction?

Many thanks!

The discussion might have continued from here.