Hallo Robert,
vielen Dank für Deine Antwort. Eigentlich geht es mir darum, openvpn zum Laufen zu bringen. Der startet auch mit /opt/etc/init.d/*S20openvpn .
Wenn ich nun meine Firewallregeln in /usr/local/sbin/*post-firewall eintrage:
Code:
#!/bin/sh
# Deleting this rule temporarily and add it again in the end
iptables -D INPUT -j DROP
# SSH access from WAN:
#iptables -A INPUT -m tcp -p tcp --dport 51901 -j ACCEPT
# Webserver access from WAN:
#iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# OpenVPN access from WAN
iptables -A INPUT -p udp --dport 1234 -j ACCEPT
iptables -t nat -A PREROUTING -i vlan1 -p udp --dport 1234 -j DNAT --to-destination $4:1234
# Allow direct connections between VPN-Clients and Router
iptables -A INPUT -i tun+ -j ACCEPT
iptables -A OUTPUT -o tun+ -j ACCEPT
# Allow connections from VPN-Clients to LAN-Clients
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o br0 -j MASQUERADE
# Allow connections from LAN-Clients to VPN-Clients
iptables -I FORWARD -i tun+ -o br0 -s 10.8.0.0/24 -j ACCEPT
iptables -I FORWARD -i br0 -o tun+ -s 192.168.1.0/24 -j ACCEPT
# Allow forwarding to/from VPN-Clients (needed at least for ping)
iptables -A FORWARD -i tun+ -j ACCEPT
iptables -A FORWARD -o tun+ -j ACCEPT
# Allow VPN-clients to tunnel internet traffic through VPN-Server
iptables -I FORWARD -i tun+ -o vlan1 -s 10.8.0.0/24 -j ACCEPT
# Drop all other input
iptables -A INPUT -j DROP
zeigt mir das WIF nach dem reboot folgendes Portforwarding an:
Code:
Destination Proto. Port Range Redirect to
all UDP 1234 192.168.1.1
Und ich kann das vpn nicht aufbauen.
Wenn ich alternativ /usr/local/sbin/*post-firewall leer lasse und nach dem reboot die Regeln manuell ausführe, funktioniert der Aufbau des vpn. Im WIF ist dann das Portforwarding
Code:
Destination Proto. Port Range Redirect to
all UDP 1234 0.0.0.0
eingetragen.
Ich habe mir daraufhin mal die Bootscripte in /usr/local/sbin/ angeschaut und in alle eine Zeile z. B.
Code:
echo "post-firewall" >> /tmp/start
eingetragen mit dem Ergebnis in /tmp/start:
Code:
post-firewall
post-boot
post-firewall
pre-mount
post-mount
/usr/local/sbin/post-firewall wird scheinbar zweimal ausgeführt?
Gibt es eine Datei, aus der ich entnehmen kann, wann die Startscripte verarbeitet werden?
Auch habe ich festgestellt, dass die Routingtabelle erst nach Ausführung von /usr/local/sbin/post-mount vollständig aufgebaut ist. Wird dann die Variable $4 in
Code:
iptables -t nat -A PREROUTING -i vlan1 -p udp --dport 1234 -j DNAT --to-destination $4:1234
nochmal anders belegt?
Ich habe nun meine Firewallregeln an /usr/local/sbin/post-mount angehängt und jetzt geht es. Ist aber irgendwie nicht im Sinne des Erfinders, glaube ich...
Grüße
hornau