0

i am new to computer networking so i thought i could get some practice on my home network.

i have 2 raspberry pi's in my lan network, and i am using the free tier EC2 instance from AWS.

RPi-1 is connected to the internet through my router. RPi-1 has PiVPN installed using the suggestion on the official website: curl -L https://install.pivpn.io | bash.

after generating the keys and uploading to the EC2 instance, i am able to successfully connect the EC2 instance to the vpn. when i run pivpn clients on RPi-1, the EC2 instance is listed as expected.

the problem:

i then tried the same procedure to connect RP-2, but it doesn't seem to connect. i have tried re generating the keys, but it still doesn't work.

i am able to ping RPi-1 from RPi-2 (and vice-versa), and the nodes are able to ping each other without any issue.

i'm very new to computer networks and i don't know how to debug this kind of problem. any help is appreciated.

update 1:

i am connecting to the vpn using the command: sudo openvpn --config <config_file.ovpn>. this works for the EC2 instance, but on RPi-2, i get the output:

➜ sudo openvpn --config pi-node00.ovpn 
Thu May 31 06:09:28 2018 OpenVPN 2.4.0 arm-unknown-linux-gnueabihf [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Jul 18 2017
Thu May 31 06:09:28 2018 library versions: OpenSSL 1.0.2l  25 May 2017, LZO 2.08
Enter Private Key Password: ***************************
Thu May 31 06:09:36 2018 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this
Thu May 31 06:09:36 2018 Outgoing Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
Thu May 31 06:09:36 2018 Incoming Control Channel Authentication: Using 256 bit message hash 'SHA256' for HMAC authentication
Thu May 31 06:09:36 2018 TCP/UDP: Preserving recently used remote address: [AF_INET]<RPi-1 ip address>:1194
Thu May 31 06:09:36 2018 Socket Buffers: R=[163840->163840] S=[163840->163840]
Thu May 31 06:09:36 2018 UDP link local: (not bound)
Thu May 31 06:09:36 2018 UDP link remote: [AF_INET]<RPi-1 ip address>:1194

update 2:

contents of rpi-2.ovpn file (modified for privacy):

client
dev tun
proto udp
remote <RPi-1 public ip address> 1194
resolv-retry infinite
nobind
persist-key
persist-tun
key-direction 1
remote-cert-tls server
tls-version-min 1.2
verify-x509-name server_xxxxxxxx name
cipher AES-256-CBC
auth SHA256
comp-lzo
verb 3
<ca>
-----BEGIN CERTIFICATE-----
<some long hash>
-----END CERTIFICATE-----
</ca>
<cert>
-----BEGIN CERTIFICATE-----
<some long hash>
-----END CERTIFICATE-----
</cert>
<key>
-----BEGIN RSA PRIVATE KEY-----
<some encryption metadata>
<some long hash>
-----END RSA PRIVATE KEY-----
</key>
<tls-auth>
#
# 2048 bit OpenVPN static key
#
-----BEGIN OpenVPN Static key V1-----
<some long hash>
-----END OpenVPN Static key V1-----
</tls-auth>
  • I don't know that piece of software so can't comment on it, however, one piece of software that I have already used and tested and had fun with a raspberry (and which is supported in a lot of OSs including Linux, Android and Windows) is openvpn. I'd advice to give it a test run. – eftshift0 May 30 '18 at 22:19
  • PiVPN is a automated setup of openvpn. on the EC2 instance i connect to the vpn with the command: sudo openvpn --config aws.ovpn. the command i run on RPi-2 is: sudo openvpn --config rpi-2.ovpn. (openvpn was installed on RPi-2 with sudo apt-get install openvpn). – X0r0N May 30 '18 at 22:25
  • If it's openvpn then I guess the output of openvpn on the rpi2 is relevant to be able to know what's going on.... At least the last part where we could see some errors. Make sure to replace public IP addresses with xxx.xxx.xxx.xxx. or something like that if necessary – eftshift0 May 30 '18 at 22:34
  • By the way, what do you mean when you say that you can ping each other node? That they can ping themselves using their non-on-vpn addresses? Because if they can ping each other using their on-vpn addresses, then the connection is successful. – eftshift0 May 30 '18 at 22:39
  • what output would you like to see? i have run sudo openvpn on rpi2 and the output is the cli documentation. i assume this is not important. the same command output is exactly the same on rpi1. – X0r0N May 30 '18 at 22:47

Your Answer

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

Browse other questions tagged or ask your own question.