Hi!
I had a chat the other day on IRC about how to assign ip addresses whether there is an internet gateway available or not.
Here is the problem and the solution I came up with. Let me know if that makes sense or if I'm complicating my life.
* Problem *
Our network is still small, there may or may not be an internet gateway available on it, it doesn't matter. From what I read here http://www.open-mesh.org/projects/batman-adv/wiki/Gateways for nodes to have access to the internet, the internet gateway has to be a dhcp server.
The node requests an ip by dhcp and then knows what the default route is. But if the gateway disappears, there is no more dhcp server, the nodes do not have ip addresses and the mesh network is about useless.
But if I set nodes with static ips, then the mesh is routable all the time, but nodes do not know the default route to reach the internet.
Am I right so far?
* Solution *
Someone on irc pointed me out to this page: http://www.open-mesh.org/projects/batman-adv/wiki/Uevent I use this uevent to send a dhcp request if a gateway becomes available or go back to a static ip if all gateways are gone.
Attached is the hotplug script I use. It is in /etc/hotplug.d/net/99-batman-adv-gw. It supposes the interface is configured by default with a static ip.
It works perfectly, but I can't believe there is no simpler solution to this. Our problem should be a quite common one. What is the general solution to it?
Thanks, Geneviève
Have you tried to set every node with static ip but also providing dhcp server to a range of ips ? For example: node 1 from 192.168.1.1 to 192.168.1.10 then node 2: 192.168.1.11 to 192.168.1.20 and so on.
On 07/18/2012 09:18 PM, Geneviève Bastien wrote:
Hi!
I had a chat the other day on IRC about how to assign ip addresses whether there is an internet gateway available or not.
Here is the problem and the solution I came up with. Let me know if that makes sense or if I'm complicating my life.
- Problem *
Our network is still small, there may or may not be an internet gateway available on it, it doesn't matter. From what I read here http://www.open-mesh.org/projects/batman-adv/wiki/Gateways for nodes to have access to the internet, the internet gateway has to be a dhcp server.
The node requests an ip by dhcp and then knows what the default route is. But if the gateway disappears, there is no more dhcp server, the nodes do not have ip addresses and the mesh network is about useless.
But if I set nodes with static ips, then the mesh is routable all the time, but nodes do not know the default route to reach the internet.
Am I right so far?
- Solution *
Someone on irc pointed me out to this page: http://www.open-mesh.org/projects/batman-adv/wiki/Uevent I use this uevent to send a dhcp request if a gateway becomes available or go back to a static ip if all gateways are gone.
Attached is the hotplug script I use. It is in /etc/hotplug.d/net/99-batman-adv-gw. It supposes the interface is configured by default with a static ip.
It works perfectly, but I can't believe there is no simpler solution to this. Our problem should be a quite common one. What is the general solution to it?
Thanks, Geneviève
Another stab at this, which solves a slightly different scenario:
https://bitbucket.org/guidoi/batmesh/raw/ee7042b01ebe/packages/batman-adv-au...
This makes no assumptions about the interface (static or dhcp), but instead asks for a lease in an alias (br-lan:ipv4)
this is part of a bigger idea https://bitbucket.org/guidoi/batmesh/src/ee7042b01ebe/packages/batman-adv-au...
in a nutshell: every node is initially set to gw_mode=client, with static ip and DHCP server (through dnsmasq) offering leases. so if a client connects to the cloud, it gets an ipv4 and has basic connectivity with other clients (bat cloud has no internet access)
if one node has internet connection, sets gw_mode=server, (either manually or by some magic script) , and this is recognized by other nodes by this hotplug.d hook, which requests an ipv4 (so that routers can do "opkg update" and sync ntp time) and at the same time kills the local dhcp server, so that new clients get the lease from the internet gateway dhcp.
On Wed, Jul 18, 2012 at 10:18 PM, Geneviève Bastien gbastien@versatic.net wrote:
Hi!
I had a chat the other day on IRC about how to assign ip addresses whether there is an internet gateway available or not.
Here is the problem and the solution I came up with. Let me know if that makes sense or if I'm complicating my life.
- Problem *
Our network is still small, there may or may not be an internet gateway available on it, it doesn't matter. From what I read here http://www.open-mesh.org/projects/batman-adv/wiki/Gateways for nodes to have access to the internet, the internet gateway has to be a dhcp server.
The node requests an ip by dhcp and then knows what the default route is. But if the gateway disappears, there is no more dhcp server, the nodes do not have ip addresses and the mesh network is about useless.
But if I set nodes with static ips, then the mesh is routable all the time, but nodes do not know the default route to reach the internet.
Am I right so far?
- Solution *
Someone on irc pointed me out to this page: http://www.open-mesh.org/projects/batman-adv/wiki/Uevent I use this uevent to send a dhcp request if a gateway becomes available or go back to a static ip if all gateways are gone.
Attached is the hotplug script I use. It is in /etc/hotplug.d/net/99-batman-adv-gw. It supposes the interface is configured by default with a static ip.
It works perfectly, but I can't believe there is no simpler solution to this. Our problem should be a quite common one. What is the general solution to it?
Thanks, Geneviève
Hi Guido,
Thanks for the links. I guess we have the same general idea, yours is more developed than mine. Can I borrow some of your scripts?
These packages could be made available to the batman community. I think they solve a common scenario and could be useful to others, though I did learn a lot about hotplug by working on this problem :D
Cheers, Geneviève
On 12-07-18 09:35 PM, Guido Iribarren wrote:
Another stab at this, which solves a slightly different scenario:
https://bitbucket.org/guidoi/batmesh/raw/ee7042b01ebe/packages/batman-adv-au...
This makes no assumptions about the interface (static or dhcp), but instead asks for a lease in an alias (br-lan:ipv4)
this is part of a bigger idea https://bitbucket.org/guidoi/batmesh/src/ee7042b01ebe/packages/batman-adv-au...
in a nutshell: every node is initially set to gw_mode=client, with static ip and DHCP server (through dnsmasq) offering leases. so if a client connects to the cloud, it gets an ipv4 and has basic connectivity with other clients (bat cloud has no internet access)
if one node has internet connection, sets gw_mode=server, (either manually or by some magic script) , and this is recognized by other nodes by this hotplug.d hook, which requests an ipv4 (so that routers can do "opkg update" and sync ntp time) and at the same time kills the local dhcp server, so that new clients get the lease from the internet gateway dhcp.
On Wed, Jul 18, 2012 at 10:18 PM, Geneviève Bastien gbastien@versatic.net wrote:
Hi!
I had a chat the other day on IRC about how to assign ip addresses whether there is an internet gateway available or not.
Here is the problem and the solution I came up with. Let me know if that makes sense or if I'm complicating my life.
- Problem *
Our network is still small, there may or may not be an internet gateway available on it, it doesn't matter. From what I read here http://www.open-mesh.org/projects/batman-adv/wiki/Gateways for nodes to have access to the internet, the internet gateway has to be a dhcp server.
The node requests an ip by dhcp and then knows what the default route is. But if the gateway disappears, there is no more dhcp server, the nodes do not have ip addresses and the mesh network is about useless.
But if I set nodes with static ips, then the mesh is routable all the time, but nodes do not know the default route to reach the internet.
Am I right so far?
- Solution *
Someone on irc pointed me out to this page: http://www.open-mesh.org/projects/batman-adv/wiki/Uevent I use this uevent to send a dhcp request if a gateway becomes available or go back to a static ip if all gateways are gone.
Attached is the hotplug script I use. It is in /etc/hotplug.d/net/99-batman-adv-gw. It supposes the interface is configured by default with a static ip.
It works perfectly, but I can't believe there is no simpler solution to this. Our problem should be a quite common one. What is the general solution to it?
Thanks, Geneviève
Please do! Reuse it, modify it, adapt it, i didn't think they were enough lines of code to reserve a gpl notice :)
the intention is indeed to make this available, upstream in openwrt official packages, but i'm still getting the grip on sending patches and stuff in the meantime any feedback is much appreciated
On 7/19/12, Geneviève Bastien gbastien@versatic.net wrote:
Hi Guido,
Thanks for the links. I guess we have the same general idea, yours is more developed than mine. Can I borrow some of your scripts?
These packages could be made available to the batman community. I think they solve a common scenario and could be useful to others, though I did learn a lot about hotplug by working on this problem :D
Cheers, Geneviève
On 12-07-18 09:35 PM, Guido Iribarren wrote:
Another stab at this, which solves a slightly different scenario:
https://bitbucket.org/guidoi/batmesh/raw/ee7042b01ebe/packages/batman-adv-au...
This makes no assumptions about the interface (static or dhcp), but instead asks for a lease in an alias (br-lan:ipv4)
this is part of a bigger idea https://bitbucket.org/guidoi/batmesh/src/ee7042b01ebe/packages/batman-adv-au...
in a nutshell: every node is initially set to gw_mode=client, with static ip and DHCP server (through dnsmasq) offering leases. so if a client connects to the cloud, it gets an ipv4 and has basic connectivity with other clients (bat cloud has no internet access)
if one node has internet connection, sets gw_mode=server, (either manually or by some magic script) , and this is recognized by other nodes by this hotplug.d hook, which requests an ipv4 (so that routers can do "opkg update" and sync ntp time) and at the same time kills the local dhcp server, so that new clients get the lease from the internet gateway dhcp.
On Wed, Jul 18, 2012 at 10:18 PM, Geneviève Bastien gbastien@versatic.net wrote:
Hi!
I had a chat the other day on IRC about how to assign ip addresses whether there is an internet gateway available or not.
Here is the problem and the solution I came up with. Let me know if that makes sense or if I'm complicating my life.
- Problem *
Our network is still small, there may or may not be an internet gateway available on it, it doesn't matter. From what I read here http://www.open-mesh.org/projects/batman-adv/wiki/Gateways for nodes to have access to the internet, the internet gateway has to be a dhcp server.
The node requests an ip by dhcp and then knows what the default route is. But if the gateway disappears, there is no more dhcp server, the nodes do not have ip addresses and the mesh network is about useless.
But if I set nodes with static ips, then the mesh is routable all the time, but nodes do not know the default route to reach the internet.
Am I right so far?
- Solution *
Someone on irc pointed me out to this page: http://www.open-mesh.org/projects/batman-adv/wiki/Uevent I use this uevent to send a dhcp request if a gateway becomes available or go back to a static ip if all gateways are gone.
Attached is the hotplug script I use. It is in /etc/hotplug.d/net/99-batman-adv-gw. It supposes the interface is configured by default with a static ip.
It works perfectly, but I can't believe there is no simpler solution to this. Our problem should be a quite common one. What is the general solution to it?
Thanks, Geneviève
b.a.t.m.a.n@lists.open-mesh.org