OpenVPN connection test
After configuring and running both the OpenVPN server and client, it’s a good idea to test if the VPN is working. This involves some tests on both the server and client.
After the server is started, a new interface should be created. Run ifconfig to get a list of all available interfaces. In case tun is configured in the conf file as device type, a new interface with name tun0 is created.
Check server log for client connection
In case OpenVPN is started as a service, the log can be found at /var/log/messages. If you start it directly on the command line, the log will be shown on the shell. When a client connects, the log of the server shows the connection information.
tail -f /var/log/messages
The last lines show client1, meaning that the client not only connected, but is also correctly identified as client1. The connection is working.
Start OpenVPN and the client will try to connect to the server specified in the client.conf file. Client connecting and receiving IP.
openvpn /etc/openvpn/client.conf tail -f /var/log/messages
After the connection was established, the client is also creating a new interface named tun0. Here a client named client1 connects and receives the IP 10.8.0.6.
Easiest way to test that client and server can talk to each other is to ping both. Just run a ping from the server to the client IP, and from the client to the server IP. For this, the VPN IP address must be used (e.g. 10.8.0.x).
Ping client1 from server.
Ping server from client.