Mein Fonera 2100 ist leider zu alt für neuere OpenWRT-Versionen (Backfire, Attitude_Adjustment) und damit auch nicht besonders gut geeignet für Mesh-Experimente. Dennoch wollte Ich unbedingt ein Freifunk-AP in Karlsruhe aufmachen, der ein unverschlüsseltes WLAN bereitstellt (SSID: ka.freifunk.net) und allen Traffic durch einen VPN tunnelt. Der VPN-Anbieter ist in diesem Fall Ivacy.com. Das Tunneln ist insofern wichtig, da man sich aufgrund einer unschönen Gesetzeslage als Betreiber strafbar macht für das Handeln siner “Kunden”.
Nach sehr langem ausprobieren und rumbasteln ist das Setup, wenn auch nicht perfekt, einsatzbereit!

1. Fonera “jailbreaken”

Dazu gibt es schon einige Anleitungen im Netz, z.B. diese hier. Im Prinzip braucht man dazu einen USB-Serial-Adapter, wobei Ich den günstigen cp210x empfehlen kann (siehe Ebay, ~2€). Die RX/TX-Pins verbindet man mit den JTAG-Ports des Foneras. Mit z.B. minicom öffnet man die serielle Verbindung zum Gerät, nachdem man dieses gestartet hat und Konfiguriert den RedBoot-Bootloader so, dass dieser auch Images auf einer bestimmten IP-Adresse während des Startvorgangs entgegennimmt.

2. OpenWRT flashen

Zum flashen von OpenWRT auf dem Fonera benötigen wir zuerst die für dieses Gerät passenden und empfohlenen Images (Version: 8.09.2 Kamikaze) und das Programm fon-flash. Das Fonera wird direkt via. Ethernet angeschlossen und nach dem ausführen von fon-flash (das nach dem Fonera “sucht”) angeschalten:

wget http://downloads.openwrt.org/kamikaze/8.09.2/atheros/openwrt-atheros-root.jffs2-64k
wget http://downloads.openwrt.org/kamikaze/8.09.2/atheros/openwrt-atheros-vmlinux.lzma
yaourt -S fon-flash
sudo fon-flash -i eth0 -c openwrt openwrt-atheros-root.squashfs openwrt-atheros-vmlinux.lzma
sudo ifconfig eth0 192.168.1.23 up

3. Programme installieren

Sobald das Gerät geflasht und neugestartet ist, kann man sich mit Telnet darauf verbinden und mit dem Befehl passwd ein Passwort setzen. Als nächstes benötigt man eine Internet-Verbindung in OpenWRT um wichtige Packete zu beziehen. Am einfachsten geht das über eine eingerichtete WLAN-Verbindung mit Hilfe des Web-Interfaces.
In einer SSH-Verbindung, führt man dann folgende Befehle aus:

opkg update
opkg install pptp kmod_mppe

Nach der Installation des Kernel-Moduls, sollte man den Router neustarten.

4. “Freifunk” konfigurieren

Die Grundidee ist: Internet wird vom WAN (Ethernet-Port des Foneras) bereitgestellt, also der LAN-Port mit z.B. dem DSL-Router verkabelt. Das WLAN-Netzwerk stellt ein eigenes, vom WAN-Port unabhängiges Subnet bereit (192.168.1.0/24) und für WLAN-Clients werden dort auch IP-Adressen verteilt. Prinzipiell wird WIFI->WAN weitergeleitet (forward), jedoch ist für WAN keine Standard-Route gesetzt (default gateway) und erst der das zusätzlich konfigurierte PPTP-Interface erstellt dann eine Route. Somit ist für Freifunk-Teilnehmer nur eine Internet-Verbindung möglich, wenn das VPN verbunden ist (yay, ein wenig dirty der workaround).
Angepasst werden müssen die Zugangsdaten für das PPTP und die statische IP am WAN-Port. OpenVPN konnte Ich leider nicht als alternative zu PPTP verwenden, da die Version bei OpenWRT Kamikaze zu alt und inkompatibel war.

package 'wireless'

config 'wifi-device' 'wifi0'
	option 'type' 'atheros'
	option 'channel' 'auto'
	option 'disabled' '0'
	option 'diversity' '0'

config 'wifi-iface'
	option 'device' 'wifi0'
	option 'mode' 'ap'
	option 'ssid' 'ka.freifunk.net'
	option 'network' 'freifunk'
	option 'encryption' 'none'
	option 'isolate' '1' # WLAN-Clients sehen sich gegenseitig nicht
package 'network'

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

# Internet-"Input" :)
config 'interface' 'wan'
	option 'ifname' 'eth0'
	option 'type' 'bridge'
	option 'proto' 'static'
	option 'ipaddr' '192.168.178.3'
	option 'netmask' '255.255.255.0'
	option 'dns' '192.168.178.1'
	# Wir setzen hier absichtlich keine Route, damit
	# Freifunk-Clients nur über den VPN das Internet
	# erreichen

config 'interface' 'pptp'
	option 'proto' 'pptp'
	option 'username' 'user'
	option 'password' 'password'
	option 'peerdns' '0'
	option 'ifname' 'ppp0'
	option 'server' '213.229.84.200' # pptp-uk.ivacy.com
	option 'mtu' '1400' # Extrem wichtig, damit überhaupt Traffic durchgeht :/

# Eigenes Subnet fürs WLAN-Freifunk-Netzwerk
config 'interface' 'freifunk'
	option 'proto' 'static'
	option 'ipaddr' '192.168.1.1'
	option 'netmask' '255.255.255.0'

# Wir "verraten" dem VPN unseren Gateway, damit dieser sich verbinden kann
config 'route'
	option 'interface' 'wan'
	option 'target' '213.229.84.200'
	option 'gateway' '192.168.178.1'
package 'firewall'

config 'defaults'
	option 'syn_flood' '1'
	option 'input' 'ACCEPT'
	option 'output' 'ACCEPT'
	option 'forward' 'REJECT'

config 'zone'
	option 'name' 'wan'
	option 'network' 'wan pptp' # VPN Netzwerk hinzufügen
	option 'input' 'REJECT'
	option 'output' 'ACCEPT'
	option 'forward' 'REJECT'
	option 'masq' '1'
	option 'mtu_fix' '1'

config 'rule'
	option 'src' 'wan'
	option 'proto' 'udp'
	option 'dest_port' '68'
	option 'target' 'ACCEPT'

config 'include'
	option 'path' '/etc/firewall.user'

config 'zone'
	option 'name' 'freifunk'
	option 'input' 'REJECT' # LuCI und SSH geblockt für Wifi-Clients
	option 'forward' 'REJECT'
	option 'output' 'ACCEPT'

# Zugriff aufs lokale Netzwerk unterbinden
config 'rule'
	option 'src' 'freifunk'
	option 'dest' 'wan'
	option 'proto' 'all'
	option 'dest_ip' '192.168.178.0/24'
	option 'target' 'DROP'

# Internetzugriff fürs Freifunk-Netzwerk
config 'forwarding'
	option 'src' 'freifunk'
	option 'dest' 'wan'

config 'rule'
	option 'src' 'freifunk'
	option 'dest_port' '53'
	option 'proto' 'tcpudp'
	option 'target' 'ACCEPT'

config 'rule'
	option 'src' 'freifunk'
	option 'src_port' '67-68'
	option 'dest_port' '67-68'
	option 'proto' 'udp'
	option 'target' 'ACCEPT'

# SSH und Web-Zugriff von WAN aus erlauben:
config 'rule'
	option 'src' 'wan'
	option 'proto' 'tcp'
	option 'dest_port' '22'
	option 'target' 'ACCEPT'

config 'rule'
	option 'src' 'wan'
	option 'proto' 'tcp'
	option 'dest_port' '80'
	option 'target' 'ACCEPT'
#debug
noauth
logfile /dev/null
noaccomp
nopcomp
nocrtscts
lock
maxfail 0
lcp-echo-failure 10
lcp-echo-interval 1
mppe required,stateless
require-mschap-v2
#refuse-chap
#refuse-mschap
#refuse-eap
#refuse-pap
nobsdcomp
nodeflate
idle 0
#!/bin/sh /etc/rc.common
# Copyright (C) 2006 OpenWrt.org
START=70
STOP=30
updown_pptp_interface () {
        config_get proto "$1" proto
        if [ "$proto" = "pptp" ]; then
                if$2 "$1"       
        fi
}
boot () {
        config_load network
        config_foreach updown_pptp_interface interface up
}
start() {
        config_load network
        config_foreach updown_pptp_interface interface up
}
restart() {
        config_load network
        config_foreach updown_pptp_interface interface down
        config_foreach updown_pptp_interface interface up
}
stop() {
        config_load network
        config_foreach updown_pptp_interface interface down
}
chmod +x /etc/init.d/pptp
/etc/init.d/pptp enable # PPTP-Verbindung automatisch mit Systemstart ausführen
package 'dhcp'

config 'dnsmasq'
	option 'domainneeded' '1'
	option 'boguspriv' '1'
	option 'filterwin2k' '0'
	option 'localise_queries' '1'
	option 'local' '/lan/'
	option 'domain' 'lan'
	option 'expandhosts' '1'
	option 'nonegcache' '0'
	option 'authoritative' '1'
	option 'readethers' '1'
	option 'leasefile' '/tmp/dhcp.leases'
	option 'resolvfile' '/tmp/resolv.conf.auto'

# Dhcp-Server fürs Freifunk-Netzwerk aktivieren.
config 'dhcp' 'lan'
	option 'start' '100'
	option 'limit' '150'
	option 'leasetime' '12h'
	option 'interface' 'freifunk'

config 'dhcp' 'wan'
	option 'interface' 'wan'
	option 'ignore' '1'

Tipps und Tricks:

  • Das VPN lässt sich starten/stoppen via Terminal mit folgendem Befehl:
ifup pptp # Starten
ifdown pptp # Stoppen
  • VPN-Verbindung via. Befehl in Terminal aufbauen:
pptp 123.123.123.123 user me@my.com password mypassword noauth lock debug

💬 Are you interested in our work or have some questions? Join us in our public Signal chat pi crew 👋
🪙 If you like our work or want to supprot us, you can donate MobileCoins to our address.