0

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.

I followed the ReadWrite tutorial as well as the BBC tutorial.

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 8.8.8.8
push "dhcp-option DNS 8.8.8.8" # 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
# 128.0.0.0/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

An my 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>
1
0

Your problem seems to be in the following lines:

# 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"

Basically you configure 10.8.0.1 correctly and .2 incorrectly, so as far as I can see, only 10.8.0.1 is used correctly, and then all slots are full. Altering this should fix your issue.

7
  • I think I user stand. Would I add "push "route 10.8.0.2 255.255.255.255"" under "push "route 10.8.0.1 255.255.255.255""? – Ian Thompson Jul 27 '16 at 19:19
  • Yeah, I think adding that will fix it. – LPChip Jul 27 '16 at 19:22
  • It seems to have had no effect – Ian Thompson Jul 27 '16 at 19:33
  • Did you restart the OpenVPN services after configuring them? – LPChip Jul 27 '16 at 20:01
  • Yes of course. I was still able to connect one, just not two at a time. – Ian Thompson Jul 27 '16 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.