Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ffbs-parker-nextnode/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=ffbs-parker-nextnode
PKG_VERSION:=1

PKG_MAINTAINER:=Chris Fiege <chris@tinyhost.de>
PKG_LICENSE:=MIT

include $(TOPDIR)/../package/gluon.mk

define Package/ffbs-parker-nextnode
TITLE:=gluon-nextnode config for parker
endef

define Package/ffbs-parker-nextnode/description
This package adds ebtables rules for the parker nextnode range.
This package is needed when the nextnode-ips are outside of the
local net of the router - what is usually the case for parker networks.
endef

$(eval $(call BuildPackageGluon,ffbs-parker-nextnode))

38 changes: 38 additions & 0 deletions ffbs-parker-nextnode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
ffbs-parker-nextnode
====================

This is a package of [gluon-parker](https://github.com/ffbs/gluon-parker),
a Gluon fork that uses routing between the nodes
(aka. Router devices) and the infrastructure.
It is currently in use at Freifunk Braunschweig.
Other communities are interested in adopting it as well.

This package provides `ebtables`-rules that redirect traffic to the
`localnode` IPs on the node itself.

This is needed in networks where the `localnode` addresses are outside the client network - for example when
using with `parker`.

In Freifunk Braunschweig, for example, the `localnode` address is `2001:bf7:382:0::1`.
But the IP addresses of routers and clients are in `2001:bf7:381::`.
With this rule traffic to the `localnode` address is always forwarded to the router.

(The service on the router should redirect the client to one of routers public addresses - otherwise the TCP connection
would break when the client roams to another node with the same redirect.)

site.conf
---------

Your `site.conf` probably already contains a `next_node` section, as
requested by the [documentation](https://gluon.readthedocs.io/en/latest/user/site.html).

For Freifunk Braunschweig this section look like this:

```json
next_node = {
ip4 = "172.16.127.1",
ip6 = "2001:bf7:382:0::1",
name = { "node.ffbs" },
mac = "72:02:46:6a:1c:27",
},
```
12 changes: 12 additions & 0 deletions ffbs-parker-nextnode/files/lib/gluon/ebtables/399-localnode
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
local client_bridge = require 'gluon.client_bridge'
local site = require 'gluon.site'
local next_node = site.next_node({})
local macaddr = client_bridge.next_node_macaddr()

if next_node.ip4 then
rule('PREROUTING -p IPv4 -d ! ' .. macaddr .. ' --ip-dst ' .. site.next_node.ip4() .. ' -j dnat --to-dst ' .. macaddr .. ' --dnat-target ACCEPT', 'nat')
end

if next_node.ip6 then
rule('PREROUTING -p IPv6 -d ! ' .. macaddr .. ' --ip6-dst ' .. site.next_node.ip6() .. ' -j dnat --to-dst ' .. macaddr .. ' --dnat-target ACCEPT', 'nat')
end