Page 1 of 1

2 dd-wrt routers openvpn client-server setup help?

Posted: Sun Oct 09, 2011 1:03 am
by xhopex90
I setup a DD-wrt wrt54gl openvpn server and windows 7 client. The connection between client & server works great. I know how to create PKI.

now, I need help to setup 2 routers for openvpn. 1 router for server and 1 router for client. I want the client to always use the server's internet IP address. so the client can not access the internet unless it's connected to the server.i don't want to use openvpn software to connect. I want the client router to auto connect to the server and use the server's internet IP address.
how can I setup this 2 routers?

Server setup dd-wrt.v24_vpn_generic sp2 13064:
WAN IP: 89.251.86.40
IP router: 192.168.1.192
Server config:

Code: Select all

cd /tmp
openvpn --mktun --dev tap0
brctl addif br0 tap0
ifconfig tap0 0.0.0.0 promisc up

echo "
# Tunnel options
mode server       # Set OpenVPN major mode
proto udp         # Setup the protocol (server)
port 1194         # TCP/UDP port number
dev tap0          # TUN/TAP virtual network device
keepalive 15 60   # Simplify the expression of --ping 
daemon            # Become a daemon after all initialization
verb 3            # Set output verbosity to n 
comp-lzo          # Use fast LZO compression 

# OpenVPN server mode options
client-to-client  # tells OpenVPN to internally route client-to-client traffic 
duplicate-cn      # Allow multiple clients with the same common name

# TLS Mode Options
tls-server        # Enable TLS and assume server role during TLS handshake 
ca ca.crt         # Certificate authority (CA) file
dh dh1024.pem     # File containing Diffie Hellman parameters 
cert server.crt   # Local peer's signed certificate
key server.key    # Local peer's private key 
" > openvpn.conf

echo "
-----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----
" > ca.crt
echo "
-----BEGIN RSA PRIVATE KEY-----

-----END RSA PRIVATE KEY-----
" > server.key
chmod 600 server.key
echo "
-----BEGIN CERTIFICATE-----

-----END CERTIFICATE-----
" > server.crt
echo "
-----BEGIN DH PARAMETERS-----

-----END DH PARAMETERS-----
" > dh1024.pem

sleep 5
ln -s /usr/sbin/openvpn /tmp/myvpn
/tmp/myvpn --config openvpn.conf

route add -net 192.168.1.0/24 dev br0
Client setup dd-wrt.v24_vpn_generic sp2 13064:
WAN IP: 89.251.55.20
IP router: 192.168.1.193
Client Config

Code: Select all

cd /tmp
ln -s /usr/sbin/openvpn /tmp/myvpn
./myvpn --mktun --dev tap0
brctl addif br0 tap0
ifconfig tap0 0.0.0.0 promisc up
sleep 5

echo "
client
daemon
dev tap0
proto udp
remote xxx.xxx.xxx.xxx 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca ca.crt
cert client.crt
key client.key
ns-cert-type server
comp-lzo
verb 3
" > /tmp/client.conf

echo "
-----BEGIN CERTIFICATE-----
INSERT YOUR ca.crt HERE
-----END CERTIFICATE-----
" > /tmp/ca.crt

echo "
-----BEGIN RSA PRIVATE KEY-----
INSERT YOUR client.key HERE
-----END RSA PRIVATE KEY-----
" > /tmp/client.key
chmod 600 /tmp/client.key

echo "
-----BEGIN CERTIFICATE-----
INSERT YOUR client.crt HERE
-----END CERTIFICATE-----
" > /tmp/client.crt

./myvpn --config client.conf

route add -net 192.168.1.0/24 dev br0
Thank you

I did look at this this website but can't get it to work.
OpenVPN - Site-to-Site Bridged VPN Between Two Routers:
http://www.dd-wrt.com/wiki/index.php/Op ... wo_Routers

Re: 2 dd-wrt routers openvpn client-server setup help?

Posted: Sun Oct 09, 2011 5:44 pm
by Mimiko
That link describes a bridged OpenVPN setup in a old style. In your case you don't need bridge. Setup a routed OpenVPN. Sample configuration files you can find here:
http://www.openvpn.net/index.php/open-s ... tml#server
http://www.openvpn.net/index.php/open-s ... tml#client
Also find tutorials on the net and on this forum.