Setup Fortinet VPN Client In CentOS 7


0 min read

My applications need to access services in client's private network. I am using openfortivpn to connect to Fortigate SSL VPN server. It should work for PPP VPN too.


Checkout for installation instruction. Check if there is already a package for your Linux distro before heading for manual build & install method.

sudo yum install openfortivpn

The systemd template file is provided in Github but not included in YUM package. So we have to create it manually with some modifications.

Create /usr/lib/systemd/system/openfortivpn@.service

Description=OpenFortiVPN for %I

# Available from v230 onward. Ref:

ExecStart=/usr/bin/openfortivpn -c /etc/openfortivpn/%I.conf

# Auto restart when it gets disconnected.


Reload systemd config.

sudo systemclt daemon-reload


Create a copy of “config” in /etc/openfortivpn/ and name it “example.conf”.

WARNING Make sure it has a .conf extension and filename matches the instance name in systemd service file.

cd /etc/openfortivpn
sudo cp config example.conf
sudo chmod 600 example.conf

Edit the VPN configuration. The configuration may contain password, therefore file permission should be set to “600”.

Enabled this service.

sudo systemctl enable openfortivpn@example

Note that instance name is the part between “@” and “.service”. Instance name must match openfortivpn config filename, excluding file extension.

Start VPN Service

sudo systemctl start openfortivpn@example

Maintaining Persistent Connection

My client's VPN server is configured to disconnect client after 5 minutes of inactivity. I have configured systemd to automatically restart the service upon disconnection. After some time, I discovered that openfortivpn service is running, but I am unable to access the private network. As a workaround, I created a cron job to ping 1 of the IPs in the private network at 4 minutes interval. This creates network activity and prevent forced disconnection.