Saturday, August 20, 2016

dd-wrt openVPN setup

I have a linksys E2000 route loaded with dd-wrt firmware for a while. With all the cell phone hot spot, free WiFi, I decided to turn on the openVPN server so I can get some secured connection. Here are the steps. I will skip the ones you can find on the Web, just put the server and client config out here. That's the part took me a while to get to.

Server Config (in box of OpenVPN Config):

server 10.8.0.0 255.255.255.0
port 443
port-share 127.0.0.1 4545
dev tun
proto tcp
keepalive 10 120
dh /tmp/openvpn/dh.pem
ca /tmp/openvpn/ca.crt
cert /tmp/openvpn/cert.pem
key /tmp/openvpn/key.pem
cipher AES-128-CBC

management localhost 5001

Note I used port 443, not the default 1194. Windows blocks port 1194 so if you want to use this port, you need to change firewalls all that. this is easier. Unless you are running a web server which is also using this port. In that case, you need to change your openVPN to forward 443 port to your server. For detail, see this post. For reasons why use 10.8.0.0 subnet, see this post.

Client Config (running openvpn)

client
dev tun
proto tcp
remote 443
resolv-retry infinite
nobind
persist-key
persist-tun
float
ca ca.crt
cert client1.crt
key client1.key
ns-cert-type server
cipher AES-128-CBC
verb 4

Then add following firewall rule into the route (Adminstration->commnds->save firewall)

iptables -I INPUT 1 -p tcp --dport 443 -j ACCEPT


Setup openVPN on a android phone;

Download openVPN App
copy client config file and all the certificates and key file listed in the config file into a directory. Then in openVPN app, import from SD card and import the client config file. You are ready to connect.,

Hope it helps.

No comments: