Issue with setting up OpenVPN on raspberryPI

This forum is for admins who are looking to build or expand their OpenVPN setup.
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
flokla
OpenVpn Newbie
Posts: 9
Joined: Thu Jul 22, 2021 11:18 am

Issue with setting up OpenVPN on raspberryPI

Post by flokla » Thu Jul 22, 2021 11:34 am

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.

300000
OpenVPN Expert
Posts: 617
Joined: Tue May 01, 2012 9:30 pm

Re: Issue with setting up OpenVPN on raspberryPI

Post by 300000 » Thu Jul 22, 2021 2:51 pm

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 .

flokla
OpenVpn Newbie
Posts: 9
Joined: Thu Jul 22, 2021 11:18 am

Re: Issue with setting up OpenVPN on raspberryPI

Post by flokla » Fri Jul 23, 2021 5:41 am

I said that I have service running and that port is opened..?

300000
OpenVPN Expert
Posts: 617
Joined: Tue May 01, 2012 9:30 pm

Re: Issue with setting up OpenVPN on raspberryPI

Post by 300000 » Fri Jul 23, 2021 7:29 am

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

flokla
OpenVpn Newbie
Posts: 9
Joined: Thu Jul 22, 2021 11:18 am

Re: Issue with setting up OpenVPN on raspberryPI

Post by flokla » Fri Jul 23, 2021 7:32 am

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

300000
OpenVPN Expert
Posts: 617
Joined: Tue May 01, 2012 9:30 pm

Re: Issue with setting up OpenVPN on raspberryPI

Post by 300000 » Fri Jul 23, 2021 8:20 am

All service is LISTEN but openvpn is not. Remove it and install again. Server is not running how can client connect to it?

flokla
OpenVpn Newbie
Posts: 9
Joined: Thu Jul 22, 2021 11:18 am

Re: Issue with setting up OpenVPN on raspberryPI

Post by flokla » Fri Jul 23, 2021 8:25 am

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

User avatar
TinCanTech
Forum Team
Posts: 9666
Joined: Fri Jun 03, 2016 1:17 pm

Re: Issue with setting up OpenVPN on raspberryPI

Post by TinCanTech » Fri Jul 23, 2021 11:53 am

Your server is working, you have not done port-forwarding correctly.

flokla
OpenVpn Newbie
Posts: 9
Joined: Thu Jul 22, 2021 11:18 am

Re: Issue with setting up OpenVPN on raspberryPI

Post by flokla » Fri Jul 23, 2021 12:07 pm

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...

User avatar
TinCanTech
Forum Team
Posts: 9666
Joined: Fri Jun 03, 2016 1:17 pm

Re: Issue with setting up OpenVPN on raspberryPI

Post by TinCanTech » Fri Jul 23, 2021 12:47 pm

You are using UDP:1194 not TCP ..

flokla
OpenVpn Newbie
Posts: 9
Joined: Thu Jul 22, 2021 11:18 am

Re: Issue with setting up OpenVPN on raspberryPI

Post by flokla » Tue Jul 27, 2021 9:48 am

Sorry, I did a mistake while writing, I have just checked and the ports are TCP...

User avatar
TinCanTech
Forum Team
Posts: 9666
Joined: Fri Jun 03, 2016 1:17 pm

Re: Issue with setting up OpenVPN on raspberryPI

Post by TinCanTech » Tue Jul 27, 2021 11:16 am

The ports are a number, the protocol is TCP and your is not TCP, it is UDP.

flokla
OpenVpn Newbie
Posts: 9
Joined: Thu Jul 22, 2021 11:18 am

Re: Issue with setting up OpenVPN on raspberryPI

Post by flokla » Tue Jul 27, 2021 11:26 am

Here is the link to screenshot from my router: https://prnt.sc/1gl9ybk

flokla
OpenVpn Newbie
Posts: 9
Joined: Thu Jul 22, 2021 11:18 am

Re: Issue with setting up OpenVPN on raspberryPI

Post by flokla » Tue Jul 27, 2021 11:28 am

And the other router: https://prnt.sc/1glaos2

User avatar
TinCanTech
Forum Team
Posts: 9666
Joined: Fri Jun 03, 2016 1:17 pm

Re: Issue with setting up OpenVPN on raspberryPI

Post by TinCanTech » Tue Jul 27, 2021 1:01 pm

Your VPN is not using TCP, it is using UDP.

flokla
OpenVpn Newbie
Posts: 9
Joined: Thu Jul 22, 2021 11:18 am

Re: Issue with setting up OpenVPN on raspberryPI

Post by flokla » Tue Jul 27, 2021 1:48 pm

Okay, sorry for misunderstanding. I have changed my ports to UDP and the issue still persists

User avatar
TinCanTech
Forum Team
Posts: 9666
Joined: Fri Jun 03, 2016 1:17 pm

Re: Issue with setting up OpenVPN on raspberryPI

Post by TinCanTech » Tue Jul 27, 2021 2:20 pm


Post Reply