I set up OpenVPN on my Raspberry Pi the other day. It was rough at the beginning, with me being absolutely clueless, but I managed.
I created client
.ovpn files for my iPhone, iPad, and MacBook. For some reason, only one device can be connected to the VPN at a time, on my local network. For instance, if my iPhone is connected, my Mac and iPad cannot connect, but if my Mac is connected, my iPhone and iPad can't connect. However, I tried connecting on a different network, and all three of my devices connected with no problem.
Just incase, my
server.conf file looks like this:
local 192.168.1.238 # SWAP THIS NUMBER WITH YOUR RASPBERRY PI IP ADDRESS dev tun proto tcp port 443 ca /etc/openvpn/easy-rsa/keys/ca.crt cert /etc/openvpn/easy-rsa/keys/RaspiVPN.crt # SWAP XX WITH YOUR SERVER NAME key /etc/openvpn/easy-rsa/keys/RaspiVPN.key # SWAP XX WITH YOUR SERVER NAME dh /etc/openvpn/easy-rsa/keys/dh1024.pem # IF YOU CHANGED YOUR ENCRYPTION TO 2048, CHANGE THAT HERE server 10.8.0.0 255.255.255.0 # server and remote endpoints ifconfig 10.8.0.1 10.8.0.2 # Add route to Client routing table for the OpenVPN Server push "route 10.8.0.1 255.255.255.255" # Add route to Client routing table for the OpenVPN Subnet push "route 10.8.0.0 255.255.255.0" # your local subnet push "route 192.168.1.238 255.255.255.0" # SWAP THE IP NUMBER WITH YOUR RASPBERRY PI IP ADDRESS # Set primary domain name server address to the SOHO Router # If your router does not do DNS, you can use Google DNS 22.214.171.124 push "dhcp-option DNS 126.96.36.199" # THIS SHOULD ALREADY MATCH YOUR OWN ROUTER ADDRESS AND SHOULD NOT NEED TO BE CHANGED # Override the Client default gateway by using 0.0.0.0/1 and # 188.8.131.52/1 rather than 0.0.0.0/0. This has the benefit of # overriding but not wiping out the original default gateway. push "redirect-gateway def1" client-to-client duplicate-cn keepalive 10 120 tls-auth /etc/openvpn/easy-rsa/keys/ta.key 0 cipher AES-128-CBC comp-lzo user nobody duplicate-cn group nogroup persist-key persist-tun status /var/log/openvpn-status.log 20 log /var/log/openvpn.log verb 1
client.ovpn: (Obviously they are different for each device but this is the "base.")
client dev tun proto tcp remote REMOVED 443 resolv-retry infinite nobind persist-key persist-tun mute-replay-warnings ns-cert-type server key-direction 1 cipher AES-128-CBC comp-lzo verb 1 mute 20 <ca> -----BEGIN CERTIFICATE----- REMOVED -----END CERTIFICATE----- </ca> <cert> -----BEGIN CERTIFICATE----- REMOVED -----END CERTIFICATE----- </cert> <key> -----BEGIN RSA PRIVATE KEY----- REMOVED -----END RSA PRIVATE KEY----- </key> <tls-auth> # # 2048 bit OpenVPN static key # -----BEGIN OpenVPN Static key V1----- REMOVED -----END OpenVPN Static key V1----- </tls-auth>