I've read through a lot of howto's for openvpn, and a lot of them didn't seem to work, I could follow them line for line and I kept running into problems.
Here is my HOWTO on openvpn, which i find was the simpliest way of setting it up.
Server Config
========================================
Paste this into the file and edit to suit you needs# emerge openvpn
# nano /usr/share/openvpn/easy-rsa/vars
Code: Select all
export EASY_RSA="`pwd`"
export KEY_CONFIG="$EASY_RSA/openssl.cnf"
export KEY_DIR="$EASY_RSA/keys"
echo NOTE: If you run ./clean-all, I will be doing a rm -rf on $KEY_DIR
export KEY_SIZE=1024
export CA_EXPIRE=3650
export KEY_EXPIRE=3650
export KEY_COUNTRY="US"
export KEY_PROVINCE="CA"
export KEY_CITY="SanFrancisco"
export KEY_ORG="Fort-Funston"
export KEY_EMAIL="me@myhost.mydomain"
Just press enter through everything and select (Y) where necessary# cd /usr/share/openvpn/easy-rsa/
# source ./vars
# ./clean-all
# ./build-ca
# ./build-key-server server
# ./build-dh
Paste this into your server.conf and edit the <network range> value# cd /etc/openvpn/
# openvpn --genkey --secret ta.key
# mkdir ccd
# nano server.conf
Code: Select all
port 9000
proto udp
dev tun
mode server
ca /usr/share/openvpn/easy-rsa/keys/ca.crt
cert /usr/share/openvpn/easy-rsa/keys/server.crt
key /usr/share/openvpn/easy-rsa/keys/server.key
dh /usr/share/openvpn/easy-rsa/keys/dh1024.pem
server <network range> 255.255.255.0 # for example 192.168.139.0
client-to-client
ifconfig-pool-persist ipp.txt
client-config-dir ccd
keepalive 10 120
tls-auth ta.key 0
tun-mtu 1500
tun-mtu-extra 32
mssfix 1200
duplicate-cn
comp-lzo
max-clients 100
persist-key
persist-tun
status openvpn-status.log
log /var/log/openvpn.log
log-append /var/log/openvpn.log
verb 3
Your server side of things should be up and running now.# ln -sf /etc/init.d/openvpn /etc/init.d/openvpn.server
# /etc/init.d/openvpn.server start
# rc-update add openvpn.server default
If you run an ifconfig you should see the tun0 device.
========================================
Windows Client Configuration
========================================
On the Openvpn server you have just setup:
On the Client side:cd /usr/share/openvpn/easy-rsa/
source ./vars
./build-key <USERNAME>
# install the openvpn client on windows : http://openvpn.se/files/install_package ... nstall.exe
# create folder : C:\Program Files\OpenVPN\config\<USERNAME>
# create a file called : C:\Program Files\OpenVPN\config\<USERNAME>.ovpn
# open this file with notepad and inside that file put the following and edit the <USERNAME> value and the <vpn server IP> value:
Code: Select all
client
dev tun
proto udp
remote <vpn server IP> 9000
resolv-retry infinite
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1200
persist-key
persist-tun
ca "C:\\Program Files\\OpenVPN\\config\\<USERNAME>\\ca.crt"
cert "C:\\Program Files\\OpenVPN\\config\\<USERNAME>\\<USERNAME>.crt"
key "C:\\Program Files\\OpenVPN\\config\\<USERNAME>\\<USERNAME>.key"
tls-auth "C:\\Program Files\\OpenVPN\\config\\<USERNAME>\\ta.key" 1
comp-lzo
verb 3
ca.crt
<USERNAME>.crt
<USERNAME>.key
# copy the ta.key file from /etc/openvpn/ to C:\Program Files\OpenVPN\config\<USERNAME>\
# if you want to assign a specific user an IP address, create a file on the server : /etc/openvpn/ccd/<username>
# and in it put for example :
Code: Select all
ifconfig-push 192.168.220.5 192.168.220.6
The fire up the client and you should be connected.
========================================
Linux Client Configuration
========================================
On the Openvpn server you have just setup:
On the Client side:cd /usr/share/openvpn/easy-rsa/
source ./vars
./build-key <USERNAME>
Put this into your client.conf and edit the <vpn server ip> & <username> values.# emerge openvpn
# cd /etc/openvpn
# mkdir client
# nano client.conf
Code: Select all
client
dev tun
proto udp
remote <vpn server ip> 9900
resolv-retry infinite
nobind
tun-mtu 1500
tun-mtu-extra 32
mssfix 1200
persist-key
persist-tun
ca "/etc/openvpn/client/ca.crt"
cert "/etc/openvpn/client/<username>.crt"
key "/etc/openvpn/client/<username>.key"
tls-auth "/etc/openvpn/client/ta.key" 1
comp-lzo
verb 3
ca.crt
<username>.*
copy the ta.key file from /etc/openvpn/ on the server to /etc/openvpn/client on the client side.
# if you want to assign a specific user an IP address, create a file on the server : /etc/openvpn/ccd/<username># ln -sf /etc/init.d/openvpn /etc/init.d/openvpn.client
# /etc/init.d/openvpn.client start
# rc-update add openvpn.client default
# and in it put for example :
Code: Select all
ifconfig-push 192.168.220.5 192.168.220.6
========================================
Please let me know if i've left anything out.
regards
Dave





