sudo dnf install openvpn
mv myopenvpconfig /etc/openvpn/client/
vi /usr/lib/systemd/system/openvpn.service
add following to openvpn, make sure you have changed myconfig
to your config file
[Unit]
Description=OpenVPN tunnel for %I
After=syslog.target network-online.target
Wants=network-online.target
Documentation=man:openvpn(8)
Documentation=https://community.openvpn.net/openvpn/wiki/Openvpn24ManPage
Documentation=https://community.openvpn.net/openvpn/wiki/HOWTO
[Service]
Type=notify
PrivateTmp=true
WorkingDirectory=/etc/openvpn/client
ExecStart=/usr/sbin/openvpn --suppress-timestamps --nobind --config myconfig.ovpn
CapabilityBoundingSet=CAP_IPC_LOCK CAP_NET_ADMIN CAP_NET_RAW CAP_SETGID CAP_SETUID CAP_SYS_CHROOT CAP_DAC_OVERRIDE
LimitNPROC=10
DeviceAllow=/dev/null rw
DeviceAllow=/dev/net/tun rw
ProtectSystem=true
ProtectHome=true
KillMode=process
[Install]
WantedBy=multi-user.target
make sure your config contain IP forwarding
- In your myconfig.ovpn
redirect-gateway def1
push "redirect-gateway def1"
make sure your config contain password read param
- In your myconfig.ovpn
askpass user.pass
where user.pass
is file containing password
restorecon -Rv /etc/openvpn/client/
In some cases when using Wifi and Openvpn DNS config is not configured well. check your /etc/resolv.conf In my case I should add
echo 'nameserver 10.5.0.1' >> /etc/resolv.conf
NOTE! nameserver 10.5.0.1
is random ip this case , check your dns server IP of VPN and replace this IP.
systemctl start openvpn
systemctl status openvpn
systemctl stop openvpn