This guide will help you set up an OpenVPN connection with CyberGhost on a Raspberry Pi device.
Jump To…
Step 1: Configure CyberGhost Settings
Step 2: Prepare the Configuration Files
Requirements
To set up CyberGhost VPN on a Raspberry Pi device, you’ll need the following:
- Raspberry Pi with ARM processor
- Raspberry Pi OS (formerly Raspbian) or OSMC
- A CyberGhost subscription and account
Disclaimer: We document each step as carefully as possible, but this process requires some technical knowledge. Interface options, firmware behavior, or setup steps may change as well, so check your router’s documentation if something doesn’t match the instructions.
Step 1: Configure CyberGhost VPN Settings
- Visit your CyberGhost VPN online account and log in with your username and password.
- Select the VPN from the left-side menu and scroll down the page and select Configure Device.
- Now create your server configuration, as described below:
-
Protocol: Select either:
- OpenVPN: The OpenVPN UDP default option can provide faster speeds than TCP, but it may cause interrupted downloads in some cases.
- OpenVPN TCP: The OpenVPN TCP option can provide more stable connections than UDP, but it may run slightly slower. Choose TCP if you experience recurring connection issues, such as sudden disconnections.
- Country: Select the country you want the VPN to connect to. You can choose one location per configuration. If you want to change the location afterwards, you’ll need to create a different configuration.
- Server group: Select the appropriate server group.
- Click Save Configuration.
- You’ll be taken to the VPN tab. Click View next to the configuration you created.
- Take note of the following:
- Server Group: This is the address of the country (server) you want to be connected with, e.g. '12345-1-ca.cg-dialup.net'.
- Username: The username generated for this configuration. This isn’t your regular CyberGhost account username. It only authenticates this manual configuration with CyberGhost’s servers.
- Password: The password generated for this configuration. This isn’t your regular CyberGhost account password. It only authenticates this manual configuration with CyberGhost’s servers.
Important: Please keep your username and password obtained during the configuration process at hand; you’ll need them later in the setup.
Select Download Configuration to download the configuration file to your computer.
The configuration file downloads as a .zip file that contains the following:
- ca.crt: This is the certificate of the certification authority.
- client.crt: This is the user certification file.
- client.key: This is your private key file.
- openvpn.ovpn: This is your OpenVPN configuration file.
Step 2: Prepare the Configuration Files
- When you download the config from CyberGhost VPN, the file is called openvpn.ovpn. Rename it to something like “CG_RO.conf” so you know which country it connects to (RO = Romania, in this example) and so the Raspberry Pi's OpenVPN software can read it properly.
- Then, you need to move the files into the right folder on your Pi. Open the terminal, navigate to where you unzipped the files, and copy them over:
cd [path to your folder]
sudo cp CG_RO.conf /etc/openvpn/
sudo cp ca.crt /etc/openvpn/
sudo cp client.crt /etc/openvpn/
sudo cp client.key /etc/openvpn/If you want to connect to more than one country
- Download a new config from CyberGhost and rename it.
- Copy just that new .conf file into the OpenVPN folder.
Important: You don't need to copy ca.crt, client.crt, and client.key again. These files are the same for every country, so you only need to copy them once. Only the .conf file needs to be added for each new country.
Step 3: Configure Your Network Settings
First, make sure your system is up to date and has the required packages installed. Open a terminal and run:
sudo apt-get update && sudo apt-get upgrade This updates your Raspberry Pi's software to the latest version. Then run:
sudo apt-get install openvpn openssl openresolvThis installs the three tools you need: OpenVPN to run the VPN connection, OpenSSL to handle encryption, and openresolv to manage your DNS settings.
Save Your Login Credentials
To log in automatically, you need to save your CyberGhost VPN username and password in a file.
- Navigate to the OpenVPN folder:
cd /etc/openvpn- Create and open a new text file:
sudo nano user.txt- Type your username on the first line and your password on the second line. Don’t use your regular CyberGhost VPN account credentials. Use the generated username and password from step 1.
Save with CTRL+O and exit with CTRL+X.
Edit the Configuration File
- Open your config file:
sudo nano CG_XX.conf - Find the line that says auth-user-pass and change it to:
auth-user-pass /etc/openvpn/user.txt- Then, at the bottom of the file, after verb 4, add these two lines:
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf- Save with CTRL+O and exit with CTRL+X.
Enable Autostart
- Open the OpenVPN default settings file:
sudo nano /etc/default/openvpn- Add this line at the end, replacing XX with your country code:
AUTOSTART="CG_XX"- Save with CTRL+O and exit with CTRL+X.
- Then run:
sudo update-rc.d openvpn enableStep 4: Verify Your Network and Start OpenVPN
- Before starting OpenVPN, run:
cat /etc/resolv.conf- Look for the nameserver line and make sure it shows your router's IP address. If it doesn't, update it before continuing.
- Now, start OpenVPN:
sudo service openvpn start- Wait a few seconds, then check if the connection is working. You can check the server status by running:
sudo service openvpn status5. Look for "active (running)" in the output. If it says that, the connection is up.
Need assistance? Contact our Customer Support team:
- via email at support@cyberghost.ro
- via online request at https://support.cyberghostvpn.com/hc/en-us/requests/new
- via 24/7 Live Chat by clicking the Support button below
Comments
0 comments
Article is closed for comments.