{"id":154,"date":"2019-06-03T00:48:43","date_gmt":"2019-06-02T23:48:43","guid":{"rendered":"https:\/\/blog.inplico.uk\/?p=154"},"modified":"2019-06-03T00:49:04","modified_gmt":"2019-06-02T23:49:04","slug":"open-vpn","status":"publish","type":"post","link":"https:\/\/blog.inplico.uk\/?p=154","title":{"rendered":"Open VPN"},"content":{"rendered":"<p><strong>Installation<\/strong><\/p>\n<p>With point to point tunneling protocol VPN\u2019s depreciated because of security issues we are now not even bothering to install pptp at all and are instead opting for openvpn.<\/p>\n<p>For the installation you are going to want 2 applications, openvpn and easy-rsa.<\/p>\n<pre class=\"lang:sh decode:true \">#apt-get install openvpn easy-rsa<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Build and configure the certificate authority<\/strong><\/p>\n<p>OpenVPN supports bidirectional authentication based on certificates, meaning that the client must authenticate the server certificate and the server must authenticate the client certificate before mutual trust is established. We will use Easy RSA&#8217;s scripts to do this.<\/p>\n<p>First copy over the Easy-RSA generation scripts.<\/p>\n<pre class=\"lang:sh decode:true\">#cp -r \/usr\/share\/easy-rsa\/ \/etc\/openvpn<\/pre>\n<p>Then create a directory to store the keys in.<\/p>\n<pre class=\"lang:sh decode:true\">#mkdir \/etc\/openvpn\/easy-rsa\/keys<\/pre>\n<p>Next we need to set the parameters for our certificate<\/p>\n<pre class=\"lang:sh decode:true\">#vi \/etc\/openvpn\/easy-rsa\/vars<\/pre>\n<p>You need to set the following according to your configuration.<\/p>\n<pre class=\"lang:sh highlight:0 decode:true \">export KEY_COUNTRY=\r\nexport KEY_PROVINCE=\r\nexport KEY_CITY=\r\nexport KEY_ORG=\r\nexport KEY_EMAIL=\r\nexport KEY_OU=<\/pre>\n<p>The country code for England is GB; the province is the county (I guess this is a yank thing but I just put LA for Lancashire; KEY_ORG is the company; and KEY_OU is the top level domain.<\/p>\n<p>Further down you will find the X509 Subject field. This is what your ca certificate will be called. I am going to call it \u201c<strong>OpenvpnServer<\/strong>\u201d<\/p>\n<pre class=\"lang:sh highlight:0 decode:true \">export KEY_NAME=\"OpenvpnServer\"<\/pre>\n<p>That is it for vars, now we can move on to the initialization process.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Initialise the Certificate Authority<\/strong><\/p>\n<p>First we generate the Diffie-Helman parameters using a built-in OpenSSL tool called dhparam.<\/p>\n<pre class=\"lang:sh decode:true\">#openssl dhparam -out \/etc\/openvpn\/dh4096.pem 4096<\/pre>\n<p>The -out flag specifies where to save the new parameters file<\/p>\n<p>Now it is time to generate the first key. First we need to switch to the easy-rsa directory.<\/p>\n<pre class=\"lang:sh decode:true \">#cd \/etc\/openvpn\/easy-rsa<\/pre>\n<p>Next, we can begin setting up the Certificate Authority itself. First, initialize the Public Key Infrastructure (PKI). The first thing to so is source the vars file (I guess this tells build-ca where to look for the configuration file)<\/p>\n<pre class=\"lang:sh decode:true\">#source .\/vars<\/pre>\n<p>Then run clean-all to we&#8217;ll clear any other keys that may interfere with our installation.<\/p>\n<pre class=\"lang:sh decode:true\">#.\/clean-all<\/pre>\n<p>Finally, we will build the CA using an OpenSSL command. This command will prompt you for a confirmation of &#8220;Distinguished Name&#8221; variables that were entered earlier. Press ENTER to accept existing values.<\/p>\n<pre class=\"lang:sh decode:true\"># .\/build-ca<\/pre>\n<p>If you get the following error:<\/p>\n<p>grep: \/etc\/openvpn\/easy-rsa\/openssl.cnf: No such file or directory pkitool: KEY_CONFIG (set by the .\/vars script) is pointing to the wrong version of openssl.cnf: \/etc\/openvpn\/easy-rsa\/openssl.cnf The correct version should have a comment that says: easy-rsa version 2.x<\/p>\n<p>Then you need to create a symbolic link which is<\/p>\n<pre class=\"lang:sh decode:true\">#ln -s openssl-1.0.0.cnf openssl.cnf<\/pre>\n<p>Note: this may change in future versions. There are some suggestions that this is caused by running source .\/vars before .\/build-ca but the current documentation is fairly unclear on this.<\/p>\n<p>The Certificate Authority is now set up but we still have to build the key for the server<\/p>\n<p>Type hostname to get the name of your server<\/p>\n<pre class=\"lang:sh decode:true\">#hostname<\/pre>\n<p>If you do not get a proper name or it just returns \u201clocalhost\u201d then check your \/etc\/hosts file for errors.<\/p>\n<pre class=\"lang:sh decode:true\">#.\/build-key-server OpenvpnServer<\/pre>\n<p>NOTE: The name here needs to be the same as the name under the X509 stanza in the vars file.<\/p>\n<p>You will be asked several questions; when you get to <strong>Common Name<\/strong>, you need to type in the name of your server. Do the same for Name.<\/p>\n<p>When you get to <strong>password<\/strong> just press &lt;enter&gt; and do the same for <strong>company name<\/strong>. The CA will now ask you if you want it to sign the certificate. Press y followed by &lt;enter&gt;. If all is well it should say<\/p>\n<p style=\"padding-left: 40px;\">1 out of 1 certificate requests certified, commit? [y\/n]<\/p>\n<p>Again press \u201cy\u201d followd by &lt;enter&gt; and the CA should respond with the following 2 lines<\/p>\n<p style=\"padding-left: 40px;\">Write out database with 1 new entries<\/p>\n<p style=\"padding-left: 40px;\">Data Base Updated<\/p>\n<p>You now have a certificate for your server. The next thing to so is to copy your certificate and keys to the correct directory.<\/p>\n<pre class=\"lang:sh decode:true \">#cp \/etc\/openvpn\/easy-rsa\/keys\/{OpenvpnServer.crt,OpenvpnServer.key,ca.crt} \/etc\/openvpn<\/pre>\n<p>You can verify the copy was successful with:<\/p>\n<pre class=\"lang:sh decode:true\">#ls \/etc\/openvpn<\/pre>\n<p>We will leave easy-rsa for now and configure the openvpn server however we will need to revisit easy-rsa when we generate the certificates for our clients.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Openvpn Server Configuration<\/strong><\/p>\n<p>\/etc\/openvpn\/server.conf is where the configuration is set for the openvpn server. This file does not exist by default and needs to unzipped and copied from the sample config files. You could of course write your own, it is entirely up to you.<\/p>\n<p>For the purpose of this exercise we are going to assume that the server has a LAN IP address of 172.17.1.16 and the server is behind a NAT. The subnet is 255.255.0.0 and the local dns servers are 172.17.1.4 and 172.17.1.3<\/p>\n<pre class=\"lang:sh decode:true\">#gunzip -c \/usr\/share\/doc\/openvpn\/examples\/sample-config-files\/server.conf.gz &gt; \/etc\/openvpn\/server.conf\r\n#vi \/etc\/openvpn\/server.conf<\/pre>\n<p>The following directive are the important ones<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">port 1194\r\nproto tcp\r\ndev tun\r\nca ca.crt\r\ncert OpenvpnServer.crt\r\nkey OpenvpnServer.key\r\ndh dh4096.pem\r\nserver 10.8.0.0 255.255.255.0\r\nifconfig-pool-persist ipp.txt\r\npush \"route 172.17.0.0 255.255.0.0\"\r\nclient-config-dir ccd\r\npush \"dhcp-option DNS 172.17.1.4\"\r\npush \"dhcp-option DNS 172.17.1.3\"\r\nclient-to-client\r\nuser nobody\r\ngroup nogroup\r\nkeepalive 10 120\r\n**comp-lzo**\r\npersist-key\r\npersist-tun\r\nstatus openvpn-status.log\r\nlog-append \/var\/log\/openvpn.log\r\nverb 4<\/pre>\n<p>Don\u2019t use <strong>comp-lzo<\/strong> on the later versions (Debian stretch) use <strong>compress lz4-v2<\/strong> This will also need to be changed in the client config.<\/p>\n<p><strong>port<\/strong>, <strong>proto<\/strong> and <strong>dev<\/strong> should already be set as default as should <strong>ca<\/strong>. You will need to set <strong>cert<\/strong> and <strong>key<\/strong> correctly and change <strong>dh<\/strong> from<\/p>\n<p style=\"padding-left: 40px;\">dh1024.pem<\/p>\n<p style=\"padding-left: 40px;\">to<\/p>\n<p style=\"padding-left: 40px;\">dh4096.pem<\/p>\n<p><strong>server<\/strong> should be fine at <strong>10.8.0.0<\/strong> unless you have any special networking requirements such as a conflict with an existing network. <strong>ifconfig-pool-persist<\/strong> should also already be set. You will need to add the line<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">push \"route 172.17.0.0 255.255.0.0\"<\/pre>\n<p>or uncomment one of the existing examples and set it according to your configuration.<\/p>\n<p>Now uncomment<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">client-config-dir ccd<\/pre>\n<p>Next amend the DNS directives by uncommenting them and changing them to point to the appropriate DNS servers.<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">push \"dhcp-option DNS 172.17.1.4\"\r\npush \"dhcp-option DNS 172.17.1.3\"<\/pre>\n<p>and uncomment <strong>client-to-client<\/strong>. <strong>keepalive<\/strong> should be ok as it is, as should <strong>comp<\/strong>. For added security you will need to uncomment to <strong>user<\/strong> and <strong>group<\/strong> directives to prevent openvpn from running as root.<\/p>\n<p>persist-tun and persist-key should be fine as they are, as should status. Uncomment <strong>log-append<\/strong> and change verbosity from <strong>verb 3<\/strong> to <strong>verb 4<\/strong> and you should be done.<\/p>\n<p>Newer tunnelblick clients will generate a warning if you use an insecure cipher so you have to comment out any existing ciphers and add<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">cipher AES-256-CBC<\/pre>\n<p>Additionally later versions have the following directive<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">explicit-exit-notify 1<\/pre>\n<p>This needs to be commented out if you are using <strong>proto tcp<\/strong> as it only works with udp<\/p>\n<p>Save and exit server.conf and run<\/p>\n<pre class=\"lang:sh decode:true \">#openvpn --genkey --secret \/etc\/openvpn\/ta.key<\/pre>\n<p>to generate the ta.key<\/p>\n<p>The last thing to do is make a directory called ccd in \/etc\/openvpn<\/p>\n<pre class=\"lang:sh decode:true\">#mkdir \/etc\/openvpn\/ccd<\/pre>\n<p>Forgetting to do this will cause the openvpn service to appear to be running but when it isn\u2019t<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Routing tables<\/strong><\/p>\n<p>Before we start openvpn we need to tell our server what to do with incoming traffic. First we need to enable packet forwarding. Enter the following command<\/p>\n<pre class=\"lang:sh decode:true\">#echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward<\/pre>\n<p>You should now have a file that simply has a 1 in it<\/p>\n<pre class=\"lang:sh decode:true\">#cat \/proc\/sys\/net\/ipv4\/ip_forward<\/pre>\n<p>Next, we&#8217;ll need to make this permanent so that this setting persists after a server reboot. Open the <strong>sysctl<\/strong> configuration file<\/p>\n<pre class=\"lang:sh decode:true\">#vi \/etc\/sysctl.conf<\/pre>\n<p>Near the top of the sysctl file, you will see:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">#Uncomment the next line to enable packet forwarding for IPv4\r\n#net.ipv4.ip_forward=1<\/pre>\n<p>Uncomment net.ipv4.ip_forward as suggested, save the file and exit.<\/p>\n<p>Assuming that you have left the default configuration for the VPN subnet as it is at 10.8.0.0 255.255.255.0 in the server.conf i.e.<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">server 10.8.0.0 255.255.255.0<\/pre>\n<p>Then you need to run the following line from the command line in order to tell the server what to do with traffic coming from the VPN subnet<\/p>\n<pre class=\"lang:sh decode:true\">#iptables -t nat -A POSTROUTING -s 10.8.0.0\/24 -o eth0 -j MASQUERADE<\/pre>\n<p>Again here, we are assuming here that the Ethernet port that you are using is eth0. If there is more than one network card in your machine then you need to make sure you are configuring the correct one, but usually it is <strong>eth0 <\/strong>(Be careful with some HP\u2019s that have crazy names for their Ethernet ports). Before you start run <strong>ifconfig<\/strong> to check this.<\/p>\n<p>Iptables is not persistent across reboots but once you have it configured correctly, there\u2019s an app for that:<\/p>\n<pre class=\"lang:sh decode:true\">#apt-get install iptables-persistent<\/pre>\n<p>And follow the instructions on screen. Iptables saves the configuration in \/etc\/iptables\/rules.v4 and rules.v6 respectively.<\/p>\n<p>Congratulations, you should now have a working openvpn server. Make sure that you open port <strong>1194<\/strong> for udp on your router and point it to your server. Start your server in the usual way by running<\/p>\n<pre class=\"lang:sh decode:true \">#service openvpn start<\/pre>\n<p>and check that it is running with<\/p>\n<pre class=\"lang:sh decode:true \">#service openvpn status<\/pre>\n<p>Note that openvpn will appear as though it is started and running when it isn\u2019t; see troubleshooting below to see how to make sure you have a live server.<\/p>\n<p>The big problem that you have at this stage is that although you have a nice vpn server, your clients will not be able to connect to it. In order to get the clients connecting you will need to go back to easy-rsa and generate some client certificates<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Bind 9<\/strong><\/p>\n<p>If you are using the later versions of bind 9 for dns lookups then you will have to allow the subnet that you have set for your vpn to perform recursive lookups.<\/p>\n<p>Once you have connected to the vpn you should be able to access any devices on the remote network using their ordinary host names. If you cannot do this, but you can access them by IP then chances are this is the problem.<\/p>\n<p>To resolve it you first need to create an access control list.<\/p>\n<pre class=\"lang:sh decode:true \">#vi \/etc\/bind\/named.conf.options<\/pre>\n<p>Here we are making assumptions that the remote lan is using 172.17.0.0\/16 the local lan is using 172.18.0.0\/16 and the bridge is using 10.8.1.0\/24 and thus the access control list stanza should look like so:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">acl \"trusted\" {\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 172.18.0.0\/16;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 172.17.0.0\/16;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 10.8.1.0\/24;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 localhost;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 localnets;\r\n};<\/pre>\n<p>Now under the \u201coptions\u201d stanza we can tell bind that we want to allow machines in the \u201ctrusted\u201d acl to use queries and recursion.<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">options {\r\n    ....\r\n    recursion yes;\r\n    allow-query { trusted; };\r\n    allow-recursion { trusted; };\r\n    allow-query-cache { trusted; };\r\n    \u2026.\r\n}<\/pre>\n<p>Now we can restart bind and we should be able to perform lookups on the dns server.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Connecting Clients<\/strong><\/p>\n<p>There are 4 files needed for each client ca.crt; an openvpn client configuration file; and the client certificate files.<\/p>\n<p>First we will grab a copy of the default client.ovpn file and rename it as we copy it. Note that the naming convention is important here as the name of the file must match the name of the client machine<strong>. <\/strong>In this example we are going to assume that the client machine is called \u201c<strong>mypc<\/strong>\u201d. First run<\/p>\n<pre class=\"lang:sh decode:true\">#cp \/usr\/share\/doc\/openvpn\/examples\/sample-config-files\/client.conf \/etc\/openvpn\/easy-rsa\/keys\/mypc.ovpn<\/pre>\n<p>Remember to change <strong>ovpn<\/strong> to the name of your pc suffixed by \u201c.ovpn\u201d<\/p>\n<p>Now we need to edit the file we have just created.<\/p>\n<pre class=\"lang:sh decode:true \">#vi \/etc\/openvpn\/easy-rsa\/keys\/mypc.ovpn<\/pre>\n<p>Change the <strong>remote<\/strong> directive to reflect the public ip address of your server (If you are behind a NAT then this will be your static ip address assigned by your ISP). If you do not know it then google \u201cWhat is my ip\u201d<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">remote XXX.XXX.XXX.XXX 1194<\/pre>\n<p>Next you will need to change the certificate names to reflect the ones that you are about to generate. In this example they will be called <strong>crt<\/strong> and <strong>mypc.key<\/strong>.<\/p>\n<pre class=\"lang:sh highlight:0 decode:true \">cert mycp.crt\r\nkey mypc.key<\/pre>\n<p>change <strong>verb<\/strong> to <strong>4<\/strong> and add<\/p>\n<p>log-append \/var\/log\/vpnclient.log<\/p>\n<p><strong>ns-cert-type<\/strong> has now been depreciated so this should be commented out and replaced with<\/p>\n<pre class=\"lang:sh decode:true\">remote-cert-tls server<\/pre>\n<p>Although not strictly necessary you can add<\/p>\n<pre class=\"lang:sh highlight:0 decode:true \">auth-nocache<\/pre>\n<p>to the client file; This will prevent the client from caching passwords.<\/p>\n<p>You will also need to set the cipher to match that in the server configuration file (i.e. AES-256) by inserting the line<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">cipher AES-256-CBC<\/pre>\n<p>and commenting out any other cipher declarations<\/p>\n<p>As mentioned previously <strong>comp-lzo<\/strong> is in the process of being depreciated in favour of compress lz4-v2 for later servers you need to add this directive to the client file and comment out any reference to comp-lzo<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">compress lz4-v2<\/pre>\n<p>If this configuration is for a linux client then uncomment <strong>user<\/strong> and <strong>group<\/strong> directives which should be set to nobody; otherwise you are done.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>OPTIONAL:<\/strong><\/p>\n<p>There is a directive that ensures that all traffic is routed through the server (which is great for security but slow as fuck so only really useful as when you are using a public network and cannot get the access that you need).<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">redirect-gateway def1 bypass-dhcp<\/pre>\n<p>This directive is only well suited for roaming computers such as laptops and phones so what I would suggest is to create a second .ovpn file and only use it when necessary.<\/p>\n<p>If you want to make sure that all traffic is routed through the vpn then you can push the directive from the server.<\/p>\n<p>Now to generate the certificates. Navigate to the easy-rsa directory<\/p>\n<pre class=\"lang:sh decode:true \">#cd \/etc\/openvpn\/easy-rsa<\/pre>\n<p>and run the following command to generate the keys (changing mypc to the name of your client box)<\/p>\n<pre class=\"lang:sh decode:true\">#.\/build-key mypc<\/pre>\n<p>You will be presented with a series of questions, just press &lt;enter&gt; as the defaults should be fine as long as you have given the certificate a unique name should it be necessary to reference it in the ccd directory. You may want change the name to the same as the common name, but this is not strictly necessary. (note, sometimes you will have to source the vars file again by running <strong>source .\/vars<\/strong>, not sure why). When asked to sign the certificate answer \u201cy\u201d and the same with commit.<\/p>\n<p>The next thing you need to do is copy the following files into a folder and put them on your client.<\/p>\n<p style=\"padding-left: 40px;\">\/etc\/openvpn\/ca.crt<\/p>\n<p style=\"padding-left: 40px;\">\/etc\/openvpn\/ta.key<\/p>\n<p style=\"padding-left: 40px;\">\/etc\/openvpn\/rsa-keys\/mypc.crt<\/p>\n<p style=\"padding-left: 40px;\">\/etc\/openvpn\/rsa-keys\/mypc.key<\/p>\n<p style=\"padding-left: 40px;\">\/etc\/openvpn\/rsa-keys\/mypc.ovpn<\/p>\n<p>Note that the prefix of the file names will be the name of your client.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Tunnelblick<\/strong><\/p>\n<p>Tunnelblick is the openvpn client for mac. It does not play nice if you are using a static ip address and are using either<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">dhcp-option DNS xxx.xxx.xxx.xxx<\/pre>\n<p>Set in the *.ovpn file on the client or the push equivalent set in the server\u2019s conf file.<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">push \u201cdhcp-option DNS xxx.xxx.xxx.xxx\u201d<\/pre>\n<p>To get around this you will need to set dhcp or add the dns server to the list. The problem with the latter is that it will slow your computer down when you are not connected to the vpn because it will have to wait until the lookup times out trying to access a server that it thinks has died.<\/p>\n<p>If you need a static ip on your client then the best way is to bind it to you client\u2019s mac address using your router. How to do this is beyond the scope of this manual as it is entirely dependent what router you are using.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Troubleshooting<\/strong><\/p>\n<p>nmap is your friend. With the openvpn service up and running run<\/p>\n<pre class=\"lang:sh decode:true\">#nmap -p 1194 -sU -PO xxx.xxx.xxx.xxx<\/pre>\n<p>note \u2013p is the port number, -sU tells nmap it is looking at a udp port and \u2013PO is the flag for the ip address of the interface. The output should look something like<\/p>\n<p style=\"padding-left: 40px;\">Starting Nmap 6.47 ( http:\/\/nmap.org ) at 2016-04-07 09:46 BST<\/p>\n<p style=\"padding-left: 40px;\">Nmap scan report for fqdn.suffix (xxx.xxx.xxx.xxx)<\/p>\n<p style=\"padding-left: 40px;\">Host is up.<\/p>\n<p style=\"padding-left: 40px;\">PORT\u00a0\u00a0\u00a0\u00a0 STATE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SERVICE<\/p>\n<p style=\"padding-left: 40px;\">1194\/udp open|filtered openvpn<\/p>\n<p>If it says closed then this will need to be resolved before you go any further. If the status of the service is \u201cactive\u201d but the port is closed then check that you have created the ccd directory.<\/p>\n<p>On another server I hand to stop the service (even though it wasn\u2019t actually running) and they run systemctl enable openvpn followed by systemctl start openvpn and then it worked. I found this out by running openvpn from the command line<\/p>\n<p>Also try netstat which should tell you what ip and protocol openvpn is listening on<\/p>\n<pre class=\"lang:sh decode:true\">#netstat -uapn | grep openvpn<\/pre>\n<p>Check that it is using the udp port and that the ip address that the port is using is correct. If not then you will need to set the <strong>local<\/strong> directive in the <strong>conf<\/strong> file.<\/p>\n<p>Check the log for errors at <strong>\/var\/log\/openvpn.log<\/strong><\/p>\n<p>Check that you have a <strong>tun0<\/strong> interface by running <strong>ifconfig<\/strong><\/p>\n<p>If all else fails then temporarily change to <strong>tcp<\/strong> by changing the <strong>proto<\/strong> directive in server.conf. Restart the service and then try and telnet to it.<\/p>\n<p>If you can create a tunnel but cannot connect to clients then check the iptables. In particular<\/p>\n<pre class=\"lang:sh decode:true\">#iptables \u2013t nat --list<\/pre>\n<p>should return something like<\/p>\n<p style=\"padding-left: 40px;\">0\u00a0\u00a0\u00a0\u00a0 0 MASQUERADE all &#8212; *\u00a0\u00a0\u00a0\u00a0 eth0\u00a0\u00a0 10.8.0.0\/24\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 0.0.0.0\/0<\/p>\n<p>If not then run<\/p>\n<pre class=\"lang:sh decode:true\">#iptables -t nat -A POSTROUTING -s 10.8.0.0\/24 -o eth0 -j MASQUERADE<\/pre>\n<p>The flags are:<\/p>\n<p style=\"padding-left: 40px;\">-t = table name<\/p>\n<p style=\"padding-left: 40px;\">-A = append<\/p>\n<p style=\"padding-left: 40px;\">-s = source address\/mask<\/p>\n<p style=\"padding-left: 40px;\">-o = output interface (use [+] for wildcard)<\/p>\n<p style=\"padding-left: 40px;\">-j = target<\/p>\n<p>If you have a couple of vpn servers that may at some point end up talking to each other then you might want to make sure that you put their internal addresses on different subnets (Say 10.8.1.0\/24 for the second one for example).<\/p>\n<p>To delete a record replace the \u2013A flag with a \u2013D flag<\/p>\n<pre class=\"lang:sh decode:true\">#iptables -t nat -D POSTROUTING -s 10.8.0.0\/24 -o eth0 -j MASQUERADE<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Installation With point to point tunneling protocol VPN\u2019s depreciated because of security issues we are now not even bothering to install pptp at all and are instead opting for openvpn. For the installation you are going to want 2 applications, openvpn and easy-rsa. #apt-get install openvpn easy-rsa &nbsp; Build and configure the certificate authority OpenVPN [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-154","post","type-post","status-publish","format-standard","hentry","category-debian-server"],"_links":{"self":[{"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=154"}],"version-history":[{"count":1,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":155,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/posts\/154\/revisions\/155"}],"wp:attachment":[{"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}