Skip to content

Instantly share code, notes, and snippets.

@kiyui
Created April 11, 2015 14:16
Show Gist options
  • Save kiyui/2d5de9c16e4737352238 to your computer and use it in GitHub Desktop.
Save kiyui/2d5de9c16e4737352238 to your computer and use it in GitHub Desktop.
OpenVPN Config
########################################
# Sample OpenVPN config file for
# 2.0-style multi-client udp server
#
# Adapted from http://openvpn.sourceforge.net/20notes.html
#
# tun-style tunnel
port 443
proto tcp-server
dev tun0
# Use "local" to set the source address on multi-homed hosts
#local [IP address]
# TLS parms
tls-server
ca keys/X.crt
cert keys/X.crt
key keys/X.key
dh keys/X.pem
# Tell OpenVPN to be a multi-client udp server
mode server
# The server's virtual endpoints
ifconfig 10.8.0.1 10.8.0.2
# Pool of /30 subnets to be allocated to clients.
# When a client connects, an --ifconfig command
# will be automatically generated and pushed back to
# the client.
ifconfig-pool 10.8.0.4 10.8.0.255
# Push route to client to bind it to our local
# virtual endpoint.
push "route 10.8.0.1 255.255.255.255"
# Push any routes the client needs to get in
# to the local network.
push "route 192.168.0.0 255.255.255.0"
push "route 172.16.72.0 255.255.252.0"
push "route 10.100.0.0 255.255.252.0"
# Route traffic
push "redirect-gateway def1"
push "remote-gateway X"
# Push DHCP options to Windows clients.
;push "dhcp-option DOMAIN example.com"
push "dhcp-option DNS 8.8.8.8"
;push "dhcp-option WINS 192.168.0.1"
# Client should attempt reconnection on link
# failure.
keepalive 10 60
# Delete client instances after some period
# of inactivity.
inactive 600
# Route the --ifconfig pool range into the
# OpenVPN server.
route 10.8.0.0 255.255.255.0
# The server doesn't need privileges
user openvpn
group openvpn
# Keep TUN devices and keys open across restarts.
persist-tun
persist-key
verb 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment