Successful setup of OpenVPN Server on DD-WRT v3.0

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


Joined: 28 Jan 2009
Posts: 23
Location: Sarasota, FL

PostPosted: Thu Mar 02, 2017 19:36    Post subject: Successful setup of OpenVPN Server on DD-WRT v3.0 Reply with quote
Wow...there's a lot of outdated info out there on OpenVPN + DD-WRT.

I spent a couple hours figuring this out, with a lot of help from this thread: https://www.dd-wrt.com/phpBB2/viewtopic.php?t=304754&sid=a9a46abfa46f81dacd0bb6515fbd6bc9

I also used this page as the tutorial for generating the certs: https://www.howtogeek.com/64433/how-to-install-and-configure-openvpn-on-your-dd-wrt-router/ and this tutorial for some additional reference as well: http://martyfoiegras.com/2016/09/05/dd-wrt-routed-openvpn-server-configuration-with-split-tunneling-support/

Anyway, figured I would share my specific config.

I'm using an ASUS RT-N66U
Firmware: DD-WRT v3.0-r31544 (02/28/17)

On my (Windows 10) PC, I'm using OpenVPN GUI v2.4.0 with the TAP Adapter v9.21.2.

For testing purposes, my router is default 192.168.1.1 and my computer is connected directly to it with an auto-assigned IP of 192.168.1.148.

After generating the keys (per the instructions referenced in the above link), and inputting the keys according to that link, I set the options in DD-WRT -> VPN as follows:
Quote:
OpenVPN: Enable
Start Type: WAN Up
Config as: Server
Server mode: Bridge (TAP)
DHCP-Proxy mode: Enable
Port: 1194
Tunnel Protocol: UDP
Encryption Cipher: AES-128 CBC
Hash Algorithm: SHA1
Advanced Options: Enable
TLS Cipher: None
LZO Compression: Adaptive
Redirect default gateway: Disable
Allow Client to Client: Enable
Allow duplicate cn: Disable
Tunnel MTU Setting: 1500
Tunnel UDP Fragment: (BLANK)
Tunnel UDP MSS-Fix: (BLANK)
CCD-Dir DEFAULT file: (BLANK)
Client connect script: (BLANK)
Static Key: (BLANK)
PKCS12 Key: (BLANK)
Public Server Cert: (server.crt)
CA Cert: (ca.crt)
Private Server Key: (server.key)
DH PEM: (dh1024.pem)
Additional Config: (BLANK)
TLS Auth Key: (BLANK)
Certificate Revoke List: (BLANK)


I used this config on the client (Windows PC) side:
Code:
client
dev tap
proto udp
remote 192.168.1.1 1194
nobind
persist-key
persist-tun
verb 4
float
ca ca.crt
cert theorie-gs60.crt
key theorie-gs60.key
comp-lzo yes
tun-mtu 1500
auth SHA1
cipher AES-128-CBC


Of course, being that I'm connected to the router directly as a DHCP client and a VPN client, I'm getting loopbacks, but I'm assuming that won't happen once I disconnect from the router and connect remotely.

Hope this helps others out there!
Sponsor
theorie
DD-WRT Novice


Joined: 28 Jan 2009
Posts: 23
Location: Sarasota, FL

PostPosted: Thu Mar 09, 2017 17:28    Post subject: Reply with quote
Just wanted to say I tested this remotely (changed the remote IP for the client config) and it works flawlessly.

Glad to finally have a functioning VPN without using a 3rd party VPN server!
Zippy1970
DD-WRT Novice


Joined: 02 Sep 2012
Posts: 19

PostPosted: Mon Sep 11, 2017 19:28    Post subject: Reply with quote
I van confirm it works on my end too. But with a few oddities.

First of all, on the dd-wrt side it all seems to work perfectly. On the client side (my laptop) however, a few strange things happen. My laptop is connected through WiFi but the VPN connection is made through the Ethernet adapter.

When not connected through VPN, ipconfig shows this:

Code:
Ethernet adapter Ethernet:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : home
   IPv6 Address. . . . . . . . . . . : 2001:1c04:1b00:5d00:a180:fb3d:bf8:9764
   Temporary IPv6 Address. . . . . . : 2001:1c04:1b00:5d00:a5fb:f26a:52af:dcb0
   Link-local IPv6 Address . . . . . : fe80::a180:fb3d:bf8:9764%14
   IPv4 Address. . . . . . . . . . . : 192.168.178.234
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : fe80::ae22:5ff:fe78:efe4%14
                                       192.168.178.1


When connected through VPN, ipconfig shows this:

Code:
Ethernet adapter Ethernet:

   Connection-specific DNS Suffix  . : arnhem.chello.nl
   Link-local IPv6 Address . . . . . : fe80::bce6:ab4:6d06:98e3%16
   IPv4 Address. . . . . . . . . . . : 192.168.1.141
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . : home
   IPv6 Address. . . . . . . . . . . : 2001:1c04:1b00:5d00:a180:fb3d:bf8:9764
   Temporary IPv6 Address. . . . . . : 2001:1c04:1b00:5d00:a5fb:f26a:52af:dcb0
   Link-local IPv6 Address . . . . . : fe80::a180:fb3d:bf8:9764%14
   IPv4 Address. . . . . . . . . . . : 192.168.178.234
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : fe80::ae22:5ff:fe78:efe4%14
                                       192.168.178.1


So the VPN connection is made through the Ethernet adapter and not through the wireless adapter. This means that I *am* able to see the shared resources on my network (at home), but browsing the internet is still done with my local IP address.

So what do I need to change to correct this?
tdiguy
DD-WRT User


Joined: 20 Apr 2010
Posts: 203

PostPosted: Mon Sep 11, 2017 19:47    Post subject: Reply with quote
I would think the option redirect default gateway would work on server side. There should also be a client side option to send all traffic over the vpn.
dmsmitty76
DD-WRT Novice


Joined: 26 Aug 2006
Posts: 42

PostPosted: Mon Dec 11, 2017 0:25    Post subject: vpn assist Reply with quote
I am also using an RTN66U. and recently switched from Tomato to DD-WRT. Tomato I used a static key, which I can't seem to make work with DD-WRT. I have my logs an error about unable to Cannot load certificate file /tmp/openvpn/cert.pem. Most documentation seems to be out of date or not very helpful. Any thoughts you might have?

ec 11 00:22:11 RTN66U user.info : openvpn : OpenVPN daemon (Server) starting/restarting...
Dec 11 00:22:11 RTN66U daemon.notice openvpn[16275]: OpenVPN 2.4.4 mipsel-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] built on Dec 4 2017
Dec 11 00:22:11 RTN66U daemon.notice openvpn[16275]: library versions: OpenSSL 1.1.0g 2 Nov 2017, LZO 2.09
Dec 11 00:22:11 RTN66U daemon.notice openvpn[16277]: MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:14
Dec 11 00:22:11 RTN66U daemon.warn openvpn[16277]: NOTE: when bridging your LAN adapter with the TAP adapter, note that the new bridge adapter will often take on its own IP address that is different from what the LAN adapter was previously set to
Dec 11 00:22:11 RTN66U daemon.warn openvpn[16277]: NOTE: the current --script-security setting may allow this configuration to call user-defined scripts
Dec 11 00:22:11 RTN66U daemon.notice openvpn[16277]: Diffie-Hellman initialized with 2048 bit key
Dec 11 00:22:11 RTN66U daemon.err openvpn[16277]: OpenSSL: error:140AB18E:lib(20):func(171):reason(398)
Dec 11 00:22:11 RTN66U daemon.err openvpn[16277]: Cannot load certificate file /tmp/openvpn/cert.pem
Dec 11 00:22:11 RTN66U daemon.notice openvpn[16277]: Exiting due to fatal error
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Mon Dec 11, 2017 10:33    Post subject: Reply with quote
Maybe it is because DDWRT uses the latest SSL, you have to regenerate your certificates with the latest OpenVPN/Easy-RSA.

Sometimes this can be mitigated by adding to the additional config:
Code:
tls-cipher "DEFAULT:@SECLEVEL=0"

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
dmsmitty76
DD-WRT Novice


Joined: 26 Aug 2006
Posts: 42

PostPosted: Mon Dec 11, 2017 10:46    Post subject: Reply with quote
egc wrote:
Maybe it is because DDWRT uses the latest SSL, you have to regenerate your certificates with the latest OpenVPN/Easy-RSA.

Sometimes this can be mitigated by adding to the additional config:
Code:
tls-cipher "DEFAULT:@SECLEVEL=0"


Thank you that seemed to resolve the error, however I am puzzled and must be missing something. I downloaded the latest version of OpenVPN from their website a week or so ago. Is there any updated package somewhere that I still need to download?
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12877
Location: Netherlands

PostPosted: Mon Dec 11, 2017 11:49    Post subject: Reply with quote
I think you must ues easy RSA V3
_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
raddirad
DD-WRT Novice


Joined: 18 Jan 2018
Posts: 8

PostPosted: Mon Jan 22, 2018 7:39    Post subject: Reply with quote
thank you for your post
now i finally can use my home vpn

cheers
raddirad
dmsmitty76
DD-WRT Novice


Joined: 26 Aug 2006
Posts: 42

PostPosted: Mon Feb 19, 2018 18:28    Post subject: Reply with quote
egc wrote:
I think you must ues easy RSA V3


Is there a guide for Windows and EASY RSA 3.0? I can't seem to find one that works with the EASY-RSA Shell.
dmsmitty76
DD-WRT Novice


Joined: 26 Aug 2006
Posts: 42

PostPosted: Mon Feb 19, 2018 20:46    Post subject: Reply with quote
eibgrad wrote:
dmsmitty76 wrote:
egc wrote:
I think you must ues easy RSA V3


Is there a guide for Windows and EASY RSA 3.0? I can't seem to find one that works with the EASY-RSA Shell.


FWIW, easyrsa v3 is also available from Entware, and thus can be run from the router itself (provided of course you're willing and able to install Entware). I just find it easier in some cases than dealing w/ Windows. And I have some scripts too that automate the process, which you could probably adapt for your own situation.


I was using https://community.openvpn.net/openvpn/wiki/EasyRSA3-OpenVPN-Howto, but I do not get the .crt files as mentioned in other articles. So I am using older links found here https://advancedhomeserver.com/dd-wrt-and-openvpn-part-1/ and https://www.howtogeek.com/64433/how-to-install-and-configure-openvpn-on-your-dd-wrt-router/ with the command tls-cipher "DEFAULT:@SECLEVEL=0". Once I have more experience with DD-WRT I'll try more advance features. I had become frustrated with DD-WRT and guest networks so I gave up and went back to tomato until I had time to research my issues and try again. Now I am trying again.. Scripts would be good, but I do not know enough about them yet to accurately run them.
dmsmitty76
DD-WRT Novice


Joined: 26 Aug 2006
Posts: 42

PostPosted: Mon Feb 19, 2018 23:13    Post subject: Reply with quote
eibgrad wrote:
You don't *have* to use PKI (which requires easyrsa) for your own OpenVPN server. You could use a static key, or static key + username/password instead. Not as good as PKI, and has some limitations, but it's enough to get it working and useful in the short term. And the static key can be generated from the openvpn executable itself, no easyrsa installation required.

Code:
openvpn --genkey --secret static.key


Tomato I had setup using a static, I have everything working with the CAs now using the sites I listed prior.

Additional Config:
push "dhcp-option DNS 192.168.10.1"
tls-cipher "DEFAULT:@SECLEVEL=0"

Client .opvn file #1
- all traffic overVPN, except for certain sites
-----------------------------
client
remote .us 1194
dev tap1
cipher AES-256-CBC
proto udp
comp-lzo
cipher AES-256-CBC
auth SHA512
tls-cipher TLS-RSA-WITH-AES-256-CBC-SHA256
route-gateway 192.168.10.1
redirect-gateway def1
#Route perticular website to network interface instead of VPN interface
#Host Name :
route 0.0.0.0 255.255.255.255 net_gateway
route 0.0.0.0 255.255.255.255 net_gateway
route 0.0.0.0 255.255.255.255 net_gateway
route-method exe
route-delay 2
ca .crt
cert .crt
key .key
nobind

Client .opvn file #2
- LAN traffic overVPN, Web over Public
-----------------------------
client
remote .us 1194
dev tap1
cipher AES-256-CBC
proto udp
comp-lzo
cipher AES-256-CBC
auth SHA512
tls-cipher TLS-RSA-WITH-AES-256-CBC-SHA256
#Route perticular website to network interface instead of VPN interface
route 0.0.0.0 255.255.255.255 net_gateway
route 0.0.0.0 255.255.255.255 net_gateway
route 0.0.0.0 255.255.255.255 net_gateway
route-method exe
route-delay 2
ca .crt
cert .crt
key .key
nobind


It seems to work with tracert the way I would expect.

Client .opvn file #1
tracert sends 8.8.8.8 over 192.168.10.1

Client .opvn file #2
tracert sends 8.8.8.8 over 192.168.1.1 (the jetpack ip)

I do get a couple of errors in the logs that I have yet to google and I suspect I might not be negotiating the right TLS Cipher. I am not worth millions or that super paranoid, as long as its good enough for most public wifi.

Client Log

Enter Management Password:
Mon Feb 19 17:52:28 2018 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.

Mon Feb 19 17:52:29 2018 TCP/UDP: Preserving recently used remote address: [AF_INET].88:1194
Mon Feb 19 17:52:29 2018 UDP link local: (not bound)
Mon Feb 19 17:52:29 2018 UDP link remote: [AF_INET].88:1194
Mon Feb 19 17:52:30 2018 [DDWRTRTN66U] Peer Connection Initiated with [AF_INET].88:1194
Mon Feb 19 17:52:31 2018 open_tun
Mon Feb 19 17:52:31 2018 TAP-WIN32 device [TAP1] opened: \\.\Global\}.tap
Mon Feb 19 17:52:31 2018 Notified TAP-Windows driver to set a DHCP IP/netmask of 192.168.10.180/255.255.255.0 on interface {F} [DHCP-serv: 192.168.10.0, lease-time: 31536000]
Mon Feb 19 17:52:31 2018 Successful ARP Flush on interface [15] {EA437733-AAD7-487B-8B5E-3AE3EDFCD7CF}
Mon Feb 19 17:52:31 2018 do_ifconfig, tt->did_ifconfig_ipv6_setup=0
Mon Feb 19 17:52:33 2018 Initialization Sequence Completed
Mon Feb 19 17:53:04 2018 SIGTERM[hard,] received, process exiting

Router Log:
20180219 17:41:30 TCL3QRR3Q1/174.232.2.207:9231 SENT CONTROL []: 'PUSH_REPLY redirect-gateway def1 dhcp-option DNS 192.168.10.1 route-gateway 192.168.10.1 ping 10 ping-restart 120 ifconfig 192.168.10.180 255.255.255.0 peer-id 0 cipher AES-256-GCM' (status=1)
20180219 17:41:30 .207:9231 Data Channel: using negotiated cipher 'AES-256-GCM'
20180219 17:41:30 .207:9231 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
20180219 17:41:30 .207:9231 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key
20180219 17:41:30 207:9231 MULTI: Learn: -> .207:9231
dmsmitty76
DD-WRT Novice


Joined: 26 Aug 2006
Posts: 42

PostPosted: Tue Feb 20, 2018 0:42    Post subject: Reply with quote
eibgrad wrote:
Code:
Mon Feb 19 17:52:28 2018 WARNING: No server certificate verification method has been enabled. See http://openvpn.net/howto.html#mitm for more info.


I wouldn't be overly concerned about that message. Think of OpenVPN as the "nanny VPN". It likes to tell you about evvvvery possible thing that could and might go wrong. In this case, you can use one of several methods to insure the server's cert is who it claims to be.

To keep it hushed, add the following directive to the OpenVPN client.

Code:
remote-cert-tls server


The following would work just as well, but is scheduled for deprecation.

Code:
ns-cert-type server


Yeah I was reading that here: https://openvpn.net/index.php/open-source/documentation/howto.html#mitm

I had a chance to google it earlier! Thank you for all assistance and reviewing.. Off to figure out my other kinks, I am getting there!
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