Installation on Debian Wheezy. Other distributions will have similar settings.
# install openvpn aptitude install openvpn
# edit variables cd /usr/share/doc/openvpn/examples/easy-rsa/2.0/
nano ./vars
# changing lines export KEY_SIZE = 2048 # Key Length
export KEY_EXPIRE = 3650 # Key expiration date in days
# initialize variables and clean the keys folder and create certificates . ./vars
. ./clean-all
./build-ca
# root certificate ./build-key-server server
# server certificate ./build-dh
# key Diffie Helman # tls-auth (optional) openvpn --genkey --secret ./keys/ta.key
# transfer the received certificates to the working folder cp ./keys/ca.crt / etc / openvpn
cp ./keys/server.crt / etc / openvpn
cp ./keys/server.key / etc / openvpn
cp ./keys/dh2048.pem / etc / openvpn
# for tls-auth cp ./keys/ta.key / etc / openvpn
# create user certificates ./build-key-pkcs12 vpn.android
Server config: zcat /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz>/etc/openvpn/server.conf
nano /etc/openvpn/server.conf
local [B] IP [/ B]
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
tls-auth ta.key 0
port [B] PORT [/ B]
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
keepalive 10 120
comp-lzo
persist-key
persist tun
status openvpn-status.log
verb 3
# uncomment the line nano /etc/sysctl.conf
net.ipv4.ip_forward = 1
# setting IPTABLES iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
iptables -A FORWARD -m state --state RELATED, ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE