Skip to content

Instantly share code, notes, and snippets.

@gangsta
Last active May 25, 2024 21:30
Show Gist options
  • Save gangsta/679e224900003f51ec184b7b8e56968b to your computer and use it in GitHub Desktop.
Save gangsta/679e224900003f51ec184b7b8e56968b to your computer and use it in GitHub Desktop.
Fedora 30 Connect to OpenVPN

Install Openvpn

sudo dnf install openvpn

Configure Path

mv myopenvpconfig /etc/openvpn/client/

How to add Openvpn Systemd service Fedora 30

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

How to use Openvpn IP forward in Fedora 30 with LAN connection

make sure your config contain IP forwarding

  • In your myconfig.ovpn
redirect-gateway def1
push "redirect-gateway def1"

How to set Password to Openvpn Config Fedora 30

make sure your config contain password read param

  • In your myconfig.ovpn
askpass user.pass

where user.pass is file containing password

How to Openvpn Selinux in Fedora 30

restorecon -Rv /etc/openvpn/client/

Fedora 30 with Openvpn and Wifi

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.

Start Stop Status Openvpn

systemctl start openvpn

systemctl status openvpn

systemctl stop openvpn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment