Dieses Wiki ist ein Archiv bis 2023. Das aktuelle Wiki findet sich unter https://wiki.hamburg.ccc.de/

Difference between revisions of "Freifunk:IP:VPN Connect"

From CCCHHWiki
Jump to: navigation, search
(New page: Fuer interessierte Funkfreunde, die sich ebenfalls per VPN an das Hamburger Freifunk Netz anbinden moechten, gibt es hier eine kurze Anleitung auf Basis des Tinc-VPN. == OpenWRT == === T...)
 
(Undo revision 7809 by Janwalls (talk) SPAM)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Fuer interessierte Funkfreunde, die sich ebenfalls per VPN an das Hamburger Freifunk Netz anbinden moechten, gibt es hier eine kurze Anleitung auf Basis des Tinc-VPN.
+
Fuer interessierte Funkfreunde, die sich ebenfalls per VPN an das Hamburger Freifunk Netz anbinden moechten, gibt es hier eine kurze Anleitung auf Basis des Tinc-VPN. Vorrausgesetzt werden unter anderem das Paket "iproute" und "kmod-tun" (ipkg install ip kmod-tun), sowie ein bisschen Zeit.
  
 
== OpenWRT ==
 
== OpenWRT ==
Line 5: Line 5:
 
=== Tinc installieren ===
 
=== Tinc installieren ===
  
  ipkg update && ipkg install tinc
+
  ipkg update && ipkg install tinc ip kmod-tun
 +
 
 +
=== Modul automatisch laden ===
 +
 
 +
echo "tun" >> /etc/modules
  
 
=== Verzeichnisse erstellen ===
 
=== Verzeichnisse erstellen ===
Line 16: Line 20:
  
 
  AddressFamily=ipv4
 
  AddressFamily=ipv4
  Name = [NAME_OF_THE_NODE]
+
  Name = ''[NAME_OF_THE_NODE]''
 
  PrivateKeyFile = /etc/tinc/ffhh/rsa_key.priv
 
  PrivateKeyFile = /etc/tinc/ffhh/rsa_key.priv
 
  Mode = Switch
 
  Mode = Switch
 
  PingTimeout = 30
 
  PingTimeout = 30
 
  Port = 655
 
  Port = 655
  Hostnames=yes
+
  Hostnames = yes
 
  ConnectTo = vpn1
 
  ConnectTo = vpn1
 +
ConnectTo = vpn2
  
 
==== /etc/tinc/ffhh/tinc-up ====
 
==== /etc/tinc/ffhh/tinc-up ====
Line 28: Line 33:
  
 
  #!/bin/sh
 
  #!/bin/sh
  ip addr add dev $INTERFACE [FREIFUNK_IP_ADDRESS]/12 broadcast 10.127.255.255
+
  /usr/sbin/ip addr add dev $INTERFACE ''[FREIFUNK_IP_ADDRESS]''/12 broadcast 10.127.255.255
  ip link set dev $INTERFACE up
+
  /usr/sbin/ip link set dev $INTERFACE up
  
 
  chmod 755 /etc/tinc/ffhh/tinc-up
 
  chmod 755 /etc/tinc/ffhh/tinc-up
Line 37: Line 42:
  
 
  #!/bin/sh
 
  #!/bin/sh
  ip addr del [FREIFUNK_IP_ADDRESS] dev $INTERFACE
+
  /usr/sbin/ip addr del ''[FREIFUNK_IP_ADDRESS]'' dev $INTERFACE
  
 
  chmod 755 /etc/tinc/ffhh/tinc-down
 
  chmod 755 /etc/tinc/ffhh/tinc-down
Line 52: Line 57:
 
  -----END RSA PUBLIC KEY-----
 
  -----END RSA PUBLIC KEY-----
  
==== /etc/tinc/ffhh/hosts/[NAME_OF_THE_NODE] ====
+
==== /etc/tinc/ffhh/hosts/vpn2 ====
  vi /etc/tinc/ffhh/hosts/[NAME_OF_THE_NODE]
+
vi /etc/tinc/ffhh/hosts/vpn2
 +
 
 +
Address = vpn2.hamburg.freifunk.net
 +
Port = 657
 +
-----BEGIN RSA PUBLIC KEY-----
 +
MIGJAoGBAMASTdoGrEN+xmYr7mPkaxzHrJ9BtWhFKZ0AaHkg2/i0txbzvLYl9yKc
 +
Jtd58I41s1Ih4qBOw71fPrw23oDfUtdrNwLwgixOs+FjZZs2xJXR4m2ckHNYgLOo
 +
q+v94uAU+Vz/sbI0CLrP46wx/3LoOe4LuVWZVGldHdez631Mjc6rAgMBAAE=
 +
-----END RSA PUBLIC KEY-----
 +
 
 +
 
 +
==== /etc/tinc/ffhh/hosts/''[NAME_OF_THE_NODE]'' ====
 +
  vi /etc/tinc/ffhh/hosts/''[NAME_OF_THE_NODE]''
  
  Address = [PUBLIC_HOSTNAME_REACHABLE_ON_THE_INTERNET]
+
  Address = ''[PUBLIC_HOSTNAME_REACHABLE_ON_THE_INTERNET]''
 
  Port = 655
 
  Port = 655
 
   
 
   
Line 66: Line 83:
 
  /usr/sbin/tincd -n ffhh &
 
  /usr/sbin/tincd -n ffhh &
 
   
 
   
  iptables -A forwarding_rule -i ffhh -o br0 -j ACCEPT
+
  /usr/sbin/iptables -A forwarding_rule -i ffhh -o br0 -j ACCEPT
  iptables -A forwarding_rule -o ffhh -i br0 -j ACCEPT
+
  /usr/sbin/iptables -A forwarding_rule -o ffhh -i br0 -j ACCEPT
 +
 
 +
chmod 755 /etc/ppp/ip-up.d/tinc
 +
 
 +
==== /etc/ppp/ip-down.d/tinc ====
 +
vi /etc/ppp/ip-down.d/tinc
 +
 
 +
#!/bin/sh
 +
 +
/usr/sbin/tincd -n ffhh -k
 +
 +
/usr/sbin/iptables -D forwarding_rule -i ffhh -o br0 -j ACCEPT 2>/dev/null >/dev/null
 +
/usr/sbin/iptables -D forwarding_rule -o ffhh -i br0 -j ACCEPT 2>/dev/null >/dev/null
 +
 
 +
chmod 755 /etc/ppp/ip-down.d/tinc
 +
 
 +
=== OLSR Konfiguration aktualisieren ===
 +
 
 +
Damit die OLSR Applikation auch Routen austauschen kann, muss in der olsrd.conf im "Interfaces" Abschnitt das Interface "ffhh" hinzugefuegt werden.
  
 +
Interface "eth1" "ffhh"
  
 
=== Keys erstellen ===
 
=== Keys erstellen ===
Line 76: Line 112:
 
=== Keys bekannt geben ===
 
=== Keys bekannt geben ===
  
Der Public-Key, welcher in deiner /etc/tinc/ffhh/hosts/[NAME_OF_THE_NODE] Datei gespeichert wurde, kannst du jederzeit rausruecken. Um mit dem VPN Server eine Verbindung aufzubauen, braucht der VPN Server Betreiber sogar diesen Key. Bitte schick uns die genannte Datei per Email.
+
Der Public-Key, welcher in deiner /etc/tinc/ffhh/hosts/''[NAME_OF_THE_NODE]'' Datei gespeichert wurde, kannst du jederzeit rausruecken. Um mit dem VPN Server eine Verbindung aufzubauen, braucht der VPN Server Betreiber sogar diesen Key. Bitte schick uns die genannte Datei per Email.

Latest revision as of 18:54, 2 November 2011

Fuer interessierte Funkfreunde, die sich ebenfalls per VPN an das Hamburger Freifunk Netz anbinden moechten, gibt es hier eine kurze Anleitung auf Basis des Tinc-VPN. Vorrausgesetzt werden unter anderem das Paket "iproute" und "kmod-tun" (ipkg install ip kmod-tun), sowie ein bisschen Zeit.

OpenWRT

Tinc installieren

ipkg update && ipkg install tinc ip kmod-tun

Modul automatisch laden

echo "tun" >> /etc/modules

Verzeichnisse erstellen

mkdir -p /etc/tinc/ffhh/hosts

Dateien erstellen

/etc/tinc/ffhh/tinc.conf

vi /etc/tinc/ffhh/tinc.conf
AddressFamily=ipv4
Name = [NAME_OF_THE_NODE]
PrivateKeyFile = /etc/tinc/ffhh/rsa_key.priv
Mode = Switch
PingTimeout = 30
Port = 655
Hostnames = yes
ConnectTo = vpn1
ConnectTo = vpn2

/etc/tinc/ffhh/tinc-up

vi /etc/tinc/ffhh/tinc-up
#!/bin/sh
/usr/sbin/ip addr add dev $INTERFACE [FREIFUNK_IP_ADDRESS]/12 broadcast 10.127.255.255
/usr/sbin/ip link set dev $INTERFACE up
chmod 755 /etc/tinc/ffhh/tinc-up

/etc/tinc/ffhh/tinc-down

vi /etc/tinc/ffhh/tinc-down
#!/bin/sh
/usr/sbin/ip addr del [FREIFUNK_IP_ADDRESS] dev $INTERFACE
chmod 755 /etc/tinc/ffhh/tinc-down

/etc/tinc/ffhh/hosts/vpn1

vi /etc/tinc/ffhh/hosts/vpn1
Address = vpn1.hamburg.freifunk.net
Port = 656
-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAKVI9lNEiJ3JVDuXhsLKdqhE+k14bCM8cYaAReNrzBSDODxuLm+pPKwo
+7SgYW2/vAdnbFX689yKIs9inbQGNrakQQS/84pQ4TyN+H1dkhmxn5hweF/Ci3Qp
UxzfjeVmeH2L+ecVOgWK10aoUhfVGvCVB3UpoCT6GrQwOa8gB5vfAgMBAAE=
-----END RSA PUBLIC KEY-----

/etc/tinc/ffhh/hosts/vpn2

vi /etc/tinc/ffhh/hosts/vpn2
Address = vpn2.hamburg.freifunk.net
Port = 657
-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAMASTdoGrEN+xmYr7mPkaxzHrJ9BtWhFKZ0AaHkg2/i0txbzvLYl9yKc
Jtd58I41s1Ih4qBOw71fPrw23oDfUtdrNwLwgixOs+FjZZs2xJXR4m2ckHNYgLOo
q+v94uAU+Vz/sbI0CLrP46wx/3LoOe4LuVWZVGldHdez631Mjc6rAgMBAAE=
-----END RSA PUBLIC KEY-----


/etc/tinc/ffhh/hosts/[NAME_OF_THE_NODE]

vi /etc/tinc/ffhh/hosts/[NAME_OF_THE_NODE]
Address = [PUBLIC_HOSTNAME_REACHABLE_ON_THE_INTERNET]
Port = 655

/etc/ppp/ip-up.d/tinc

vi /etc/ppp/ip-up.d/tinc
#!/bin/sh

/usr/sbin/tincd -n ffhh &

/usr/sbin/iptables -A forwarding_rule -i ffhh -o br0 -j ACCEPT
/usr/sbin/iptables -A forwarding_rule -o ffhh -i br0 -j ACCEPT
chmod 755 /etc/ppp/ip-up.d/tinc

/etc/ppp/ip-down.d/tinc

vi /etc/ppp/ip-down.d/tinc
#!/bin/sh

/usr/sbin/tincd -n ffhh -k

/usr/sbin/iptables -D forwarding_rule -i ffhh -o br0 -j ACCEPT 2>/dev/null >/dev/null
/usr/sbin/iptables -D forwarding_rule -o ffhh -i br0 -j ACCEPT 2>/dev/null >/dev/null
chmod 755 /etc/ppp/ip-down.d/tinc

OLSR Konfiguration aktualisieren

Damit die OLSR Applikation auch Routen austauschen kann, muss in der olsrd.conf im "Interfaces" Abschnitt das Interface "ffhh" hinzugefuegt werden.

Interface "eth1" "ffhh"

Keys erstellen

/usr/sbin/tincd -n ffhh -K

Keys bekannt geben

Der Public-Key, welcher in deiner /etc/tinc/ffhh/hosts/[NAME_OF_THE_NODE] Datei gespeichert wurde, kannst du jederzeit rausruecken. Um mit dem VPN Server eine Verbindung aufzubauen, braucht der VPN Server Betreiber sogar diesen Key. Bitte schick uns die genannte Datei per Email.