OpenWrt Forum Archive

Topic: mesh network with olsr

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

hi i just set up to tp-link AP with openwrt bb 14.07 and oslrd but my problem is i can get internet connection from  2 Ap, (topology ap tplink with openwrt bb14.07 and olsr connected to internet throught cable, olsr connection establish, 2 ap tplink with bb 14.07 and olsrd no cable connection)

i will past my config soon, if any one can give me a tips what i did wrong , i am newbe in that subject please make that in mind.

dhcp

config dnsmasq
    option domainneeded '1'
    option boguspriv '1'
    option localise_queries '1'
    option rebind_protection '1'
    option rebind_localhost '1'
    option local '/lan/'
    option domain 'lan'
    option expandhosts '1'
    option authoritative '1'
    option readethers '1'
    option leasefile '/tmp/dhcp.leases'
    option resolvfile '/tmp/resolv.conf.auto'
    list server '8.8.8.8'
config dhcp 'lan'
    option interface 'lan'
    option start '100'
    option limit '150'
    option leasetime '12h'
    option dhcpv6 'server'
    option ra 'server'
    option ra_management '1'
config dhcp 'wan'
    option interface 'wan'
    option ignore '1'
config odhcpd 'odhcpd'
    option maindhcp '0'
    option leasefile '/tmp/hosts/odhcpd'
    option leasetrigger '/usr/sbin/odhcpd-update'
config dhcp
    option interface 'wlan'
    option start '10'
    option limit '253'
    option leasetime '1h'
    option force '1'
firewall

config defaults
    option syn_flood '1'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'ACCEPT'
config zone
    option name 'lan'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'ACCEPT'
    option network 'lan'
    option masq '1'
config include
    option path '/etc/firewall.user'
config zone
    option input 'ACCEPT'
    option forward 'ACCEPT'
    option output 'ACCEPT'
    option name 'wlan'
    option network 'wlan'
config forwarding
    option dest 'wlan'
    option src 'lan'
config zone
    option input 'ACCEPT'
    option forward 'ACCEPT'
    option output 'ACCEPT'
    option name 'mesh'
    option network 'mesh'
config forwarding
    option dest 'wlan'
    option src 'mesh'
config forwarding
    option dest 'mesh'
    option src 'lan'
config forwarding
    option dest 'mesh'
    option src 'wlan'
network

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'
config globals 'globals'
    option ula_prefix 'fd36:8746:a725::/48'
config interface 'lan'
    option _orig_ifname 'eth0'
    option _orig_bridge 'false'
    option proto 'dhcp'
    option ifname 'eth0'
config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'
config switch_vlan
    option device 'switch0'
    option vlan '1'
    option ports '0 1 2 3 4'
config interface 'mesh'
    option _orig_ifname 'wlan0'
    option _orig_bridge 'false'
    option proto 'static'
    option ipaddr '100.162.210.7'
    option netmask '255.0.0.0'
config interface 'wlan'
    option proto 'static'
    option ipaddr '10.210.7.1'
    option netmask '255.255.255.0'
olsrd

config olsrd
    option IpVersion '4'
    option FIBMetric 'flat'
    option LinkQualityLevel '2'
    option LinkQualityAlgorithm 'etx_ffeth'
    option OlsrPort '698'
    option Willingness '3'
config LoadPlugin
    option library 'olsrd_arprefresh.so.0.1'
    option ignore '0'
config LoadPlugin
    option library 'olsrd_dyn_gw.so.0.5'
    option ignore '0'
config LoadPlugin
    option library 'olsrd_httpinfo.so.0.1'
    option port '1978'
    list Net '0.0.0.0 0.0.0.0'
    option ignore '0'
config LoadPlugin
    option library 'olsrd_nameservice.so.0.3'
    option ignore '0'
config LoadPlugin
    option library 'olsrd_txtinfo.so.0.1'
    option accept '0.0.0.0'
    option ignore '0'
config Interface
    option ignore '0'
    option interface 'mesh'
    option Mode 'mesh'
config InterfaceDefaults
    option Mode 'mesh'
config Hna4
    option netaddr '10.210.7.0'
    option netmask '255.255.255.0'
config Hna4
    option netaddr '0.0.0.0'
    option netmask '0.0.0.0'
config LoadPlugin
    option library 'olsrd_jsoninfo.so.0.0'
    option ignore '0'
config Interface
    option ignore '0'
    option interface 'lan'
    option Mode 'ether'
wireless

config wifi-device 'radio0'
    option type 'mac80211'
    option hwmode '11g'
    option path 'platform/ar933x_wmac'
    option htmode 'HT20'
    option channel '1'
    option txpower '30'
    option country 'US'
config wifi-iface
    option device 'radio0'
    option mode 'ap'
    option encryption 'none'
    option network 'wlan'
    option ssid 'OpenWrt1-mesh'
config wifi-iface
    option device 'radio0'
    option encryption 'none'
    option ssid 'mesh'
    option mode 'adhoc'
    option network 'mesh' 

(Last edited by sat4all on 4 Feb 2016, 18:50)

hi

any one can help me with that ??

noone can help me?

Don't know if you ever got it working but here are my generic configuration files. They work for me with no problems.

/etc/olsrd.config:

# olsr.org OLSR daemon config file
# /etc/olsrd.conf
#
# Modified for sample OLSR network by Justin S. Leiteb
# http://justin.phq.org/ Fri Jun  8 10:34:27 EDT 2007
# Many comments and commented line from conf file distributed
# with olsrd omitted for brevity in wiki.

DebugLevel      0
IpVersion       4
ClearScreen     yes

# On the second OLSR node (olsrd.conf not supplied for this node, since only one line is different),
# which has a LAN interface on the 10.100.2.0/255.255.255.0 network, the Hna4 entry is:
# 10.100.2.0 255.255.255.0.  These Hna4 entries are what propagates information about how to route
# to these subnets through the mesh.
Hna4
{
        # My home LAN
        10.0.10.0  255.255.255.0
}

AllowNoInt      yes
UseHysteresis   no

# Hysteresis parameters
HystScaling     0.50
HystThrHigh     0.80
HystThrLow      0.30


LinkQualityLevel        2
Pollrate        0.1
NicChgsPollInt  3.0

TcRedundancy            2
MprCoverage             7


Interface "wlan0"
{
         AutoDetectChanges      yes
         HelloInterval          5.0
         HelloValidityTime      90.0
         TcInterval             2.0
         TcValidityTime         270.0
         MidInterval            15.0
         MidValidityTime        90.0
         HnaInterval            15.0
         HnaValidityTime        90.0
}

# Run http server with mesh information.  Won't work unless you've already installed
# the olsrd_httpinfo plugin through ipkg.
LoadPlugin "olsrd_httpinfo.so.0.1"
{
        PlParam         "port"  "1979"
        PlParam         "Net"   "0.0.0.0 0.0.0.0"
}

-------------------------------------
/etc/firewall.user:

#!/bin/sh

# Copyright (C) 2006 OpenWrt.org

iptables -F input_rule
iptables -F output_rule
iptables -F forwarding_rule
iptables -t nat -F prerouting_rule
iptables -t nat -F postrouting_rule

# The following chains are for traffic directed at the IP of the
# WAN interface

iptables -F input_wan
iptables -F forwarding_wan
iptables -t nat -F prerouting_wan

# Does anyone have a command to get the name of the WIFI interface on Kamikaze so
# that it doesn't have to be hard-coded here?  This is a bit sloppy it seems.
WIFI=wlan0
LAN=eth1
WAN=eth0

iptables        -A input_wan      -p tcp --dport 22 -j ACCEPT

# Allow connections to olsr info port.
iptables        -A input_wan      -p tcp --dport 1979 -j ACCEPT

# Allow WAN connections to olsr info port????
iptables        -A input_rule -i $WIFI      -p tcp --dport 1979 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables        -A output_rule -o $WIFI     -p tcp --sport 1979 -m state --state ESTABLISHED -j ACCEPT
iptables        -A output_rule -o $WIFI     -p tcp --dport 1979 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables        -A input_rule -i $WIFI      -p tcp --sport 1979 -m state --state ESTABLISHED -j ACCEPT

# OLSR needs port 698 to transmit state messages.
iptables -A input_rule -p udp --dport 698 -j ACCEPT


# Debugging... do we have WIFI, LAN and WAN appropriately defined?
# These values are passed to us from /etc/init.d/firewall, which
# calls this script.

# echo WIFI == $WIFI
# echo LAN == $LAN
# echo WAN == $WAN

iptables -A forwarding_rule -i $WAN -o $WIFI -j ACCEPT

iptables -A forwarding_rule -i $WIFI -o $WAN -j ACCEPT

# For forwarding LAN & WIFI in nodes
iptables -A forwarding_rule -i $LAN -o $WIFI -j ACCEPT

# For WIFI clients to connect to nodes.
iptables -A forwarding_rule -i $WIFI -o $WIFI -j ACCEPT

# For connecting a wired lan client of node 1 to wired lan client of node 2
iptables -A forwarding_rule -i $LAN -o $LAN -j ACCEPT

# WIFI needs to go to LAN ports, too!
iptables -A forwarding_rule -i $WIFI -o $LAN -j ACCEPT

##### Copied from dd-wrt olsr #####
iptables -t nat -A postrouting_rule -o $WAN -j MASQUERADE
iptables -t nat -A postrouting_rule -o $WIFI -s 10.0.0.10/255.255.0.0 -d 10.0.0.10/255.255.0.0 -j MASQUERADE
iptables -t nat -A postrouting_rule -o $LAN -s 10.0.10.0/255.255.255.0 -d 10.0.10.0/255.255.255.0 -j MASQUERADE

-------------------------------------
/etc/config/olsrd:

config olsrd
        # uncomment the following line to use a custom config file instead:
        option config_file '/etc/olsrd.conf'

        option IpVersion '4'

config LoadPlugin
        option library 'olsrd_arprefresh.so.0.1'

config LoadPlugin
        option library 'olsrd_dyn_gw.so.0.5'

config LoadPlugin
        option library 'olsrd_httpinfo.so.0.1'
        option port '1978'
        list Net '0.0.0.0 0.0.0.0'

config LoadPlugin
        option library 'olsrd_nameservice.so.0.3'

config LoadPlugin
        option library 'olsrd_txtinfo.so.0.1'
        option accept '0.0.0.0'

config Interface
        list interface 'wlan'

-------------------------------------
/etc/config/firewall:

config defaults
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          REJECT
# Uncomment this line to disable ipv6 rules
#       option disable_ipv6     1

config zone
        option name             lan
        option network          'lan'
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT

config zone
        option name             wan
        option network          'wan'
        option input            REJECT
        option output           ACCEPT
        option forward          REJECT
        option masq             1
        option mtu_fix          1

-------------------------------------
/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 ifname 'eth0'
        option type 'bridge'
        option proto 'static'
        option ipaddr '10.0.10.1'
        option netmask '255.255.255.0'
        option dns '8.8.8.8'

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'

config switch
        option name 'eth0'
        option reset '1'
        option enable_vlan '1'

config switch_vlan
        option device 'eth0'
        option vlan '1'
        option ports '0 1 2 3 4'

config interface 'WIFI'
        option proto 'static'
        option ipaddr '10.0.0.10'
        option netmask '255.255.0.0'

-------------------------------------
/etc/config/wireless:

config wifi-device 'radio0'
        option type 'mac80211'
        option channel '1'
        option hwmode '11ng'
        option disabled '0'

config wifi-iface
        option device 'radio0'
        option mode 'adhoc'
        option ssid 'MESH-V2'
        option encryption 'none'
        option network 'wlan WIFI'

-------------------------------------

(Last edited by will on 19 Jul 2016, 07:26)

If you use a HNA (in /etc/olsrd.conf) of "0.0.0.0 0.0.0.0" in addition to your lan HNA such as:

Hna4
{
        # My home LAN
        10.0.10.0  255.255.255.0
        # Gateway
        0.0.0.0 0.0.0.0
}

then OLSR should route external IP's out that node. I was able to get a ping out to 8.8.8.8 after I added that HNA statement. My next step was DNS but since I did not have an internal DNS server, I simply set the DNS option on the LAN networks of all nodes to be '8.8.8.8' in /etc/config/network such as:

config interface 'lan'
        option ifname 'eth0'
        option type 'bridge'
        option proto 'static'
        option ipaddr '10.0.10.1'
        option netmask '255.255.255.0'
    option dns '8.8.8.8'

and then I had a working setup where I could browse the internet from any lan using domain names. From there you could create a virtual wlan bridged to the lan and it would work the same way. Complex stuff!

(Last edited by will on 19 Jul 2016, 07:28)

The discussion might have continued from here.