2

I would like to setup a small vpn server for a remote office of my company. The goal is to be able to access its network either from the corp network or from home.

Most of (if not all) clients will be running Windows (>=7).

To reduce costs, I want to reuse an old computer, where I setup ubuntu server 13.04. I've followed openvpn documention on ubuntu web site.

I've been able to deploy the packages. However, my general linux knowledge is limited, and I'm stuck at setting up the different configuration file.

Basically I have:

  • an internet connection, with a modem that have basic router features: dhcp server, nat translation, and port forwarding.
  • a single network 192.168.100.0/24 where all computers are connected, including the internet modem and the vpn server (this server has only one network card).

My questions are:

  • the openvpn tutorials and sample config file I found are mentioning route configuration, ethernet bridging, etc. I admit I don't understand what I'm suppose to do. I simply want to grant access to the whole local network when a client connects?
  • as my clients will be mostly windows client, what specific configuration I'm supposed to apply in the server.conf file?
  • is there any sample configuration file specific to my scenario?
  • Am I stuck to openvpn client? Is there any chance to be able to use the native vpn client features of Windows (if this imply using another vpn server, I can evaluate it).

1 Answer 1

1

Ubuntu Server 14.04.1 How To setup OpenVPN server on a seperate machine than the LAN gateway (with access to other machines on server LAN)

Make sure your openvpn LAN is not the usual 192.168.1.1 or 10.0.0.1. If it is, log in to your router and change the third number ie. 192.168.(this number).1

Make sure to forward port 1194 on your router to the OpenVPN server IP

Example Network:

Gateway IP:            192.168.5.1
OpenVPN Server IP:     192.168.5.20

OpenVPN Config:

 port 1194
 proto udp
 dev tun0
 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
 push "route 192.168.5.0 255.255.255.0"
 push "route 10.8.0.0 255.255.255.0"
 push "redirect-gateway def1 bypass-dhcp"
 push "dhcp-option DNS 8.8.8.8"
 push "dhcp-option DNS 8.8.4.4"
 client-to-client
 duplicate-cn
 keepalive 10 120
 tls-auth ta.key 0
 comp-lzo
 user nobody
 group nogroup
 persist-key
 persist-tun 
 status openvpn-status.log
 verb 3

Edit /etc/network/interfaces:

 auto lo
 iface lo inet loopback

 auto eth0
 iface eth0 inet static
      address 192.168.5.20
      netmask 255.255.255.0
      broadcast 192.168.5.255
      network 192.168.5.0
      gateway 192.168.5.1
      dns-nameservers 8.8.8.8
      dns-nameservers 8.8.4.4

 post-up iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -j SNAT --to 192.168.5.20

Make sure to comment out ipv6 setting

Edit /etc/sysctl.conf:

Change:

 #net.ipv4.ip_forward=1

to:

 net.ipv4.ip_forward=1

Assuming your keys and client configs are all squared away; Reboot your server and you should be good to go!

Once connected, ping from client:

 Ping 10.8.0.1
 Ping 192.168.5.20
1
  • I was fighting with this for about a month before i finally figured it out. Its ALL about that iptables rule!
    – Kallet
    Oct 20, 2014 at 6:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .