DD-WRT (OpenVPN at Startup)
Note: OpenVPN only works on Big, Mega and some Std versions of the DD-WRT router firmware. Mini or Micro versions do not work with OpenVPN!
Step 1: Log in to your DD-WRT Web Control Panel
Open your DD-WRT Web Control panel by visiting the IP address of your router (default IP is usually 192.168.1.1) in your browser. Click "Administration" tab.
Enter your username and password (Default usernames and passwords are usually admin/admin, root/admin or root/root)
Now click "Commands" sub-tab.
Step 2: Enter commands
Paste the code below in the Command text input, replace the username and password variables, press 'Save Startup' and then reboot your router.
#!/bin/sh USERNAME="My_VPNht_Username" # Your VPN.ht VPN passowrd PASSWORD="My_VPNht_Password" # Your VPN.ht VPN passowrd # udp # Add - delete - edit servers between ##BEGIN## and ##END## REMOTE_SERVERS=" ##BEGIN## remote hub.vpn.ht 1194 remote hub.vpn.ht 1195 remote hub.vpn.ht 1196 remote hub.vpn.ht 1197 remote hub.vpn.ht 1198 remote hub.vpn.ht 1199 remote hub.vpn.ht 1200 remote hub.vpn.ht 1201 ##END## " #### DO NOT CHANGE below this line #### CA_CRT='-----BEGIN CERTIFICATE----- MIIEmzCCA4OgAwIBAgIJAIsPF0BTVr9FMA0GCSqGSIb3DQEBCwUAMIGPMQswCQYD VQQGEwJVUzELMAkGA1UECBMCREUxEzARBgNVBAcTCldpbG1pbmd0b24xDjAMBgNV BAoTBVZwbkhUMQ4wDAYDVQQLEwVWUE5IVDEPMA0GA1UEAxMGdnBuLmh0MQ4wDAYD VQQpEwVWUE5IVDEdMBsGCSqGSIb3DQEJARYOc3VwcG9ydEB2cG4uaHQwHhcNMTQx MTI4MTM1NDE5WhcNMjQxMTI1MTM1NDE5WjCBjzELMAkGA1UEBhMCVVMxCzAJBgNV BAgTAkRFMRMwEQYDVQQHEwpXaWxtaW5ndG9uMQ4wDAYDVQQKEwVWcG5IVDEOMAwG A1UECxMFVlBOSFQxDzANBgNVBAMTBnZwbi5odDEOMAwGA1UEKRMFVlBOSFQxHTAb BgkqhkiG9w0BCQEWDnN1cHBvcnRAdnBuLmh0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Z97ULagirc82d4BfDVp1GtUJlJMLJVMAmaoNn3Sw== -----END CERTIFICATE-----' CLIENT_KEY='-----BEGIN OpenVPN Static key V1----- 74fa428696037279b617bb92efc1d2df edf3e030b0e24b848e1389490411e2b6 ebbc521669285d17b9aeea190066502a c3ad09b0b272a81ed737760451fe6071 a2003356a5f8e0f8f4555290f539bcfb 371282cec7f6de53ffce1665f304f774 6d4aaad012afa02a4faa9d4db325e104 e1c957b056e1d6130daf4210531488e0 978ba4ddaac3986e31c23f6589d21f62 e36354931f0723771376c117b6ef3a17 260e1f582475b8e1438147a82d716b37 f8d451f0191586040950721bc5657657 ecd7574731c06d390af2977c2eb15176 b604121698394edf94e1ea091f008b83 ad7921e7beba7b175956b9261d0cd686 692b07de56806b72e46e5a7a69f9bb9a -----END OpenVPN Static key V1-----' OVPNEN=`nvram get openvpncl_enable | awk '$1 == "0" {print $1}'` if [ "$OVPNEN" != 0 ] then nvram set openvpncl_enable=0 nvram commit fi sleep 30 mkdir /tmp/vpnht; cd /tmp/vpnht echo -e "$USERNAME\n$PASSWORD" > userpass.conf echo "$CA_CRT" > ca.crt; echo "$CLIENT_KEY" > client.key echo "#!/bin/sh" > route-up.sh; echo -e "#!/bin/sh\nsleep 2" > route-down.sh echo "#!/bin/sh iptables -I FORWARD -i br0 -o tun0 -j ACCEPT iptables -I FORWARD -i tun0 -o br0 -j ACCEPT iptables -I INPUT -i tun0 -j REJECT iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE" > /tmp/.rc_firewall chmod 644 ca.crt; chmod 600 client.key userpass.conf; chmod 700 route-up.sh route-down.sh chmod 700 /tmp/.rc_firewall sleep 30 echo " client resolv-retry infinite nobind persist-key persist-tun script-security 2 dev tun proto udp cipher aes-128-cbc auth sha1 auth-user-pass userpass.conf comp-lzo adaptive tun-mtu 1500 mtu-disc yes fast-io tun-ipv6 tls-auth client.key 1 ca ca.crt log vpnht.log daemon remote-random $REMOTE_SERVERS" > openvpn.conf ln -s /tmp/vpnht/vpnht.log /tmp/vpnht.log (killall openvpn; openvpn --config /tmp/vpnht/openvpn.conf --route-up /tmp/vpnht/route-up.sh --down-pre /tmp/vpnht/route-down.sh) & exit 0