OpenVPN Firewall / Routing Configuration

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
cas8100
DD-WRT Novice


Joined: 24 Nov 2009
Posts: 32

PostPosted: Fri Dec 18, 2009 18:52    Post subject: OpenVPN Firewall / Routing Configuration Reply with quote
Hi All, hoping someone might be able to help.

I have DD-WRT v24.sp2 up and running OpenVPN server via tun interface with pki authentication.

The client machine connects to the server just fine and gets an IP address. I believe the tunnel is working properly. Here's the basic config

Server LAN 192.168.2.x
OpenVPN subnet 192.168.10.x
Client LAN 192.168.1.x

Router can ping client (192.168.10.6)
Router can ping local LAN (192.168.2.180)
Client can ping VPN server(on router) (192.168.10.1)
Client can ping router (192.168.2.1)

Client CANNOT ping anything on the router's lan (i.e. 192.168.2.180).

Here's the firewall settings:

iptables -I INPUT 2 -p udp --dport 1194 -j logaccept
iptables -I INPUT 3 -i tun0 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT
iptables -I FORWARD 3 -i tun0 -o tun0 -j ACCEPT

Here's the server configuration:
port 1194
proto udp
dev tun
#tls-server
dh /tmp/openvpn/dh.pem
ca /tmp/openvpn/ca.crt
cert /tmp/openvpn/cert.pem
key /tmp/openvpn/key.pem
#ifconfig-pool-persist /usr/local/etc/openvpn/ipp.txt
client-config-dir /usr/local/etc/openvpn/ccd
server 192.168.10.0 255.255.255.0
keepalive 10 120
client-to-client
comp-lzo
persist-key
persist-tun
#user nobody
#group nobody
#status openvpn-status.log
verb 3
push "route 192.168.2.0 255.255.255.0"

The problem has to be in the translation to the 192.168.2.x network. Its strange that I can reach the router at 192.168.2.1 but not any of the machines in that subnet.

I'd sure appreciate any help.

Thanks.

CS
Sponsor
cas8100
DD-WRT Novice


Joined: 24 Nov 2009
Posts: 32

PostPosted: Mon Dec 21, 2009 3:39    Post subject: Reply with quote
I'm still struggling with this. Here are the routing tables from the server/router and client, seems to me like everything is in place. Would someone well versed with routing tables please take a look at this?

The problem is that I can connect to the dd-wrt/openvpn server/router on its lan address (192.168.2.1) but I cannot reach any of the computers on the router's LAN. The client computer's local IP is 192.168.1.67 and the client computers's VPN IP is 192.168.10.6.

Thanks VERY much for any help.

CS

SERVER NETSTAT
root@TA:~# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
192.168.10.0 192.168.10.2 255.255.255.0 UG 0 0 0 tun0
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0
7x.9.152.0 0.0.0.0 255.255.252.0 U 0 0 0 vlan1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 7X.9.152.1 0.0.0.0 UG 0 0 0 vlan1

Client Routing Table
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.254 192.168.1.67 25
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
169.254.0.0 255.255.0.0 On-link 192.168.10.6 306
169.254.255.255 255.255.255.255 On-link 192.168.10.6 286
192.168.1.0 255.255.255.0 On-link 192.168.1.67 281
192.168.1.67 255.255.255.255 On-link 192.168.1.67 281
192.168.1.255 255.255.255.255 On-link 192.168.1.67 281
192.168.2.0 255.255.255.0 192.168.10.5 192.168.10.6 30
192.168.10.0 255.255.255.0 192.168.10.5 192.168.10.6 30
192.168.10.4 255.255.255.252 On-link 192.168.10.6 286
192.168.10.6 255.255.255.255 On-link 192.168.10.6 286
192.168.10.7 255.255.255.255 On-link 192.168.10.6 286
224.0.0.0 240.0.0.0 On-link 127.0.0.1 306
224.0.0.0 240.0.0.0 On-link 192.168.10.6 286
224.0.0.0 240.0.0.0 On-link 192.168.1.67 281
255.255.255.255 255.255.255.255 On-link 127.0.0.1 306
255.255.255.255 255.255.255.255 On-link 192.168.10.6 286
255.255.255.255 255.255.255.255 On-link 192.168.1.67 281
===========================================================================

Since they apply as well, here are the current firewall commands that I am running:

iptables -I INPUT 2 -p udp --dport 1194 -j logaccept
iptables -I INPUT 3 -i tun0 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT
iptables -I FORWARD 3 -i tun0 -o tun0 -j ACCEPT
cas8100
DD-WRT Novice


Joined: 24 Nov 2009
Posts: 32

PostPosted: Mon Dec 21, 2009 4:48    Post subject: IPTABLES -L Reply with quote
Here's the Iptables -L command... hoping this might help explain what's wrong. Anyone???

root@TA:~# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
logaccept udp -- anywhere anywhere udp dpt:1194
ACCEPT 0 -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT 0 -- anywhere anywhere
DROP udp -- anywhere anywhere udp dpt:route
DROP udp -- anywhere anywhere udp dpt:route
ACCEPT udp -- anywhere anywhere udp dpt:route
logaccept tcp -- anywhere TOSA tcp dpt:https
logaccept tcp -- anywhere TOSA tcp dpt:ssh
DROP icmp -- anywhere anywhere
DROP igmp -- anywhere anywhere
ACCEPT 0 -- anywhere anywhere state NEW
logaccept 0 -- anywhere anywhere state NEW
DROP 0 -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT 0 -- anywhere anywhere
ACCEPT 0 -- anywhere anywhere
ACCEPT 0 -- anywhere anywhere
ACCEPT gre -- 192.168.2.0/24 anywhere
ACCEPT tcp -- 192.168.2.0/24 anywhere tcp dpt:1723
ACCEPT 0 -- anywhere anywhere
TCPMSS tcp -- anywhere anywhere tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
lan2wan 0 -- anywhere anywhere
ACCEPT 0 -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere 192.168.2.180 tcp dpt:8001
ACCEPT udp -- anywhere 192.168.2.180 udp dpt:8001
TRIGGER 0 -- anywhere anywhere TRIGGER type:in match:0 relate:0
trigger_out 0 -- anywhere anywhere
ACCEPT 0 -- anywhere anywhere state NEW
DROP 0 -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain advgrp_1 (0 references)
target prot opt source destination

Chain advgrp_10 (0 references)
target prot opt source destination

Chain advgrp_2 (0 references)
target prot opt source destination

Chain advgrp_3 (0 references)
target prot opt source destination

Chain advgrp_4 (0 references)
target prot opt source destination

Chain advgrp_5 (0 references)
target prot opt source destination

Chain advgrp_6 (0 references)
target prot opt source destination

Chain advgrp_7 (0 references)
target prot opt source destination

Chain advgrp_8 (0 references)
target prot opt source destination

Chain advgrp_9 (0 references)
target prot opt source destination

Chain grp_1 (0 references)
target prot opt source destination

Chain grp_10 (0 references)
target prot opt source destination

Chain grp_2 (0 references)
target prot opt source destination

Chain grp_3 (0 references)
target prot opt source destination

Chain grp_4 (0 references)
target prot opt source destination

Chain grp_5 (0 references)
target prot opt source destination

Chain grp_6 (0 references)
target prot opt source destination

Chain grp_7 (0 references)
target prot opt source destination

Chain grp_8 (0 references)
target prot opt source destination

Chain grp_9 (0 references)
target prot opt source destination

Chain lan2wan (1 references)
target prot opt source destination

Chain logaccept (4 references)
target prot opt source destination
ACCEPT 0 -- anywhere anywhere

Chain logdrop (0 references)
target prot opt source destination
DROP 0 -- anywhere anywhere

Chain logreject (0 references)
target prot opt source destination
REJECT tcp -- anywhere anywhere tcp reject-with tcp-reset

Chain trigger_out (1 references)
target prot opt source destination
root@TA:~#
lupine
DD-WRT Novice


Joined: 16 Jan 2007
Posts: 47

PostPosted: Mon Dec 21, 2009 19:18    Post subject: Reply with quote
Given that you can talk to the router 192.168.2.1, and it can talk with it's local 192.168.2.0 network all I'd do is add the following routes on the client box:

(formated for windows networking)

route add 192.168.2.1 MASK 255.255.255.0 192.168.10.5
route add 192.168.2.0 MASK 255.255.255.0 192.168.2.1

I'm assuming that 10.5 is the OpenVPN interface of the router.

_________________
D-Link DIR-300
Asus RT-N16
Asus WL-500gPv2
Linksys WRT54GL 1.1
Way too much time.
cas8100
DD-WRT Novice


Joined: 24 Nov 2009
Posts: 32

PostPosted: Mon Dec 21, 2009 22:10    Post subject: Reply with quote
I got it working... well, for the most part at least. There were two problems. The first was that I needed to add this line to my firewall config:

iptables -A FORWARD -s 192.168.10.0/24 -j ACCEPT (IP Range of my VPN network)

After adding that, I could ping my wireless printer, but not any of the computers on my network. Sounds like a firewall problem....

Disabled Kaspersky and whala, ping response from the computer. Not sure what the issue is. The The OpenVPN server is running on the Linksys router (dd-wrt). This computer is in the router's LAN and I have the LAN network set as a "Local" network (because the openvpn server is on the router, there is no extra network adaptor associated with the openvpn server). Other computers on the router's LAN have no problem accessing this computer. Has anyone else had this problem before?

Thanks,

CS
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum