We will explain how to connect to your OpenVPN server via Ubuntu in two ways. One is via CLI and the other via GUI. We will use PfSense as the VPN server. In addition to using PfSense as an OpenSource firewall, you can use it for many purposes. We will use the VPN server for the process here and get the configuration files from it.
First, we extract the configuration files from the VPN server. *.Ovpn, * .p12, * .key. In the meantime, the configuration varies on the server-side. So for ios, for android, for windows and are divided into standard packages.
Then list your IP table with “
ifconfig” or “
ip address” command.
Also, list your routing table “
route“ or “
Then let us continue by installing the required package using the command below.
> sudo apt install network-manager-openvpn-gnome
After the package installation is completed, let’s first make a connection to the VPN server via CLI via the command below. Start the terminal and navigate to the directory containing the VPN files with the cd command.
> cd and ls command
Run the following command. After entering the Sudo password;
> sudo openvpn –config fw-TCP-1194.ovpn
It will prompt you for VPN user and password information.
If you see the following output on the last line of the terminal, you have successfully connected.
When you list your IP and routing table with the help of the above commands, you will have the checksum.
NOTE1: After the Vpn connection is made, the terminal will need to remain open, if you close it, the connection will break. This can be solved with different attractions, but the most accurate method is to add the “daemon” parameter to the command.
> sudo openvpn –config fw-TCP-1194.ovpn –daemon
NOTE2: Even the user and password information from the file without entering the connection can provide. This may be needed to make your work easier. It should be in the directory with the connection information. You can also provide this with the command below.
> sudo openvpn –config fw-TCP-1194.ovpn –daemon –auth-user-pass VpnBilgiler
Configure the SIMI as a GUI and provide a connection;
In fact, our main configuration file is * .ovpn, the other two files are * .p12 and * .key, and so on. In the screenshot below I explained in detail. After the GUI configuration is done exactly the same with the information in the * .ovpn file, we will provide the connection.
Click the Wi-Fi broadcast flag and click Connections Edit Connections…
From there, click on the “Add” button.
Then we create the “OpenVPN” option.
Then we enter the information with the information in the * .ovpn file as follows and click “Advanced“.
Then we check the options below, it’s not really necessary, but let’s do it anyway.
Then we select the Cipher option from the Security section as written in the * .ovpn file.
TLS Authentication part of the * .ovpn file in the light of the information determined and say “OK”.
After you say OK, the following information is recorded.
Now let’s make the VPN connection. Click on the Wi-Fi broadcast flag again, then click on VPN Connections and click on our VPN connection.
The VPN will ask for the password of the user, enter it as below and say OK and wait for it to connect.
And we have received the link successful information.
After a successful connection, a lock pattern is formed on the Wifi sign.
Then, “ifconfig” or “ip address” command and your ip information, and“ route ”or“ netstat -nr ”command by looking at our routing table can verify the connection.
I hope it has been a useful article.