Launch your VPN using Docker under a minute

You might be wondering that having your own VPN is very hard to configure, we thought that too. You will be surprised to know that as long as you have af_key module.

 

af_key Module

You can check it by issuing following command

sudo modprobe af_key

If you see this kind of error, that means it isn’t present and you have to change your configuration:

modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/4.17.8-x86_64-linode110/modules.dep.bin'
modprobe: FATAL: Module af_key not found in directory /lib/modules/4.17.8-x86_64-linode110

You can try adding following to /etc/modules like and remote your server but it will not work if your kernel doesn’t support it.

af_key

Run a 5$/month Linode for your own VPN

If you have Linode, you can choose GRUB2 kernel to enable af_key as shown below.

docker-compose.yml for VPN

Following is the content of your docker-compose.yml


version: '3.2'
services:
  vpn:
    image: hwdsl2/ipsec-vpn-server
    restart: always
    hostname: localvpn
    privileged: true
    volumes:
        - "/etc/passwd:/etc/passwd:ro"
        - "/etc/group:/etc/group:ro"
        - "/lib/modules:/lib/modules:ro"
    ports:
        - "500:500/udp"
        - "4500:4500/udp"
    environment:
        - VPN_IPSEC_PSK=secret_code
        - VPN_USER=login_with_this_user
        - VPN_PASSWORD=login_with_this_password

Run VPN

docker-compose up -d

Now use above credentials to connect to your VPN and it should run without any issues.

 

Launch your VPN using Docker under a minute

17 thoughts on “Launch your VPN using Docker under a minute

  1. I am trying to set up vpn for my client in aws and we can’t connect to vpn on windows. It works only on iphone and android. Can you help?

  2. No logs your server I love this idea and it is so cheap. I can even use this in my machine and play watch netflix from anywhere in the world.

Leave a Reply to Sushil Kumar Cancel reply

Your email address will not be published. Required fields are marked *

Scroll to top