OpenVPN Server(Bridged)/CentOS7

Published Jul 03, 2017

Follow the steps on this website.
1.Install OpenVPN.

# CentOS7 can't recognize "--enablerepo=epel" , use epel-release instead.
[root@localhost]# yum install epel-release openvpn easy-rsa net-tools bridge-utils -y

2.Create CA certificates.
3.Create server certificates.
4.Generate Diffie Hellman ( DH ) parameter.
5.Create client certificates.

Options error: --tls-auth fails with 'ta.key': No such file or directory

openvpn --genkey --secret /etc/openvpn/ta.key

Options error: --explicit-exit-notify can only be used with --proto udp

#vi /etc/openvpn/server.conf
;explicit-exit-notify 1

6.Configure and start OpenVPN server.

Options error: --writepid fails with '/var/run/openvpn/': No such file or directory

 # change like follows in [Service] section

#/var/run/openvpn doesn't exist in CentOS7, use /var/run/openvpn-server instead.
ExecStartPre=/bin/echo 1 > /proc/sys/net/ipv4/ip_forward
ExecStart=/usr/sbin/openvpn --daemon --writepid /var/run/openvpn/ --cd /etc/openvpn/ --config server.conf
ExecStopPost=/bin/echo 0 > /proc/sys/net/ipv4/ip_forward

7.Firewalld Setting.
Follow steps here

See Also
OpenVPN HowTo

Not working behind NAT environment, maybe try tunnel next time.

Discover and read more posts from 呂昱昕
get started