Hi,
I'm trying to implement an openvpn server on my wrt54g, and i'm really almost there
I copied all the keys, and config files from my previously working debian based firewall pc, and the openvpn channel seems to work fine.
LAN is the usual 192.168.1.0/24 and i selected 192.168.31.0/24 for openvpn addresses. The connection builds up fine from the client and i can see the router on both 192.168.1.1 and 192.168.31.1 but that's all. Pinging machines on the LAN does not work, however if I'm receiving Destination Host Unreachable from 192.168.31.1 (the router's tun0 interface address)
Here is my server.conf:
port 1194
proto udp
dev tun
ca ca.crt
cert compi.dyndns.org.crt
key compi.dyndns.org.key # This file should be kept secret
dh dh1024.pem
server 192.168.31.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 192.168.1.0 255.255.255.0"
client-to-client
keepalive 10 120
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3my firewall.user:
#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
iptables -F input_rule
iptables -F output_rule
iptables -F forwarding_rule
iptables -t nat -F prerouting_rule
iptables -t nat -F postrouting_rule
# The following chains are for traffic directed at the IP of the
# WAN interface
iptables -F input_wan
iptables -F forwarding_wan
iptables -t nat -F prerouting_wan
### Open port to WAN
## -- This allows port 22 to be answered by (dropbear on) the router
iptables -t nat -A prerouting_wan -p tcp --dport 22 -j ACCEPT
iptables -A input_wan -p tcp --dport 22 -j ACCEPT
### OpenVPN
## allow connections from outside
iptables -t nat -A prerouting_wan -p udp --dport 1194 -j ACCEPT
iptables -A input_wan -p udp --dport 1194 -j ACCEPT
iptables -A INPUT -i tun+ -j ACCEPT
iptables -A FORWARD -i tun+ -j ACCEPT
iptables -A INPUT -i tap+ -j ACCEPT
iptables -A FORWARD -i tap+ -j ACCEPT
### Port forwarding
## -- This forwards port 8080 on the WAN to port 80 on 192.168.1.2
# iptables -t nat -A prerouting_wan -p tcp --dport 8080 -j DNAT --to 192.168.1.2:80
# iptables -A forwarding_wan -p tcp --dport 80 -d 192.168.1.2 -j ACCEPT
### DMZ
## -- Connections to ports not handled above will be forwarded to 192.168.1.2
iptables -t nat -A prerouting_wan -j DNAT --to 192.168.1.2
iptables -A forwarding_wan -d 192.168.1.2 -j ACCEPTAnd on the end here are the iptables rules as dumped by iptables-save:
# Generated by iptables-save v1.3.3 on Fri Jun 8 23:00:07 2007
*nat
:NEW - [0:0]
:PREROUTING ACCEPT [80:6750]
:POSTROUTING ACCEPT [5:1714]
:OUTPUT ACCEPT [7:1429]
:postrouting_rule - [0:0]
:prerouting_rule - [0:0]
:prerouting_wan - [0:0]
-A NEW -m limit --limit 50/sec --limit-burst 100 -j RETURN
-A NEW -j DROP
-A PREROUTING -m state --state NEW -j NEW
-A PREROUTING -j prerouting_rule
-A PREROUTING -i vlan1 -j prerouting_wan
-A POSTROUTING -j postrouting_rule
-A POSTROUTING -o vlan1 -j MASQUERADE
-A prerouting_wan -p tcp -m tcp --dport 22 -j ACCEPT
-A prerouting_wan -p udp -m udp --dport 1194 -j ACCEPT
-A prerouting_wan -j DNAT --to-destination 192.168.1.2
COMMIT
# Completed on Fri Jun 8 23:00:07 2007
# Generated by iptables-save v1.3.3 on Fri Jun 8 23:00:07 2007
*mangle
:PREROUTING ACCEPT [1053:151837]
:INPUT ACCEPT [784:82831]
:FORWARD ACCEPT [211:59588]
:OUTPUT ACCEPT [668:111316]
:POSTROUTING ACCEPT [883:175957]
COMMIT
# Completed on Fri Jun 8 23:00:07 2007
# Generated by iptables-save v1.3.3 on Fri Jun 8 23:00:07 2007
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:LAN_ACCEPT - [0:0]
:OUTPUT DROP [0:0]
:forwarding_rule - [0:0]
:forwarding_wan - [0:0]
:input_rule - [0:0]
:input_wan - [0:0]
:output_rule - [0:0]
-A INPUT -m state --state INVALID -j DROP
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp ! --tcp-option 2 --tcp-flags SYN SYN -j DROP
-A INPUT -j input_rule
-A INPUT -i vlan1 -j input_wan
-A INPUT -j LAN_ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -p gre -j ACCEPT
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -j REJECT --reject-with icmp-port-unreachable
-A INPUT -i tun+ -j ACCEPT
-A INPUT -i tap+ -j ACCEPT
-A FORWARD -m state --state INVALID -j DROP
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -j forwarding_rule
-A FORWARD -i vlan1 -j forwarding_wan
-A FORWARD -i br0 -o br0 -j ACCEPT
-A FORWARD -i br0 -o vlan1 -j ACCEPT
-A FORWARD -i tun+ -j ACCEPT
-A FORWARD -i tap+ -j ACCEPT
-A LAN_ACCEPT -i vlan1 -j RETURN
-A LAN_ACCEPT -j ACCEPT
-A OUTPUT -m state --state INVALID -j DROP
-A OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A OUTPUT -j output_rule
-A OUTPUT -j ACCEPT
-A OUTPUT -p tcp -j REJECT --reject-with tcp-reset
-A OUTPUT -j REJECT --reject-with icmp-port-unreachable
-A forwarding_wan -d 192.168.1.2 -j ACCEPT
-A input_wan -p tcp -m tcp --dport 22 -j ACCEPT
-A input_wan -p udp -m udp --dport 1194 -j ACCEPT
COMMIT
# Completed on Fri Jun 8 23:00:07 2007the whole setup is based on http://wiki.openwrt.org/OpenVPNTunHowTo … 01d5668d58
I'm quite sure that the problem should be somewhere in the iptables rules, but i cannot find myself what did I do wrong.
Thanks in advance,
compi
