Free Hosting Online for WorkStations

< Previous | Contents | Next >

1.6.1. Advanced routed VPN configuration on server


The above is a very simple working VPN. The client can access services on the VPN server machine through an encrypted tunnel. If you want to reach more servers or anything in other networks, push some routes to the clients. E.g. if your company's network can be summarized to the network 192.168.0.0/16, you could push this route to the clients. But you will also have to change the routing for the way back - your servers need to know a route to the VPN client-network.


Or you might push a default gateway to all the clients to send all their internet traffic to the VPN gateway first and from there via the company firewall into the internet. This section shows you some possible options.


Push routes to the client to allow it to reach other private subnets behind the server. Remember that these private subnets will also need to know to route the OpenVPN client address pool (10.8.0.0/24) back to the OpenVPN server.


push "route 10.0.0.0 255.0.0.0"


If enabled, this directive will configure all clients to redirect their default network gateway through the VPN, causing all IP traffic such as web browsing and DNS lookups to go through the VPN (the OpenVPN server machine or your central firewall may need to NAT the TUN/TAP interface to the internet in order for this to work properly).


push "redirect-gateway def1 bypass-dhcp"


Configure server mode and supply a VPN subnet for OpenVPN to draw client addresses from. The server will take 10.8.0.1 for itself, the rest will be made available to clients. Each client will be able to reach the server on

10.8.0.1. Comment this line out if you are ethernet bridging.



server 10.8.0.0 255.255.255.0


Maintain a record of client to virtual IP address associations in this file. If OpenVPN goes down or is restarted, reconnecting clients can be assigned the same virtual IP address from the pool that was previously assigned.


ifconfig-pool-persist ipp.txt


Push DNS servers to the client.


push "dhcp-option DNS 10.0.0.2" push "dhcp-option DNS 10.1.0.2"


Allow client to client communication.


client-to-client


Enable compression on the VPN link.


comp-lzo


The keepalive directive causes ping-like messages to be sent back and forth over the link so that each side knows when the other side has gone down. Ping every 1 second, assume that remote peer is down if no ping received during a 3 second time period.


keepalive 1 3


It's a good idea to reduce the OpenVPN daemon's privileges after initialization.


user nobody group nogroup


OpenVPN 2.0 includes a feature that allows the OpenVPN server to securely obtain a username and password from a connecting client, and to use that information as a basis for authenticating the client. To use this authentication method, first add the auth-user-pass directive to the client configuration. It will direct the OpenVPN client to query the user for a username/password, passing it on to the server over the secure TLS channel.


# client config! auth-user-pass


This will tell the OpenVPN server to validate the username/password entered by clients using the login PAM module. Useful if you have centralized authentication with e.g. Kerberos.



plugin /usr/lib/openvpn/openvpn-plugin-auth-pam.so login


Please read the OpenVPN hardening security guide1 for further security advice.


Top OS Cloud Computing at OnWorks: