/sc_assets/441/logo.png

DD-WRT OpenVPN

Last updated by Shayne M on November 23, 2016 06:15

For pre-configured VPNSecure DD-WRT or Tomato based routers please purchase a router from Flashrouters.com

We recommend using the GUI if you have later versions of DD-WRT installed. Please visit dd-wrt-gui-openvpn-client for instructions.

If you contact our support staff by live chat or email we can create the required scripts for you and assist with connecting your DDWRT router to the VPN network :)

What you will need todo is make sure that the NTP server is set up right down the bottom of the main "setup > Basic setup" page. This makes sure the time on the DD-WRT router is set correctly, otherwise the VPN wont connect.

Please also turn of DNSMASQE

Goto, Administration then commands.

Paste the contents between HERE and THERE into the command box and select "Save Startup" 

HERE 

#!/bin/sh
sleep 20 
cd /tmp 
./custom.sh 


THERE

After the startup script is saved, paste the contents between HERE and THERE into the command box and select "Save Custom Script"

NOTE: you will have to remove the password or have support remove your password from your key files in order for this to successfully work.

If you have OpenSSL installed you can use the following command

openssl rsa -in username.key -out username.keyout

The username.keyout now becomes the text you need to replace below in the username.key section

You will need to also open your username.crt file in notepad or nano and replace the "echo" lines below with your username.

Any other custom changes such as what OpenVPN server you wish to connect to, edit the following line

echo remote server.vpnsecure.me 1191 >> username.ovpn

You can get a list of servers from support, or view the .ovpn files from the config generation in the Members area.

HERE 

#!/bin/sh
ntpd
mkdir /tmp/vpns
cd /tmp/vpns

echo -----BEGIN CERTIFICATE----- > ca.crt
echo MIIEJDCCAwygAwIBAgIJAMkzh6p4m6XfMA0GCSqGSIb3DQEBBQUAMGkxCzAJBgNV >> ca.crt
echo BAYTAlVTMQswCQYDVQQIEwJOWTERMA8GA1UEBxMITmV3IFlvcmsxFTATBgNVBAoT >> ca.crt
echo DHZwbnNlY3VyZS5tZTEjMCEGCSqGSIb3DQEJARYUc3VwcG9ydEB2cG5zZWN1cmUu >> ca.crt
echo bWUwHhcNMTAwNDIzMDE1ODI0WhcNMjAwNDIwMDE1ODI0WjBpMQswCQYDVQQGEwJV >> ca.crt
echo UzELMAkGA1UECBMCTlkxETAPBgNVBAcTCE5ldyBZb3JrMRUwEwYDVQQKEwx2cG5z >> ca.crt
echo ZWN1cmUubWUxIzAhBgkqhkiG9w0BCQEWFHN1cHBvcnRAdnBuc2VjdXJlLm1lMIIB >> ca.crt
echo IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4gpU9cHGeqKL2I0sVCSEKZaw >> ca.crt
echo UkESgeOLspgvHr6Icyu6uu8dDRNrC8+WZ/WYgu0Z10ArRKiXx6o7qo2h+TIIY4VA >> ca.crt
echo 50W2Uv/BJcXRip/RT77PW/mk1Rkn60JuSiqFYoMAMnt4pTYlgMsujA5QXqCpbkOM >> ca.crt
echo Vu0holWUcS3CWywJo5nwowUu3lBm7QPK4k5CHoBaOFhYsvRu+s0FsNVdupA4cs3C >> ca.crt
echo TU+MTu1EjD1HmbYctd4Ps4vfq3CC4RAJ5e++rCIpesPFFSvMXrxSgZTj5PmMl5aO >> ca.crt
echo HmYrqaat9NKIGkvn1/9Jnw+wwxPhpOf5wngAgzYgZX0N6Jfw3vAputB1hFLWVQID >> ca.crt
echo AQABo4HOMIHLMB0GA1UdDgQWBBQScn+JqRk93SLuuf9cwBagoBsWaDCBmwYDVR0j >> ca.crt
echo BIGTMIGQgBQScn+JqRk93SLuuf9cwBagoBsWaKFtpGswaTELMAkGA1UEBhMCVVMx >> ca.crt
echo CzAJBgNVBAgTAk5ZMREwDwYDVQQHEwhOZXcgWW9yazEVMBMGA1UEChMMdnBuc2Vj >> ca.crt
echo dXJlLm1lMSMwIQYJKoZIhvcNAQkBFhRzdXBwb3J0QHZwbnNlY3VyZS5tZYIJAMkz >> ca.crt
echo h6p4m6XfMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAGMmeGWtkE58 >> ca.crt
echo Us5kQ4s7FWaaIYrOWOm7HK11te1y06pNBcwl1ho6C5M3jaIJBDYu8jWUlXCRj83D >> ca.crt
echo T8lHMKSJSzOyDL6O0P3wiSMzC2cpqL+d3Utfjm0bFLwtSCJ6mQv4hnyTQzxVXUGe >> ca.crt
echo nq/waWEbbvL0G9Mp3zJ4lNTOT566CxHieisO1isBvTFgJhY+YCGPBIr5CoLaA+bw >> ca.crt
echo TbVyiRcjBqjUO21oRp0DCNNPiFYUNBNOPVWo/LPcZCFLLVTuUyyg0oizm4Sfk+eh >> ca.crt
echo xu8bf3QJ6T6MLQTKVp0LQM464d7bAEv3C/IcNgq5VzOuf2n/pnc20HOo83o4w827 >> ca.crt
echo Mo8qUuTtwKE= >> ca.crt
echo -----END CERTIFICATE----- >> ca.crt

echo -----BEGIN DH PARAMETERS----- > dh2048.pem
echo MIIBCAKCAQEA2nIBfOf2HCXLv7+mhRxldAcCSTS53F856erWjbqt2E9Q9+7kikDJ >> dh2048.pem
echo w4J/AbT5oSu4BqPHfxYZjO/t7W2ihHsH68utBehpaPNRG864NzsbPb8yA5BOb9uJ >> dh2048.pem
echo K2gxJ0558bhIHOvxQ3/ypqOxQlnMt/rvdzdU3BBFE1TQ4N15aB2CxVJRQUjR/ANi >> dh2048.pem
echo nv6H4htlRcapei/aaOe99xWeEqmN8E3OwlPDdHE+uqJOU9/erQ3gZKeHRS/RUvN4 >> dh2048.pem
echo H/s1o941TMbGbAPog+9wf5coA6P1o7uuHto3/phGHYSN8Na01eWOoNHPhwhgZqoB >> dh2048.pem
echo WmhQNX3NlRgENcpwGUS308gwrtT/BDKyuwIBAg== >> dh2048.pem
echo -----END DH PARAMETERS----- >> dh2048.pem

echo -----BEGIN CERTIFICATE----- > username.crt
echo MIIC9TCCAd2gAwIBAgICAiowDQYJKoZIhvcNAQEEBQAwaTELMAkGA1UEBhMCVVMx >> username.crt
echo MDEwMTIxNjIxMzUwMloYDzIwMjAwMAzskdksSaAyWjBSMQswCQYDVQQGEwJVUzEP >> username.crt
echo MA0GA1UECxMGT2ZmaWNlMQSDkwo02QQDEwVub3liYjEVMBMGA1UEChMMdnBuc2Vj >> username.crt
echo dXJlLm1lMQswCQYDVQasdEJOWTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA >> username.crt
echo 4cw3r0qSOtWKsvR73RD83uZCmru0vW06I5nBKJmqM2VbHc+nIwSuJ25AsR68j/C4 >> username.crt
echo uiTzkKf4hFZlEDDg426dp8pem6Q7gYxzVb2C+RuWI7quo6z4kZmBm98nnRyQ7QB5 >> username.crt
echo CzAJBgNVBAgTAk5ZMREwDwYDVQQHEwhOZXcgWW9yazEVMBMGA1UEChMMdnBuc2Vj >> username.crt
echo NC44LjEwDQYJKoZIhvcNAQEEBQADggEBAJWo2bRjHZqt3LsLmdKZJymqfJUlDU9v >> username.crt
echo fbeRk/wo14Y20G8a2F+WNUdaH9ZP/ZJtZEUkLAeBfH/BYYQBRpaOmFcyTBU2is3q >> username.crt
echo dXJlLm1lMSMwIQYJKoZIhvcNAQkBFhRzdXBwb3J0QHZwbnNlY3VyZS5tZTAiGA8y >> username.crt
echo 2UR4OwT6YgOLfZUXN8uv0K+h74obVTs6lyAYXAkeT7rCdI6Fpdd/Fl/ZQJwyAYbL >> username.crt
echo C6Xuc3nI3F3IpMSNCRQByYyCZr8WZ2pDpIEW68veehuGE+T4EdPsiRuIVELYUxRZ >> username.crt
echo 0hbBwzxFtgNbQq18Li3UgG7pSB5hG+AFOhDJNuG6K4kCAwEAAaM+MDwwDAYDVR0T >> username.crt
echo AQH/BAIwADAsBglghkgBhvhCAQ0EHxYdQ3JlYXRlZCB3aXRoIHN0b25ldnBuIDAu >> username.crt
echo lCJ9AF/0CFrqiBTSHfhNsHLa4t2pj+e1JrtrbalTZCzplyP141O3baTT/j2ufywK >> username.crt
echo FSglGMYZTIT0Mg2aDSzNbfTJhpoUC3qiWJJ+m8tiiDVN76zlFlbTmcE= >> username.crt
 echo -----END CERTIFICATE----- >> username.crt

echo -----START RSA PRIVATE KEY----- >> username.key
echo y00TV1nN6huhsW31A3DXikEolJUF701htp8CQCMzQwMOCq2Uc0e50TgUerWZym13 >> username.key
echo CUzQ99NEgKyWNDbkRZ4/y+1CSZzPn4Jlxr2oyM0rA5/wdFPQD0Hgs8LKRKkCQQCw >> username.key
echo MIICXQIBAAKBgQDZRHg7BPpiA4t9lRc3y6/Qr6HvihtVOzqXIBhcCR5PusJ0joWl >> username.key
echo 138WX9lAnDIBhssLpe5zecjcXcikxI0JFAHJjIJmvxZnakOkgRbry956G4YT5PgR >> username.key
echo Oy3tpCKcOGmKLTkBhKABLnRI63SJpUo8wgTdDph3v+tHnRtuIHOczT4t+eicdi3s >> username.key
echo DDTS4SumZsAsivZqEYd1PYSpRT/oc7s2dYIhSYK1yAC+hXxpAkEA+mzi8MzqM8aq >> username.key
echo 0+yJG4hUQthTFFnSFsHDPEW2A1tCrXwuLdSAbulIHmEb4AU6EMk24boriQIDAQAB >> username.key
echo AoGBAKLLrRL8Deh3I4P7vKPwGVLS5xGneAeLE8G9KMN9iZrQI3hWeknjiLRpKU5C >> username.key
echo aYVOa4nN0FOXtjsaOsFS7nIotu/ndtfGRGb+eR00G9L9RvSVDIw9hn9pIK7cb7nV >> username.key
echo JXWm8n601wJBAN4an9pGr7Z8XT7dLhuhB9zS3Z8UEyjQLOpfzKzgJc4AVrTd1hA+ >> username.key
echo zosQTRMV9zyXjaVl0zQaIzbPq0BxTf9jeG3L9QfDTNu5UZtWBVb7/XidAeHqqzY+ >> username.key
echo rTxW+Q6TPkXBuB6/ABlLAkAqLkRlq3MadyU2eLKGqPRKbtaojCLvEOOkOhcPJ1Gp >> username.key
echo y00TV1nN6huhsW31A3DXikEolJUF701htp8CQCMzQwMOCq2Uc0e50TgUerWZym13 >> username.key
echo CUzQ99NEgKyWNDbkRZ4/y+1CSZzPn4Jlxr2oyM0rA5/wdFPQD0Hgs8LKRKkCQQCw >> username.key
echo HLYWPn7Jr7yjpm3wIc2wtytrupnjgnqxQt+1KxEUMrYm >> username.key
echo -----END RSA PRIVATE KEY----- >> username.key

echo client > username.ovpn
echo proto udp >> username.ovpn
echo dev tun >> username.ovpn
echo ca /tmp/vpns/ca.crt >> username.ovpn
echo dh /tmp/vpns/dh2048.pem >> username.ovpn
echo cert /tmp/vpns/username.crt >> username.ovpn
echo key /tmp/vpns/username.key >> username.ovpn
echo remote server.vpnsecure.me 1191 >> username.ovpn
echo cipher DES-CBC >> username.ovpn
echo verb 5 >> username.ovpn
echo route-method exe >> username.ovpn
echo route-delay 2 >> username.ovpn
echo mute 20 >> username.ovpn
echo keepalive 10 120 >> username.ovpn
echo comp-lzo >> username.ovpn
echo persist-key >> username.ovpn
echo persist-tun >> username.ovpn
echo float >> username.ovpn
echo resolv-retry infinite >> username.ovpn
echo nobind >> username.ovpn
echo auth-nocache >> username.ovpn
echo ns-cert-type server >> username.ovpn
echo log /tmp/vpns/openvpn.log >> username.ovpn
echo log-append /tmp/vpns/openvpn.log >> username.ovpn
echo route-up /tmp/vpns/route-up.sh >> username.ovpn
echo down /tmp/vpns/route-down.sh >> username.ovpn

echo iptables -A POSTROUTING -t nat -o tun0 -j MASQUERADE >> route-up.sh
echo iptables -D POSTROUTING -t nat -o tun0 -j MASQUERADE >> route-down.sh


chmod a+x *.sh


/usr/sbin/openvpn --config username.ovpn --script-security 3 --daemon


sleep 20
echo nameserver 8.8.8.8 >> resolv.conf
mv resolv.conf /tmp/resolv.conf

ln -s /tmp/vpns/openvpn.log /tmp/www/vpnslog


THERE

VPNSecure Provides Secure VPN servers in over 45+ Countries

If you are a looking for a versatile easy to use VPN service, checkout Today