Tinc: Unterschied zwischen den Versionen

Aus Freifunk Kiel
Zur Navigation springen Zur Suche springen
 
Zeile 1: Zeile 1:
Vorsicht - irgendwie geht das so alles noch nicht!
+
Zur Zeit verbinden wir alleinstehende Nodes per VPN mit dem Toppoint-Node - Das ist natürlich eine Krücke. Sinn von Freifunk ist eine von kommerziellen Internet unabhängige Infrastruktur.
  
In Arbeit
+
Unser Ziel ist es, erste Inseln aus direkt verbundenen Nodes zu organisieren und das Netz nach und nach zu verdichten.
  
[[Spezial:Beiträge/86.103.152.193|86.103.152.193]] 19:07, 7. Mai 2011 (UTC)
+
Es ergibt aber in der Anfangszeit wenig Sinn, ein Dutzend unzusammenhängender Nodes zwischen Wik und Russee zu betreiben. Per VPN können wir schon erste Erfahrungen mit dem Routing sammeln und Services testen.
  
Verzeichnissbaum anlegen
+
== Verzeichnisbaum anlegen ==
  
  mkdir -p /etc/tinc/kiel.freifunk.net/hosts
+
mkdir -p /etc/tinc/kiel.freifunk.net/hosts
  
Datei /etc/tinc/kiel.freifunk.net/tinc.conf
+
== Konfigurationsdatei ==
 +
Datei /etc/tinc/kiel.freifunk.net/tinc.conf anlegen:
  
  Name = <nodename-eintragen>
+
Name = <nodename-eintragen>
  ConnectTo = toppoint
+
ConnectTo = medusa
  AddressFamily = any
+
ConnectTo = russee1
  TCPOnly = yes   
+
AddressFamily = any
  Device = /dev/net/tun
+
TCPOnly = yes   
  Interface = tinc-olsr
+
Device = /dev/net/tun
  Mode = switch
+
Interface = tinc0
  PrivateKeyFile = /etc/tinc/kiel.freifunk.net/rsa_key.priv
+
Mode = switch
  Port = 2655
+
PrivateKeyFile = /etc/tinc/kiel.freifunk.net/rsa_key.priv
 +
Port = 2655
  
Public Key der "Zentrale" runterladen
+
== Schlüssel erzeugen und austauschen ==
 +
Public Key von Medusa in die Datei /etc/tinc/kiel.freifunk.net/hosts/medusa kopieren:
  
  wget -O /etc/tinc/kiel.freifunk.net/hosts/toppoint http://freifunk.in-kiel.de/tinc/toppoint
+
  Address = bndlan.dyndns.org
 +
Port = 2655
 +
-----BEGIN RSA PUBLIC KEY-----
 +
MIIBCgKCAQEAwdgK4MsRcPXJ7qoOBXgEewxhEIbwlW0FDyBjFy3n/EQ47JNpyVgm
 +
Zy4umkGw6axgfRYMJ4Js13EfBXepijhYLbfAuvVMKmpCZGo8AvFVch0jJQ4j+weL
 +
WNL+Td0lZQ9Ek8qNlSWvwASUtO+Ew1+sWuKtMCRVzdKNUZgdLRD+Vbf928gARvvt
 +
3rJvqWmHbAAfhiO1aLch2ICPEY2TAo168TnMURXvtlikLY/Bygofe8s18M7DOaLl
 +
uRaEhlVHwflFbnVGP0D//H3HvCJfFoDAhouSgC1BDEnDvFRz65oXCy3jqYugBnKA
 +
Vo8pSGcp0fUc1WD1C16AR0mf9cU2VIsfVwIDAQAB
 +
-----END RSA PUBLIC KEY-----
  
Keys generieren:
+
Public Key von Russee1 in die Datei /etc/tinc/kiel.freifunk.net/hosts/russee1 kopieren:
  
  tincd --config=/etc/tinc/kiel.freifunk.net -K                                 
+
  Address = ffki-russee1.dyndns.org
 +
Port = 2655
 +
-----BEGIN RSA PUBLIC KEY-----
 +
MIIBCgKCAQEAszDwlMVQ6B4mbSy8P/sBGscIOpSDEu0kwTvy03phCCSYheJO8Mat
 +
rsDiejYG06hqqZdxrds9Mv1PLLRYgZjGimM3GYxq4/pyIApqW/VCAbJOw2dCk9h9
 +
008q1Cu/qOAkQvILyz/WMn9/MhOd+YLLrdXS04t2kH/eZ3KyB7s0n8KH+1+ryQrJ
 +
xO8GEyULw9oM0EKPycZ/Rbqz3/qoh/snWGmW+4macmObyrOLaUu25umltz41SkqO
 +
tyLZXhPrrZZ5bJfTy/prlQKgHe/aU7WrAnDu4UFOB+gPh6Aoam0BNykydHajxQUC
 +
OOR1uGk6DTd0XGOyI3kfL1n+hxbECllkQQIDAQAB
 +
-----END RSA PUBLIC KEY-----
  
 +
Eigene Keys generieren:
 +
 +
tincd --config=/etc/tinc/kiel.freifunk.net -K
 +
 +
== Steuerungsskript ==
 
Datei /etc/init.d/tincd anlegen:
 
Datei /etc/init.d/tincd anlegen:
  
  #!/bin/sh /etc/rc.common
+
#!/bin/sh /etc/rc.common
  START=50
+
START=49
 
+
  start() {
+
start() {
    /usr/sbin/tincd -n kiel.freifunk.net
+
  /usr/sbin/tincd -n kiel.freifunk.net
  }
+
}
 
+
  stop() {
+
stop() {
    killall tincd
+
  killall tincd
  }
+
}
 +
 
 +
Das obige Skript ausführbar machen und als Startskript beim Systemstart verwenden:
 +
 
 +
chmod u+x /etc/init.d/tincd
 +
cd /etc/rc.d
 +
ln -s ../init.d/tincd S49tincd
 +
 
 +
== Firewall anpassen ==
 +
Freifunk-Zone um das neue tinc-Interface erweitern in /etc/config/firewall
 +
 
 +
config 'zone'                           
 +
        option 'masq' '1'               
 +
        option 'input' 'ACCEPT'         
 +
        option 'forward' 'REJECT'       
 +
        option 'name' 'freifunk'         
 +
        option 'output' 'ACCEPT'         
 +
        option 'network' 'wireless0 tinc0'
 +
 
 +
Netzwerk-Konfiguration um das neue Interface erweitern in /etc/config/network
  
Danach noch symbolischen Link setzen:
+
config 'interface' 'tinc0'       
 +
        option 'ifname' 'tinc0' 
 +
        option 'proto' 'static'   
 +
        option 'ipaddr' '<tinc-vpn-IP-eintragen>'
 +
        option 'netmask' '255.255.0.0'                                   
 +
        option 'defaultroute' '0'   
 +
        option 'peerdns' '0'
  
  cd /etc/rc.d
+
== Luci anpassen ==
  ln -s ../init.d/tincd S49tincd
+
Mit dem folgenden Eintrag überlebt die tinc-Konfiguration auch ein Update des Routers. In /etc/config/luci
  
Freifunk-Zone um das neue tinc-Interface erweitern, z.B. in /etc/config/firewall
+
config 'extern' 'flash_keep'
 +
        option 'uci' '/etc/config/'
 +
        option 'dropbear' '/etc/dropbear/'
 +
        option 'openvpn' '/etc/openvpn/'
 +
        option 'passwd' '/etc/passwd'
 +
        option 'opkg' '/etc/opkg.conf'
 +
        option 'firewall' '/etc/firewall.user'
 +
        option 'uploads' '/lib/uci/upload/'
 +
        option 'tinc' '/etc/tinc/'
 +
        option 'tincd' '/etc/init.d/tincd'
  
  config 'zone'                   
+
== Key bekanntgeben ==
        option 'name' 'freifunk'
 
        option 'input' 'ACCEPT' 
 
        option 'output' 'ACCEPT'
 
        option 'network' 'freifunk  tincolsr'
 
        option 'forward' 'ACCEPT'
 
  
olsrd-Konfiguration erweitern, z.B. in /etc/config/olsrd
+
Jetzt musst Du noch Deinen Schlüssel an uns übermitteln.
  
  config 'Interface'                 
+
Melde Dich einfach auf der Mailingliste, wir helfen Dir dann weiter.
        option 'interface' 'tincolsr'
 

Aktuelle Version vom 10. Juli 2012, 11:34 Uhr

Zur Zeit verbinden wir alleinstehende Nodes per VPN mit dem Toppoint-Node - Das ist natürlich eine Krücke. Sinn von Freifunk ist eine von kommerziellen Internet unabhängige Infrastruktur.

Unser Ziel ist es, erste Inseln aus direkt verbundenen Nodes zu organisieren und das Netz nach und nach zu verdichten.

Es ergibt aber in der Anfangszeit wenig Sinn, ein Dutzend unzusammenhängender Nodes zwischen Wik und Russee zu betreiben. Per VPN können wir schon erste Erfahrungen mit dem Routing sammeln und Services testen.

Verzeichnisbaum anlegen

mkdir -p /etc/tinc/kiel.freifunk.net/hosts

Konfigurationsdatei

Datei /etc/tinc/kiel.freifunk.net/tinc.conf anlegen:

Name = <nodename-eintragen>
ConnectTo = medusa
ConnectTo = russee1
AddressFamily = any
TCPOnly = yes  
Device = /dev/net/tun
Interface = tinc0
Mode = switch
PrivateKeyFile = /etc/tinc/kiel.freifunk.net/rsa_key.priv
Port = 2655

Schlüssel erzeugen und austauschen

Public Key von Medusa in die Datei /etc/tinc/kiel.freifunk.net/hosts/medusa kopieren:

Address = bndlan.dyndns.org
Port = 2655
-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEAwdgK4MsRcPXJ7qoOBXgEewxhEIbwlW0FDyBjFy3n/EQ47JNpyVgm
Zy4umkGw6axgfRYMJ4Js13EfBXepijhYLbfAuvVMKmpCZGo8AvFVch0jJQ4j+weL
WNL+Td0lZQ9Ek8qNlSWvwASUtO+Ew1+sWuKtMCRVzdKNUZgdLRD+Vbf928gARvvt
3rJvqWmHbAAfhiO1aLch2ICPEY2TAo168TnMURXvtlikLY/Bygofe8s18M7DOaLl
uRaEhlVHwflFbnVGP0D//H3HvCJfFoDAhouSgC1BDEnDvFRz65oXCy3jqYugBnKA
Vo8pSGcp0fUc1WD1C16AR0mf9cU2VIsfVwIDAQAB
-----END RSA PUBLIC KEY-----

Public Key von Russee1 in die Datei /etc/tinc/kiel.freifunk.net/hosts/russee1 kopieren:

Address = ffki-russee1.dyndns.org
Port = 2655
-----BEGIN RSA PUBLIC KEY-----
MIIBCgKCAQEAszDwlMVQ6B4mbSy8P/sBGscIOpSDEu0kwTvy03phCCSYheJO8Mat
rsDiejYG06hqqZdxrds9Mv1PLLRYgZjGimM3GYxq4/pyIApqW/VCAbJOw2dCk9h9
008q1Cu/qOAkQvILyz/WMn9/MhOd+YLLrdXS04t2kH/eZ3KyB7s0n8KH+1+ryQrJ
xO8GEyULw9oM0EKPycZ/Rbqz3/qoh/snWGmW+4macmObyrOLaUu25umltz41SkqO
tyLZXhPrrZZ5bJfTy/prlQKgHe/aU7WrAnDu4UFOB+gPh6Aoam0BNykydHajxQUC
OOR1uGk6DTd0XGOyI3kfL1n+hxbECllkQQIDAQAB
-----END RSA PUBLIC KEY-----

Eigene Keys generieren:

tincd --config=/etc/tinc/kiel.freifunk.net -K

Steuerungsskript

Datei /etc/init.d/tincd anlegen:

#!/bin/sh /etc/rc.common
START=49

start() {
  /usr/sbin/tincd -n kiel.freifunk.net
}

stop() {
  killall tincd
}

Das obige Skript ausführbar machen und als Startskript beim Systemstart verwenden:

chmod u+x /etc/init.d/tincd
cd /etc/rc.d
ln -s ../init.d/tincd S49tincd

Firewall anpassen

Freifunk-Zone um das neue tinc-Interface erweitern in /etc/config/firewall

config 'zone'                             
       option 'masq' '1'                 
       option 'input' 'ACCEPT'           
       option 'forward' 'REJECT'         
       option 'name' 'freifunk'          
       option 'output' 'ACCEPT'          
       option 'network' 'wireless0 tinc0'

Netzwerk-Konfiguration um das neue Interface erweitern in /etc/config/network

config 'interface' 'tinc0'         
       option 'ifname' 'tinc0'   
       option 'proto' 'static'    
       option 'ipaddr' '<tinc-vpn-IP-eintragen>'
       option 'netmask' '255.255.0.0'                                     
       option 'defaultroute' '0'     
       option 'peerdns' '0'

Luci anpassen

Mit dem folgenden Eintrag überlebt die tinc-Konfiguration auch ein Update des Routers. In /etc/config/luci

config 'extern' 'flash_keep'
       option 'uci' '/etc/config/'
       option 'dropbear' '/etc/dropbear/'
       option 'openvpn' '/etc/openvpn/'
       option 'passwd' '/etc/passwd'
       option 'opkg' '/etc/opkg.conf'
       option 'firewall' '/etc/firewall.user'
       option 'uploads' '/lib/uci/upload/'
       option 'tinc' '/etc/tinc/'
       option 'tincd' '/etc/init.d/tincd'

Key bekanntgeben

Jetzt musst Du noch Deinen Schlüssel an uns übermitteln.

Melde Dich einfach auf der Mailingliste, wir helfen Dir dann weiter.