OpenVPN geht nur wenn iptables aus

L I V E Stammtisch ab 20:30 Uhr im Chat
  • Liebes Forum,

    ich bin mit meinem Latein am Ende. Mein VPN funktioniert nicht, wenn iptables an ist.
    Wenn ich iptables -F mach, dann baut sich mein Tunnel auf.

    Ich habe RaspBMC und einen Wlan Stick als Access Point gemäß dieser Anleitung konfiguriert.
    http://raspberry-at-home.com/hotspot-wifi-access-point/

    Vielleicht überschneidet sich da mit iptables und dies Access Point Konfiguration was??

    Habe schon sämtliche Befehle versucht, aber ich erhalte immer "Warte auf Serverantwort"

    iptables -A FORWARD -m state –state RELATED,ESTABLISHED -j ACCEPT
    iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
    iptables -A FORWARD -j REJECT
    iptables -I FORWARD -i tun0 -o eth0 -j ACCEPT
    iptables -I FORWARD -i eth0 -o tun0 -j ACCEPT
    iptables -t nat -I POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE

    /var/log/messages gibt folgende Meldung:

    Apr 25 16:58:07 raspbmc kernel: FORWARD-Raus: IN= OUT=eth0 SRC=192.168.X.X DST=88.198.x.x LEN=76 TOS=0×00 PREC=0xC0 TTL=64 ID=7113 DF PROTO=UDP SPT=123 DPT=123 LEN=56

    FORWARD-Raus:
    iptables -A OUTPUT -j LOG -m limit –limit 5/s –log-prefix “FORWARD-Raus: “

    Kann mir da jemand helfen, bin schon seit ein paar Tagen am versuchen und der Tunnel baut sich nur auf wenn ich iptables -F mache.

    LG

    Einmal editiert, zuletzt von peterert90 (26. April 2014 um 09:32)


  • iptables -A FORWARD -m state –state RELATED,ESTABLISHED -j ACCEPT
    iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
    iptables -A FORWARD -j REJECT
    iptables -I FORWARD -i tun0 -o eth0 -j ACCEPT
    iptables -I FORWARD -i eth0 -o tun0 -j ACCEPT

    Werden in der FORWARD chain, die 2 letzten iptables-Regeln noch ausgeführt, wenn vor ihnen eine Regel (... wie bei dir) mit dem target REJECT steht?

    The most popular websites without IPv6 in Germany.  IPv6-Ausreden

    Meine PIs

    PI4B/8GB (border device) OpenBSD 7.4 (64bit): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server

    PI3B+ FreeBSD 14.0-R-p3 (arm64): SSH-Serv., WireGuard-Serv., ircd-hybrid-Serv., stunnel-Proxy, Mumble-Serv., ddclient

    PI4B/4GB Bullseye-lite (64bit; modifiziert): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server, botamusique, ample

    Einmal editiert, zuletzt von rpi444 (26. April 2014 um 09:45)


  • ... Aber wenn es chronologisch geht dann nicht mehr.


    Ja, bei iptables geht es "chronologisch" (... d. h. in der Reihenfolge von oben nach unten).

    The most popular websites without IPv6 in Germany.  IPv6-Ausreden

    Meine PIs

    PI4B/8GB (border device) OpenBSD 7.4 (64bit): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server

    PI3B+ FreeBSD 14.0-R-p3 (arm64): SSH-Serv., WireGuard-Serv., ircd-hybrid-Serv., stunnel-Proxy, Mumble-Serv., ddclient

    PI4B/4GB Bullseye-lite (64bit; modifiziert): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server, botamusique, ample

  • Okay. Danke. Ich bin mir auch nicht sicher ob sich da nicht irgendwas mit der Access point Konfiguration nicht verträgt. Bzw brauch ich den reject Befehl zwingend?
    Bin leider in Sachen iptables nicht sonderlich erfahren.


  • Bzw brauch ich den reject Befehl zwingend?


    Das solltest Du wissen. Wenn die default policy der FORWARD chain auf ACCEPT ist und Du nach den Regeln mit einem ACCEPT-target, blocken willst, dann ja.

    The most popular websites without IPv6 in Germany.  IPv6-Ausreden

    Meine PIs

    PI4B/8GB (border device) OpenBSD 7.4 (64bit): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server

    PI3B+ FreeBSD 14.0-R-p3 (arm64): SSH-Serv., WireGuard-Serv., ircd-hybrid-Serv., stunnel-Proxy, Mumble-Serv., ddclient

    PI4B/4GB Bullseye-lite (64bit; modifiziert): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server, botamusique, ample

  • Alles klar. Dann ändere ich.mal.die Reihenfolge der Befehlsabläufe.

    So umgestellt, kein Erfolg.
    Jetzt schaut die Config so aus:

    iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
    iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
    iptables -I FORWARD -i tun0 -o eth0 -j ACCEPT
    iptables -I FORWARD -i eth0 -o tun0 -j ACCEPT
    iptables -A FORWARD -j REJECT

    Es kommt immernoch "Warten auf Serverantwort"

    iptables -L zeigt folgende Werte:
    Chain INPUT (policy ACCEPT)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
    ACCEPT all -- 192.168.x.x/24 anywhere
    DROP all -- anywhere anywhere
    ACCEPT all -- 192.168.x.x./24 anywhere (Subnet WLAN Access Point)
    DROP all -- anywhere anywhere
    ACCEPT all -- 192.168.x.x/24 anywhere
    DROP all -- anywhere anywhere

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere
    ACCEPT all -- anywhere anywhere
    ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
    ACCEPT all -- anywhere anywhere
    ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
    ACCEPT all -- 10.8.0.0/24 anywhere
    REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination

    Einmal editiert, zuletzt von peterert90 (26. April 2014 um 10:17)


  • In der INPUT chain wird Alles "gedropt" was nicht 192.168.x.x/24 ist? Du hast Regeln teilweise doppelt, weil Du vorher evtl. nicht "geflusht" hast?

    The most popular websites without IPv6 in Germany.  IPv6-Ausreden

    Meine PIs

    PI4B/8GB (border device) OpenBSD 7.4 (64bit): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server

    PI3B+ FreeBSD 14.0-R-p3 (arm64): SSH-Serv., WireGuard-Serv., ircd-hybrid-Serv., stunnel-Proxy, Mumble-Serv., ddclient

    PI4B/4GB Bullseye-lite (64bit; modifiziert): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server, botamusique, ample

    Einmal editiert, zuletzt von rpi444 (26. April 2014 um 10:38)

  • Ich habe folgenden Befehle noch versucht (ohne Erfolg)
    iptables -A INPUT -p udp --dport 1194 -j ACCEPT

    Wenn ich "flushe" sind meine WLAN Access Point Regeln auch weg. Wie gesagt, bei iptables -F geht der Tunnel ohne Probleme.
    Die Regeln fürs VPN stehen in der rc.local

    Es liegt an der DROP Regel, habe jetzt folgendes eingestellt:
    Es sind zwar noch ein paar doppelt aber es funktioniert:
    Chain INPUT (policy ACCEPT)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
    ACCEPT all -- 192.168.x.x/24 anywhere
    ACCEPT all -- 192.168.x.x/24 anywhere (WLAN Subnet)
    ACCEPT udp -- anywhere anywhere udp dpt:openvpn
    ACCEPT all -- 192.168.x.x/24 anywhere
    DROP all -- anywhere anywhere

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination
    ACCEPT all -- anywhere anywhere
    ACCEPT all -- anywhere anywhere
    ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
    ACCEPT all -- anywhere anywhere
    ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
    ACCEPT all -- 10.8.0.0/24 anywhere
    REJECT all -- anywhere anywhere reject-with icmp-port-unreachable

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination


    Jetzt müsste ich nur noch die "doppelten" Regeln dauerhaft entfernen können

    Einmal editiert, zuletzt von peterert90 (26. April 2014 um 10:58)


  • Es liegt an der DROP Regel, habe jetzt folgendes eingestellt:
    Es sind zwar noch ein paar doppelt aber es funktioniert:
    Jetzt müsste ich nur noch die "doppelten" Regeln dauerhaft entfernen können
    Die Regeln fürs VPN stehen in der rc.local


    Wo stehen die Regeln für den WLAN Access Point? Wie bzw. warum werden nach einem "iptables -F", doppelte Regeln überhaupt generiert? Mit z. B. "iptables -D <CHAIN> <Position-der-Regel-in-der-chain>", kannst Du auch einzelne Regeln löschen.

    The most popular websites without IPv6 in Germany.  IPv6-Ausreden

    Meine PIs

    PI4B/8GB (border device) OpenBSD 7.4 (64bit): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server

    PI3B+ FreeBSD 14.0-R-p3 (arm64): SSH-Serv., WireGuard-Serv., ircd-hybrid-Serv., stunnel-Proxy, Mumble-Serv., ddclient

    PI4B/4GB Bullseye-lite (64bit; modifiziert): SSH-Server, WireGuard-Server, ircd-hybrid-Server, stunnel-Proxy, Mumble-Server, botamusique, ample

    Einmal editiert, zuletzt von rpi444 (26. April 2014 um 13:55)

Jetzt mitmachen!

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