Checking the Status of OpenVPN on Raspberry Pi
A step-by-step guide for checking the status of your OpenVPN connection on your Raspberry Pi and making sure it’s running smoothly. …
Updated October 8, 2023
A step-by-step guide for checking the status of your OpenVPN connection on your Raspberry Pi and making sure it’s running smoothly.
Are you using a Raspberry Pi as a VPN server? Then, you might want to check if OpenVPN is running properly. In this article, we will show you how to do that and ensure that your VPN connection is working fine. Here are the steps:
- Log in to your Raspberry Pi using SSH or by connecting a monitor and keyboard.
- First, let’s check if OpenVPN is installed on your system by running the following command:
sudo dpkg -l | grep openvpn
If it’s not installed, you can install it with this command:
sudo apt-get update && sudo apt-get install openvpn
- Once OpenVPN is installed, check if the service is running by using the following command:
systemctl status openvpn@<config_file>
Replace <config_file>
with the name of your OpenVPN configuration file (e.g., client.ovpn
).
- If OpenVPN is running, you should see output similar to this:
● openvpn@client.service - OpenVPN connection to client
Loaded: loaded (/lib/systemd/system/openvpn@.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2021-09-08 15:47:23 UTC; 2h 3min ago
Docs: man:openvpn(8)
https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
https://community.openvpn.net/openvpn/wiki/HOWTO
Main PID: 1507 (openvpn)
Status: "Initialization Sequence Completed"
Tasks: 3 (limit: 4915)
CGroup: /system.slice/system-openvpn.slice/openvpn@client.service
└─1507 /usr/sbin/openvpn --daemon ovpn-client --status /run/openvpn/client.status 10 --cd /etc/openvpn --script-security 2 --config /etc/openvpn/client.ovpn
If OpenVPN is not running, you can start it with the following command:
sudo systemctl start openvpn@<config_file>
- To see more details about your VPN connection, check the status file generated by OpenVPN:
cat /run/openvpn/client.status
You should see output similar to this:
OpenVPN CLIENT LIST
Updated,Sat Sep 8 17:50:23 2021
Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since
client,xx.xxx.xx.xx:xxxx,16927460,3619674,Sat Sep 8 15:47:31 2021
ROUTING TABLE
Virtual Address,Common Name,Real Address,Last Ref
10.8.0.6,client,xx.xxx.xx.xx:xxxx,Sat Sep 8 17:49:52 2021
GLOBAL STATS
Max bcast/mcast queue length,0
END
This output shows that your VPN is running and connected to the server with IP address xx.xxx.xx.xx
.
6. You can also verify your connection by checking the list of active network interfaces:
ifconfig
Look for a tunnel interface, such as tun0
, which indicates that OpenVPN is running.
- If you want to check if your IP address has changed after connecting to the VPN server, run:
curl ipinfo.io/ip
This command should return your new IP address from the VPN provider.
- If you’re done using OpenVPN, stop it with:
sudo systemctl stop openvpn@<config_file>
Or restart it if there are any issues:
sudo systemctl restart openvpn@<config_file>
That’s it! You can now check if OpenVPN is running on your Raspberry Pi and ensure that your VPN connection is working as expected.