VPN-Server für Dummies

Heute ist Stammtischzeit:
Jeden Donnerstag 20:30 Uhr hier im Chat.
Wer Lust hat, kann sich gerne beteiligen. ;)
  • Hallo!
    VPN - sicher nicht das leichteste Thema - dennoch hoffe ich bei Euch eine Lösung zu finden!

    Installation laut Anleitung:
    http://raspberrypi-hacks.com/29/turn-your-r…vpn-vpn-server/
    (gibt's auch auf Deutsch)
    http://jankarres.de/2013/05/raspbe…r-installieren/

    Problem: Ich verstehe Schritt 10 nicht.... wo was löschen? und wo was anlegen? sysctl.conf???
    Somit komm ich auch nicht weiter und mein PI schreibt beim Reboot
    Fail: Starting vpn daemon: openvpn sysctl failed!
    Fail: startpar: Service returned failre: openvpm ... failed!

    Vielleicht kann mir einer weiterhelfen?! Es ist in der Anleitung zwar genau aber scheinbar für mich nicht genau genug beschrieben.....
    Vielen Dank und Grüße
    Moach

    • Offizieller Beitrag

    Eigentlich gar nicht so schwer ;). Nur die relativen Pfadangaben machen es nicht leichter
    mach mal ein

    Code
    nano /etc/sysctl.conf


    Dann suchst du die Zeile

    Code
    #net.ipv4.ip_forward=1


    und entfernst die raute davor, so das sie so aussieht

    Code
    net.ipv4.ip_forward=1


    Speichern, Beenden, mit Schritt 11 weitermachen

  • Ja ist da ein bisschen Blöd beschrieben. cd .. müsstest Du machen wenn Du im Verzeichnis /etc/openvpn bist.

    Mach einfach folgendes

    Code
    sudo nano /etc/sysctl.conf

    oder

    Code
    sudo sed -i -e 's/^#net.ipv4.ip_forward/net.ipv4.ip_forward/' /etc/sysctl.conf

    Das ändert die Zeile in der Datei per sed inline ohne das Du sie in einem Editor öffnen musst.

    Daher kommt aber der Fehler beim starten nicht, da ist noch etwas anderes krumm.
    Daher mach mal folgendes. Du öffnest das Logfile lesend und so das neue Einträge auf der Konsole angezeigt werden und schiebst das in den Hintergrund (mit dem &):

    Code
    tail -f /var/log/syslog &

    Dann startest Du openvpn neu:

    Code
    /etc/init.d/openvpn restart

    Dann werden die beim starten die Logfile Zeilen mit ausgegeben, die poste mal hier rein. Dann sieht man was beim starten falsch läuft. OpenVPN zeigt eigentlich immer gut an was nicht klappt.
    Meistens sind es die Pfade zu den Cert, CA, TLS Files die nicht passen oder Berechtigungen.

    Das werden wir dann sehen.

  • hallo!
    das mit dem ipv4 hat funktioniert....nun nach anleitung folgender fehler:

    pi@raspberrypi ~ $ /etc/init.d/openvpn restart
    [ ok ] Stopping virtual private network daemon:.
    [....] Starting virtual private network daemon: openvpnSep 11 20:28:00 raspberrypi ovpn-openvpn[5449]: Options error: Unrecognized option or missing parameter(s) in /etc/openvpn/openvpn.conf:12: persits-tunu (2.2.1)
    Sep 11 20:28:00 raspberrypi ovpn-openvpn[5449]: Use --help for more information.
    sysctlSep 11 20:28:00 raspberrypi ovpn-sysctl[5454]: Options error: Unrecognized option or missing parameter(s) in /etc/openvpn/sysctl.conf:1: contrab (2.2.1)
    Sep 11 20:28:00 raspberrypi ovpn-sysctl[5454]: Use --help for more information.
    failed!

    was kanns sein?
    soll ich eine neuinstallation machen? wenn ja einfach nur "sudo apt-get remove openvpn openssl"

    danke für eure hilfe!
    grüße

    • Offizieller Beitrag

    Ich tippe mal auf vergessene und/oder fehlende "" in der /etc/openvpn/openvpn.conf. Auf jeden Fall stimmt das was mit der Syntax nicht.
    also die Datei noch mal mit nano öffnen und schauen ob das was im Tutorial steht auch wirklich 1:1 in der Datei steht.

    Das gleiche gilt für die 2. Datei.

  • habe tatsächlich fehler gefunden.... mit "tail ...." und "restart openvpn" kommt folgende Meldung:

    pi@raspberrypi ~ $ sudo /etc/init.d/openvpn restart
    [ ok ] Stopping virtual private network daemon: openvpn.
    Sep 11 21:41:19 raspberrypi ifplugd(tun0)[4839]: Link beat lost.
    Sep 11 21:41:19 raspberrypi ifplugd(tun0)[4839]: Exiting.
    Sep 11 21:41:20 raspberrypi ntpd[2107]: Deleting interface #5 tun0, 10.8.0.1#123 , interface stats: received=0, sent=0, dropped=0, active_time=14 secs
    Sep 11 21:41:20 raspberrypi ntpd[2107]: peers refreshed
    [....] Starting virtual private network daemon: openvpn sysctlSep 11 21:41:21 ra spberrypi ifplugd(tun0)[5030]: ifplugd 0.28 initializing.
    Sep 11 21:41:21 raspberrypi ifplugd(tun0)[5030]: Using interface tun0/00:00:00:0 0:00:00 with driver <tun> (version: 1.6)
    Sep 11 21:41:21 raspberrypi ifplugd(tun0)[5030]: Using detection mode: SIOCETHTO OL
    Sep 11 21:41:21 raspberrypi ifplugd(tun0)[5030]: Initialization complete, link b eat detected.
    Sep 11 21:41:21 raspberrypi ovpn-sysctl[5028]: Options error: Unrecognized optio n or missing parameter(s) in /etc/openvpn/sysctl.conf:1: contrab (2.2.1)
    Sep 11 21:41:21 raspberrypi ovpn-sysctl[5028]: Use --help for more information.
    Sep 11 21:41:21 raspberrypi ifplugd(tun0)[5030]: Executing '/etc/ifplugd/ifplugd .action tun0 up'.
    Sep 11 21:41:21 raspberrypi ifplugd(tun0)[5030]: client: Ignoring unknown interf ace tun0=tun0.
    Sep 11 21:41:21 raspberrypi ifplugd(tun0)[5030]: Program executed successfully.
    failed!

    files folgen!

    sysctl.confg


    # /etc/sysctl.conf - Configuration file for setting system variables
    # See /etc/sysctl.d/ for additonal system variables
    # See sysctl.conf (5) for information.
    #
    #kernel.domainname = example.com
    # Uncomment the following to stop low-level messages on console
    kernel.printk = 3 4 1 3
    ##############################################################3
    # Functions previously found in netbase
    #
    # Uncomment the next two lines to enable Spoof protection (reverse-path filter)
    # Turn on Source Address Verification in all interfaces to
    # prevent some spoofing attacks
    #net.ipv4.conf.default.rp_filter=1
    #net.ipv4.conf.all.rp_filter=1
    # Uncomment the next line to enable TCP/IP SYN cookies
    # See http://lwn.net/Articles/277146/
    # Note: This may impact IPv6 TCP sessions too
    #net.ipv4.tcp_syncookies=1
    # Uncomment the next line to enable packet forwarding for IPv4
    net.ipv4.ip_forward=1
    # Uncomment the next line to enable packet forwarding for IPv6
    # Enabling this option disables Stateless Address Autoconfiguration
    # based on Router Advertisements for this host
    #net.ipv6.conf.all.forwarding=1

    ###################################################################
    # Additional settings - these settings can improve the network
    # security of the host and prevent against some network attacks
    # including spoofing attacks and man in the middle attacks through
    # redirection. Some network environments, however, require that these
    # settings are disabled so review and enable them as needed.
    #
    # Do not accept ICMP redirects (prevent MITM attacks)
    #net.ipv4.conf.all.accept_redirects = 0
    #net.ipv6.conf.all.accept_redirects = 0
    # _or_
    # Accept ICMP redirects only for gateways listed in our default
    # gateway list (enabled by default)
    # net.ipv4.conf.all.secure_redirects = 1
    #
    # Do not send ICMP redirects (we are not a router)
    #net.ipv4.conf.all.send_redirects = 0
    #
    # Do not accept IP source route packets (we are not a router)
    #net.ipv4.conf.all.accept_source_route = 0
    #net.ipv6.conf.all.accept_source_route = 0
    #
    # Log Martian Packets
    #net.ipv4.conf.all.log_martians = 1
    #
    # rpi tweaks
    vm.swappiness=1
    vm.min_free_kbytes = 8192

    openvpn.conf

    dev tun
    proto udp
    port 1194
    ca /etc/openvpn/easy-rsa/keys/ca.crt
    cert /etc/openvpn/easy-rsa/keys/server.crt
    key /etc/openvpn/easy-rsa/keys/server.key
    dh /etc/openvpn/easy-rsa/keys/dh1024.pem
    user nobody
    group nogroup
    server 10.8.0.0 255.255.255.0
    persist-key
    persist-tun
    status /var/log/openvpn-status.log
    verb 3
    client-to-client
    push "redirect-gateway def1"
    #dns server
    log-append /var/log/openvpn
    comp-lzo

    Einmal editiert, zuletzt von Moach (11. September 2013 um 21:51)

  • Was ist denn da in der openvpn.conf die Zeile 12? Kann man jetzt schlecht zehen, da ich jetzt nicht weiss ob ich die Leerzeilen hier mitzählen darf oder nicht.

    persist-key und persist-tun sind ok.
    server 10.8.0.0 255.255.255.0
    Was soll die Netzmaske dahinter?
    Ist das jetzt die Server oder die Client config? Im Thread Title steht ja was von openvpn Server. :)

  • Die Netzwerkmaske ist schon OK.
    Der Server arbeitet im 10.8.0.0er Netz und betrachtet dieses als Class C Netz.
    Eine wage Behauptung: kann es sein, dass die hier gelisteten Config Dateien nicht aus deinem Echtsystem sind. Irgendwie passen die nicht zu den Fehlermeldungen.
    a) im Log ist persist-tun falsch geschrieben.
    b) Der "contrab" Fehler aus der zweiten Datei macht irgend wie keinen Sinn. In dem geposteten Howto wird aber direkt nach dem editieren der Datei sysctl.conf ein Crontab aufgerufen.
    Ist dies ggf. in der Datei gelandet?

  • Hier mal meine server.conf mit dem Unterschied das ich tap statt tun benutze. Bei den Zertifikaten müsstest Du die Pfade an Deine anpassen.

    und hier mal eine client.conf von mit

  • hallo!
    ich versuchs grad nochmal von beginn zu machen - frage zu step 4
    stimmt das so?

    # This variable should point to
    # the top level of the easy-rsa
    # tree.
    export EASY_RSA="/etc/openvpn/easy-rsa"
    #
    # This variable should point to
    # the requested executables
    #
    export OPENSSL="openssl"
    export PKCS11TOOL="pkcs11-tool"
    export GREP="grep"
    usw.
    usw.

  • es will und will nicht funktionieren . die fehler werden immer anders....um hier nicht noch mehr leuten auf die nerven zu gehen - werde ich eine neuinstallation machen und gleich zu beginn das vpn testen!
    Infos dazu folgen!

    eine 2te Anleitung hab ich auch gefunden - siehe:
    http://raspberrypihelp.net/tutorials/1-op…server-tutorial

    werde diese mal probieren - und ich hoffe es funktioniert auf einem jungfräulichen pi ohne Probleme!


  • Die Netzwerkmaske ist schon OK.
    Der Server arbeitet im 10.8.0.0er Netz und betrachtet dieses als Class C Netz.

    Das ist ein Class A Netz.
    Bei Class C sind die ersten drei Bit der IP 110.
    Die Netzmaske sagt nix aus über die Klasse des Netz.

    Schau mal hier, hab mal ein Tut für Openvpn gemacht gehabt:
    OpenVPN Server auf dem PI

    Offizieller Schmier und Schmutzfink des Forum.
    Warum einfach wenn's auch schwer geht ?

    Kein Support per PN !
    Fragen bitte hier im Forum stellen. So hat jeder etwas davon.

    Einmal editiert, zuletzt von Der_Imperator (12. September 2013 um 22:37)

  • Ich bin so doof....das tutorial hab ich NICHT gefunden! mein erster eindruck - klasse!
    Ich werds mal probieren - dennoch bleib ich dabei - ich setz den pi neu auf - da ich mir sowieso eine eigene anleitung bastel und auch schon gemacht hab gehts relativ schnell....zumal wenn ich zuerst den vpn teste und probleme habe kanns nur mehr an mir liegen und an sonst keinen programmen oder einstellungen....und ihr habts dann leichter mir zu helfen :)

    ist glaub ich die beste lösung - möchte das forum nicht überstrapazieren! bis jetzt hats ja super geklappt!
    zumal ich sowieso zur zeit kein externen ftp zugriff habe?! warum weiß ich nicht - ist aber seit der dhcp umstellung auf fixe ip nicht mehr möglich!

    danke!

  • Hallo!
    Habe nun meinen PI NEU aufgesetzt und erstmal nur den VPN installiert.
    Folgende Anleitung habe ich verwendet welche OHNE Fehler funktioniert hat. Hab nun den PI rebootet und am Win7 PC OpenVpn Gui laufen. Habe zuvor noch das tgz-File in den Ordner OpenVpn/config/openvpn-keys extrahiert.
    Starte ich nun am PC den OpenVpn-Client kommt erst ein Hinweis, dass TAP-Win32 .... Komp.probleme hat. und dannach kommt im Fenster folgende Meldung.

    ........................
    Thu Sep 26 19:10:41 2013 OpenVPN 2.0.9 Win32-MinGW [SSL] [LZO] built on Oct 1 2006

    Thu Sep 26 19:10:41 2013 IMPORTANT: OpenVPN's default port number is now 1194, based on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earlier used 5000 as the default port.

    Thu Sep 26 19:10:41 2013 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.

    Thu Sep 26 19:10:41 2013 LZO compression initialized

    Thu Sep 26 19:10:41 2013 Control Channel MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]

    Thu Sep 26 19:10:41 2013 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ]

    Thu Sep 26 19:10:41 2013 Local Options hash (VER=V4): '41690919'

    Thu Sep 26 19:10:41 2013 Expected Remote Options hash (VER=V4): '530fdded'

    Thu Sep 26 19:10:41 2013 UDPv4 link local: [undef]

    Thu Sep 26 19:10:41 2013 UDPv4 link remote: 192.168.0.17:1194

    Thu Sep 26 19:10:41 2013 TLS: Initial packet from 192.168.0.17:1194, sid=4487718b c143d152

    Thu Sep 26 19:10:41 2013 VERIFY OK: depth=1, /C=AT/ST=CA/L=SanFrancisco/O=Fort-Funston/OU=changeme/CN=changeme/name=changeme/emailAddress=mail@host.domain

    Thu Sep 26 19:10:41 2013 VERIFY OK: depth=0, /C=AT/ST=CA/L=SanFrancisco/O=Fort-Funston/OU=changeme/CN=server/name=changeme/emailAddress=mail@host.domain

    Thu Sep 26 19:10:41 2013 Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key

    Thu Sep 26 19:10:41 2013 Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication

    Thu Sep 26 19:10:41 2013 Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key

    Thu Sep 26 19:10:41 2013 Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication

    Thu Sep 26 19:10:41 2013 Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 1024 bit RSA

    Thu Sep 26 19:10:41 2013 [server] Peer Connection Initiated with 192.168.0.17:1194

    Thu Sep 26 19:10:43 2013 SENT CONTROL [server]: 'PUSH_REQUEST' (status=1)

    Thu Sep 26 19:10:43 2013 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1,route 10.8.0.0 255.255.255.0,topology net30,ifconfig 10.8.0.6 10.8.0.5'

    Thu Sep 26 19:10:43 2013 Options error: Unrecognized option or missing parameter(s) in [PUSH-OPTIONS]:3: topology (2.0.9)

    Thu Sep 26 19:10:43 2013 OPTIONS IMPORT: --ifconfig/up options modified

    Thu Sep 26 19:10:43 2013 OPTIONS IMPORT: route options modified

    Thu Sep 26 19:10:43 2013 CreateFile failed on TAP device: \\.\Global\{2BCC1EC3-E09E-409A-A832-645866C5E648}.tap

    Thu Sep 26 19:10:43 2013 All TAP-Win32 adapters on this system are currently in use.

    Thu Sep 26 19:10:43 2013 Exiting

    Was ist nun falsch?
    Was muss ich machen?
    Bitte um Hilfe und Danke und schöne Grüße!

Jetzt mitmachen!

Du hast noch kein Benutzerkonto auf unserer Seite? Registriere dich kostenlos und nimm an unserer Community teil!