Howto share an Internet connection in a mesh network

This article will explain how to configure a simple wifi mesh with a gateway to provide internet access. We will configure a workstation attached to the gateway ethernet interface to have connection to mesh network and internet through gateway Meshlium.


mesh-network

Minimum Requirements

  • All Meshlium has at least one 2.4GHz High Power for mesh network.
  • 1 PC attached to a Meshlium through ethernet
  • 2-n Meshliums


Configuring gateway Meshlium

With Meshlium Manager System we configure ethernet interface like this:


ethernet

And wifi interface like this:

wifi

Have a look to olsr configuration that should look like this:


olsr

Just to finish connect interfaces


join-networks


Now check internet access in gateway Meshlium:


meshLium-250:~# ping www.meshlium.com
PING meshlium.com (84.20.10.73) 56(84) bytes of data.
64 bytes from sh4.guebs.com (84.20.10.73): icmp_seq=1 ttl=59 time=50.7 ms
64 bytes from sh4.guebs.com (84.20.10.73): icmp_seq=2 ttl=59 time=50.5 ms
64 bytes from sh4.guebs.com (84.20.10.73): icmp_seq=3 ttl=59 time=50.4 ms

--- meshlium.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 50.484/50.592/50.702/0.274 ms

meshLium-250:~#
    

Workstation configuration

We configure the workstation in the same subnet as the ehternet interface of Meshlium. For this example ethernet subnet is 192.168.1.0.  Workstation's ip is 192.168.1.14. We assume that internet access is provided via internet through a router with ip 192.168.1.1. Configure ethernet interface in the workstation and check that is possible to establish a connection with Meshlium.


~$ ping 192.168.1.250
PING 192.168.1.250 (192.168.1.250) 56(84) bytes of data.
64 bytes from 192.168.1.250: icmp_seq=1 ttl=64 time=0.218 ms
64 bytes from 192.168.1.250: icmp_seq=2 ttl=64 time=0.166 ms
64 bytes from 192.168.1.250: icmp_seq=3 ttl=64 time=0.191 ms

--- 192.168.1.250 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.166/0.191/0.218/0.026 ms
    

Mesh network uses the subnet 10.10.10.0/24  so is necessary to change routes in workstation to access mesh network:


~$ route add -net 10.10.10.0/24 gw 192.168.1.250
    

Configuring the mesh network Meshliums

Each meshlium uses an ip in the mesh subnet . Each Meshlium uses a correlative ip starting in the 10.10.10.1. Gateway Meshlium uses 10.10.10.250 ip so that is the only ip no other Meshlium can use.

On each Meshlium of the mesh network, is neccesary to redirect ethernet requests to mesh ip of the gateway Meshlium because ethernet access will not be used in mesh Meshliums.


~$ route add -net 10.10.10.0/24 gw 192.168.1.250
    


We need to set gateway Meshlium as default gateway on each mesh Meshlium.


~$ route add default gw 10.10.10.250
    

Finally just modify /etc/resolv.conf to configure DNS server. For this example our DNS server will be 192.168.1.1, so resolv.conf will look like this


nameserver 192.168.1.1
    

We can check internet access on any Meshlium.


~# ping www.meshlium.com
PING meshlium.com (84.20.10.73) 56(84) bytes of data.
64 bytes from sh4.guebs.com (84.20.10.73): icmp_seq=1 ttl=58 time=51.1 ms
64 bytes from sh4.guebs.com (84.20.10.73): icmp_seq=2 ttl=58 time=51.4 ms
64 bytes from sh4.guebs.com (84.20.10.73): icmp_seq=3 ttl=58 time=50.5 ms

--- meshlium.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 50.567/51.052/51.446/0.408 ms
    

Configuring persistent rules:

To make route changes fixed so if any Meshlium switchs off it will load correct configuration when it switchs on and continue automatically working just make a file in /etc/init.d and name it persistent-rules. Edit content like this:
For mesh Meshlium:


#!/bin/bash
# your routes commands here
/sbin/route add -net  192.168.1.0/24 gw 10.10.10.250
/sbin/route add default gw 10.10.10.250
    

For workstation:


#!/bin/bash
# your routes commands here
route add -net 10.10.10.0/24 gw 192.168.1.250
    

Finally execute those two commands just to make persistent-routes get executed when Meshlium switchs on:


~$ chmod +x /etc/init.d/persistent-routes
~$ update-rc.d persistent-routes defaults
    

Now our mesh network will be persistent.


© 2009 Libelium Comunicaciones Distribuidas S.L.

| Terms of use