Page 1 of 1

Issue with setting up OpenVPN on raspberryPI

Posted: Thu Jul 22, 2021 11:34 am
by flokla
Hello,
I need help with setting up my OpenVPN server on raspberryPI, I have followed the tutorial on https://www.pivpn.io/ and after I imported my config file to mobile app it does not want to connect... It keeps saying connecting to "ip:port", then stops after timeout. I have opened the ports on both routers aswell (ISP one and mine) for the TCP port number... Does anyone have an idea what could be wrong, when I type lsod command on pi it does not show openvpn port listening, but systemctl command shows that service is running...?

Thank you in advance.

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Thu Jul 22, 2021 2:51 pm
by 300000
You need check your server it is running openvpn yes and firewall to let client connect first. Then come bach here when something is wrong. Only say not connect dont help at all .

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Fri Jul 23, 2021 5:41 am
by flokla
I said that I have service running and that port is opened..?

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Fri Jul 23, 2021 7:29 am
by 300000
Ok now let check port first .type this into terminal to see what port open and if openvpn as list on port or not. If there is no openvpn list port so your server not running.

sudo lsof -i -P -n | grep LISTEN

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Fri Jul 23, 2021 7:32 am
by flokla
pi@pi:~ $ sudo lsof -i -P -n | grep LISTEN
sshd 558 root 3u IPv4 16981 0t0 TCP *:22 (LISTEN)
sshd 558 root 4u IPv6 16983 0t0 TCP *:22 (LISTEN)
mysqld 674 mysql 25u IPv4 18255 0t0 TCP 127.0.0.1:3306 (LISTEN)
lighttpd 685 www-data 4u IPv4 18183 0t0 TCP *:8000 (LISTEN)
lighttpd 685 www-data 5u IPv6 18184 0t0 TCP *:8000 (LISTEN)
apache2 717 root 4u IPv6 19937 0t0 TCP *:80 (LISTEN)
pihole-FT 725 pihole 5u IPv4 18240 0t0 TCP *:53 (LISTEN)
pihole-FT 725 pihole 7u IPv6 18242 0t0 TCP *:53 (LISTEN)
pihole-FT 725 pihole 12u IPv4 18247 0t0 TCP 127.0.0.1:4711 (LISTEN)
pihole-FT 725 pihole 16u IPv6 18249 0t0 TCP [::1]:4711 (LISTEN)
smbd 1093 root 32u IPv6 23813 0t0 TCP *:445 (LISTEN)
smbd 1093 root 33u IPv6 23814 0t0 TCP *:139 (LISTEN)
smbd 1093 root 34u IPv4 23815 0t0 TCP *:445 (LISTEN)
smbd 1093 root 35u IPv4 23816 0t0 TCP *:139 (LISTEN)
apache2 7201 www-data 4u IPv6 19937 0t0 TCP *:80 (LISTEN)
apache2 7202 www-data 4u IPv6 19937 0t0 TCP *:80 (LISTEN)
apache2 7203 www-data 4u IPv6 19937 0t0 TCP *:80 (LISTEN)
apache2 7204 www-data 4u IPv6 19937 0t0 TCP *:80 (LISTEN)
apache2 7205 www-data 4u IPv6 19937 0t0 TCP *:80 (LISTEN)
cupsd 7206 root 6u IPv6 55159 0t0 TCP [::1]:631 (LISTEN)
cupsd 7206 root 7u IPv4 55160 0t0 TCP 127.0.0.1:631 (LISTEN)
sshd 12768 pi 10u IPv6 83489 0t0 TCP [::1]:6010 (LISTEN)
sshd 12768 pi 11u IPv4 83490 0t0 TCP 127.0.0.1:6010 (LISTEN)

pi@pi:~ $ sudo lsof -i -P -n | grep openvpn
openvpn 511 openvpn 6u IPv4 17764 0t0 UDP *:1194

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Fri Jul 23, 2021 8:20 am
by 300000
All service is LISTEN but openvpn is not. Remove it and install again. Server is not running how can client connect to it?

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Fri Jul 23, 2021 8:25 am
by flokla
I have already done that it does not help... Why does the service say its running?

openvpn.service - OpenVPN service
Loaded: loaded (/lib/systemd/system/openvpn.service; enabled; vendor preset: enabled)
Active: active (exited) since Thu 2021-07-22 13:03:32 CEST; 21h ago
Process: 495 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
Main PID: 495 (code=exited, status=0/SUCCESS)

Jul 22 13:03:32 pi systemd[1]: Starting OpenVPN service...
Jul 22 13:03:32 pi systemd[1]: Started OpenVPN service.


pi@pi:~ $ systemctl status openvpn@server.service
openvpn@server.service - OpenVPN connection to server
Loaded: loaded (/lib/systemd/system/openvpn@.service; enabled-runtime; vendor preset: enabled)
Active: active (running) since Thu 2021-07-22 13:03:33 CEST; 21h ago
Docs: man:openvpn(8)
https://community.openvpn.net/openvpn/w ... n24ManPage
https://community.openvpn.net/openvpn/wiki/HOWTO
Main PID: 511 (openvpn)
Status: "Initialization Sequence Completed"
Tasks: 1 (limit: 2062)
CGroup: /system.slice/system-openvpn.slice/openvpn@server.service
└─511 /usr/sbin/openvpn --daemon ovpn-server --status /run/openvpn/server.status 10 --cd /etc/openvpn --config /etc/openvpn/server.conf --writepid /run/openvpn/server.pid

Jul 22 13:03:33 pi ovpn-server[511]: /sbin/ip addr add dev tun0 10.8.0.1/24 broadcast 10.8.0.255
Jul 22 13:03:33 pi ovpn-server[511]: Could not determine IPv4/IPv6 protocol. Using AF_INET
Jul 22 13:03:33 pi ovpn-server[511]: Socket Buffers: R=[180224->180224] S=[180224->180224]
Jul 22 13:03:33 pi ovpn-server[511]: UDPv4 link local (bound): [AF_INET][undef]:1194
Jul 22 13:03:33 pi ovpn-server[511]: UDPv4 link remote: [AF_UNSPEC]
Jul 22 13:03:33 pi ovpn-server[511]: GID set to openvpn
Jul 22 13:03:33 pi ovpn-server[511]: UID set to openvpn
Jul 22 13:03:33 pi ovpn-server[511]: MULTI: multi_init called, r=256 v=256
Jul 22 13:03:33 pi ovpn-server[511]: IFCONFIG POOL: base=10.8.0.2 size=252, ipv6=0
Jul 22 13:03:33 pi ovpn-server[511]: Initialization Sequence Completed

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Fri Jul 23, 2021 11:53 am
by TinCanTech
Your server is working, you have not done port-forwarding correctly.

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Fri Jul 23, 2021 12:07 pm
by flokla
TinCanTech wrote:
Fri Jul 23, 2021 11:53 am
Your server is working, you have not done port-forwarding correctly.
I have 2 routers 1 from my isp and mine and I have portforwarded port 1194 udp on both of them...

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Fri Jul 23, 2021 12:47 pm
by TinCanTech
You are using UDP:1194 not TCP ..

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Tue Jul 27, 2021 9:48 am
by flokla
Sorry, I did a mistake while writing, I have just checked and the ports are TCP...

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Tue Jul 27, 2021 11:16 am
by TinCanTech
The ports are a number, the protocol is TCP and your is not TCP, it is UDP.

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Tue Jul 27, 2021 11:26 am
by flokla
Here is the link to screenshot from my router: https://prnt.sc/1gl9ybk

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Tue Jul 27, 2021 11:28 am
by flokla
And the other router: https://prnt.sc/1glaos2

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Tue Jul 27, 2021 1:01 pm
by TinCanTech
Your VPN is not using TCP, it is using UDP.

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Tue Jul 27, 2021 1:48 pm
by flokla
Okay, sorry for misunderstanding. I have changed my ports to UDP and the issue still persists

Re: Issue with setting up OpenVPN on raspberryPI

Posted: Tue Jul 27, 2021 2:20 pm
by TinCanTech