Created
April 10, 2018 17:07
-
-
Save sabahtalateh/701a0dd64082883a35fdfa31dfa7f745 to your computer and use it in GitHub Desktop.
OpenVPN config simple example on CentOS 7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OpenVPN config simple example on CentOS 7 | |
-------------------------------------------------------------------------------- | |
# Server config | |
# /etc/openvpn/server.conf | |
port 1194 | |
proto udp | |
dev tun | |
ca ca.crt | |
cert server.crt | |
key server.key # This file should be kept secret | |
dh dh.pem | |
topology subnet | |
server 10.8.0.0 255.255.255.0 # tunnel address | |
route 192.168.99.0 255.255.255.0 # local network of the server. | |
push "route 192.168.56.0 255.255.255.0" # push route to the client network on server wich you will be able to access from client. | |
ifconfig-pool-persist ipp.txt | |
client-to-client | |
client-config-dir /etc/openvpn/ccd | |
user nobody | |
group nobody | |
cipher AES-256-CBC # should be the same for client and server. | |
keepalive 10 120 | |
persist-key | |
persist-tun | |
status openvpn-status.log | |
log openvpn.log | |
log-append openvpn.log | |
verb 3 | |
explicit-exit-notify 1 | |
comp-lzo | |
# Minimal iptables configuration. | |
# iptables -F && iptables -F -t nat && iptables -F -t mangle | |
# iptables -t nat -A POSTROUTING -o $(interface that related to the servers local network) -j MASQUERADE | |
-------------------------------------------------------------------------------- | |
# Client. | |
# /etc/openvpn/client.conf | |
client | |
dev tun | |
proto udp | |
port 1194 | |
remote 94.19.239.50 3003 # VPN Server address. | |
;remote 192.168.1.48 1194 | |
route 192.168.56.0 255.255.255.0 # not required if server push the route. | |
resolv-retry infinite | |
user nobody | |
group nobody | |
persist-key | |
persist-tun | |
comp-lzo | |
topology subnet | |
ca /etc/openvpn/ca.crt | |
cert /etc/openvpn/client.crt | |
key /etc/openvpn/client.key | |
cipher AES-256-CBC | |
verb 3 | |
status /var/log/openvpn/openvpn-status.log 1 | |
status-version 3 | |
log-append /var/log/openvpn/openvpn-client.log | |
# Minimal iptables configuration (will work even without it). | |
# iptables -F && iptables -F -t nat && iptables -F -t mangle | |
# iptables -t nat -A POSTROUTING -o $(interface that related to the servers local network) -j MASQUERADE | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment