Setting up openVPN

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
unskilled
DD-WRT Novice


Joined: 19 Jul 2016
Posts: 3

PostPosted: Tue Jul 19, 2016 20:55    Post subject: Setting up openVPN Reply with quote
I have tried to understand this stuff for the past 2 weeks and everything I think i get somewhere, i go back to step 1.

I went into OpenVPN, enable server, start type is WAN up, and the default config is "Daemon" (not sure if thats what it needs to be?)

I entered in the CA, Public CA, Private Key, DH PEM.

under additional config, i have the following:

"push "route 192.168.20.0 255.255.255.0"
push "dhcp-option DNS 8.8.8.8"
server 10.8.0.1 255.255.255.0

dev tun0
proto udp
keepalive 10 120
dh /tmp/openvpn/dh.pem
ca /tmp/openvpn/ca.crt
cert /tmp/openvpn/cert.pem
key /tmp/openvpn/key.pem

# management parameter allows DD-WRT\s OpenVPN Status web page to access the server\s management port
# port must be 5001 for scripts embedded in firmware to work
management localhost 5001"



Is that correct? The "Push" Route 192.168.20.1 is my local IP Address. The dhcp-option, i just used googles 8.8.8.8 BUT i have no idea if thats correct or not? The Server 10.8.0.1 is just a made up number (i think i read thats what openvpn default it).

As for the hd, ca, cert, key...do i need to change any of those? When i had the server set up on my computer those were pointing to the folder on my computer. Now with this on the router, i am assuming that it is correct but i have no idea?

I didnt't change anything else on the router except for the firewall:

"#!/bin/sh
OVPN_SERVER="10.8.0.0/24"
OVPN_DEV="tun2"
OVPN_PROTO="udp"
OVPN_PORT="1194"

WAN_IF="$(ip route | awk '/^default/{print $NF}')"

# open the OpenVPN server port
iptables -I INPUT -i $WAN_IF -p $OVPN_PROTO --dport $OVPN_PORT -j ACCEPT

# allow OpenVPN clients to access the OpenVPN server
iptables -I INPUT -i $OVPN_DEV -m state --state NEW -j ACCEPT

# allow OpenVPN clients to access ALL other devices on the LAN
iptables -I FORWARD -i $OVPN_DEV -o -m state --state NEW -j ACCEPT

# nat OpenVPN clients over the local internet gateway
iptables -t nat -A POSTROUTING -s $OVPN_SERVER -o $WAN_IF -j MASQUERADE"


i didnt do anything with port forwarding, so i dont know if that needs to be done?

Anyways, when i look at the openvpn status, there is nothing under server, local address, remote address, etc.

What am i doing wrong? I appreciate your help!
Sponsor
blaser
DD-WRT Guru


Joined: 16 Jul 2006
Posts: 525

PostPosted: Wed Jul 20, 2016 3:03    Post subject: Reply with quote
I have all the certificates you mentioned + tls
my config is:
script-security 2
management 127.0.0.1 14
mode server
push "dhcp-option DNS 192.168.1.1"
daemon
persist-key
persist-tun
verb 3
ca /tmp/openvpn/ca.crt
dh /tmp/openvpn/dh.pem
cert /tmp/openvpn/cert.pem
key /tmp/openvpn/key.pem
tls-auth /tmp/openvpn/ta.key 0
port 1194
proto tcp-server
dev tap0
server-bridge 192.168.1.1 255.255.255.0 192.168.1.100 192.168.1.105
push "redirect-gateway def1"
cipher AES-128-CBC
comp-lzo
tls-server
keepalive 10 120
client-to-client

my startup configuration
openvpn --mktun --dev tap0
brctl addif br0 tap0
ifconfig tap0 0.0.0.0 promisc up

my firewall
iptables -t nat -I PREROUTING -p tcp --dport 1194 -d 192.168.1.1 -j ACCEPT
iptables -I INPUT -p tcp --dport 1194 -j ACCEPT
iptables -t nat -I PREROUTING -p tcp -d `nvram get wan_ipaddr` --dport 1194 -j ACCEPT

_________________
Netgear R9000 main router
RAX80 as AP
unskilled
DD-WRT Novice


Joined: 19 Jul 2016
Posts: 3

PostPosted: Wed Jul 20, 2016 12:01    Post subject: Reply with quote
Thanks for posting your config file. that is what i have been trying to do is copy people's config file in order to make mine work but still haven't had any luck. I would copy yours but it mentions bridging and i have mine set up as my main router. Do you know if this is correct?

push "route 192.168.20.0 255.255.255.0"
push "dhcp-option DNS 8.8.8.8"
server 10.8.0.1 255.255.255.0

When i had my stock firmware, there was a place to change the DNS, if need be. I cant find anywhere on the DD-WRT firmware where the DNS can be changed. The is the first time diving into DNS as well so i'm really not sure if that is correct or if it even matters?

My wireless is slower, dont know if its because of the DNS or could be something else...
unskilled
DD-WRT Novice


Joined: 19 Jul 2016
Posts: 3

PostPosted: Thu Jul 21, 2016 0:12    Post subject: Reply with quote
this website fixed the problem:

http://www.stj.me/2016/02/17/openvpn-ddwrt.html
smapdi
DD-WRT Novice


Joined: 11 Sep 2006
Posts: 36

PostPosted: Thu Jul 28, 2016 2:13    Post subject: Reply with quote
unskilled wrote:
this website fixed the problem:

http://www.stj.me/2016/02/17/openvpn-ddwrt.html


I'm pretty much stuck with getting OpenVPN working on my R7000. I followed the instructions on the linked site (substituting the 192.168.x.x networks for the 10.x.x.x ones) but can't seem to get this thing working quite right.

I can connect in using my Android phone but can't reach anything once the session is established. I'm pretty sure it's something with my iptables rules but can't quite figure out what.

This is what I have configured:

Code:
iptables -I INPUT 1 -p udp --dport 1194 -j ACCEPT
iptables -I INPUT 3 -i tun0 -j ACCEPT
iptables -I FORWARD 3 -i tun0 -o tun0 -j ACCEPT
iptables -I FORWARD 1 --source 192.168.111.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.111.0/24 -j MASQUERADE
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT


192.168.111.0/24 is the network that OpenVPN clients are supposed to use. My internal LAN uses 192.168.254.0/24.

Any thoughts?
smapdi
DD-WRT Novice


Joined: 11 Sep 2006
Posts: 36

PostPosted: Thu Jul 28, 2016 15:21    Post subject: Reply with quote
So I found my answer in this post:

https://forums.openvpn.net/viewtopic.php?t=12708


Basically I added this line to my OpenVPN config

Code:
push "dhcp-option DNS 8.8.8.8"


And changed the following two iptables rules:

Code:
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT


To say this:

Code:
iptables -I FORWARD -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -j ACCEPT
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking 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 cannot attach files in this forum
You cannot download files in this forum