Deploy your private VPN service on Linode. Full automation and rapid deployment.
This project uses Terraform to fully automate the deployment of the hwdsl2/setup-ipsec-vpn VPN project on Linode. Run your self-hosted IPSec VPN service with one click.
You need the following to deploy your own VPN service with this automation project:
- A Linode account;
- A Linode API key;
- Terraform installed on your PC/Mac;
- Basic knowledge of
git
; and - Basic knowledge of Terraform.
To deploy your VPN service, simply run the following commands:
-
Clone the repository:
git clone https://github.com/gszathmari/tfvpn.git
-
Change your working directory:
cd tfvpn/
-
Initialise Terraform before the first use:
terraform init
-
Edit the
terraform.tfvars
file to choose your favourite geographical region for your VPN service. -
Then run
terraform apply
to launch the hosting infrastructure:terraform apply
-
Enter your Linode API key when prompted.
-
Answer
yes
to confirm the deployment. If everything ran successfully, the Linode dashboard should display the virtual machine running our new VPN service. -
Once Terraform finishes the deployment of tfvpn, wait a minute or two and your VPN service is ready to accept new connections.
-
The VPN connection details are the following:
- IP address: Run
terraform show -json | jq -r .values.outputs.ipv4.value
to display. - Username: Fixed to vpnuser
- Password: Run
terraform show -json | jq -r .values.outputs.password.value
to display. - IPSec PSK: Run
terraform show -json | jq -r .values.outputs.psk.value
to display.
- IP address: Run
To configure Windows, Linux, macOS, iOS and Android clients, refer to the hwdsl2 client configuration guide. Use the connection parameters shown on the terminal screen from the previous step.
If your tfvpn VPN service is no longer needed, it is easy to delete everything with Terraform again:
-
Change your working directory:
cd tfvpn/
-
Run Terraform with the
destroy
parameter this time.terraform destroy
-
Enter the Linode API key and answer 'yes' to confirm the deletion of your hosting infrastructure.
Once Terraform manages to clean up the virtual machine, Linode should stop billing for the service.
- hwdsl2 for the VPN project and Linode StackScript