Configuring Pritunl VPN on Azure Virtual Machine for Home Network Connectivity
Pritunl is an open-source VPN solution that is widely used for secure remote access. In this article, we will discuss how to configure a Pritunl VPN server on an Azure Virtual Machine and connect it to your home network. By the end of this article, you will be able to access internal resources from your home network securely.
Prerequisites
- An Azure account with a virtual machine
- Pritunl VPN software
- Basic knowledge of networking and virtual machines
Step 1: Create a Virtual Machine on Azure
The first step is to create a virtual machine on Azure. You can use any operating system that is supported by Pritunl. In this example, we will use Ubuntu 18.04 LTS.
# Login to Azure
az login
# Create a resource group
az group create --name myResourceGroup --location eastus
# Create a virtual network
az network vnet create \
--name myVnet \
--resource-group myResourceGroup \
--location eastus \
--address-prefix 10.0.0.0/16 \
--subnet-name mySubnet \
--subnet-prefix 10.0.0.0/24
# Create a public IP address
az network public-ip create \
--name myPublicIP \
--resource-group myResourceGroup \
--location eastus \
--allocation-method static
# Create a network security group
az network nsg create \
--name myNSG \
--resource-group myResourceGroup \
--location eastus
# Create a network interface
az network nic create \
--name myNIC \
--resource-group myResourceGroup \
--location eastus \
--subnet mySubnet \
--vnet-name myVnet \
--public-ip-address myPublicIP \
--network-security-group myNSG
# Create a virtual machine
az vm create \
--name myVM \
--resource-group myResourceGroup \
--location eastus \
--image UbuntuLTS \
--size Standard_D2s_v3 \
--admin-username azureuser \
--generate-ssh-keys \
--nic myNIC
Step 2: Install Pritunl VPN
Once the virtual machine is created, you can install Pritunl VPN. You can download the software from the official website or use the following commands to install it on Ubuntu.
# Add the Pritunl repository
wget -q https://install.pritunl.com/download/linux/pritunl_1.2.2.111-0_amd64.deb
sudo dpkg -i pritunl_1.2.2.111-0_amd64.deb
# Start the Pritunl service
sudo systemctl start pritunl
sudo systemctl enable pritunl
Step 3: Configure Pritunl VPN
After installing Pritunl VPN, you need to configure it to connect to your home network. You can do this by adding a new server and configuring the network settings.
# Login to Pritunl
sudo pritunl server configure
# Add a new server
sudo pritunl server add
# Configure the network settings
sudo pritunl settings set \
--server-name myServer \
--server-tag myTag \
--vpn-protocol openvpn \
--openvpn-port 1194 \
--openvpn-proto udp \
--openvpn-cipher aes-256-cbc \
--openvpn-auth sha1 \
--dh-file /etc/openvpn/easy-rsa/keys/dh2048.pem \
--ca-file /etc/openvpn/easy-rsa/keys/ca.crt \
--server-cert /etc/openvpn/easy-rsa/keys/server.crt \
--server-key /etc/openvpn/easy-rsa/keys/server.key \
--tls-auth ta.key \
--topology subnet \
--server-bridge 10.0.0.1 255.255.255.0 10.0.0.128 10.0.0.254 \
--ifconfig-pool-persist ipp.txt \
--push-route 192.168.1.0 255.255.255.0 \
--push-dns 8.8.8.8 \
--push-dns 8.8.4.4 \
--keepalive 10 120 \
--cipher AES-256-CBC \
--user nobody \
--group nogroup \
--persist-key \
--persist-tun \
--status openvpn-status.log \
--verb 3
Step 4: Connect to Pritunl VPN
Once the Pritunl VPN is configured, you can connect to it from your home network. You can do this by creating an OpenVPN client configuration file and importing it into your OpenVPN client.
# Generate the client configuration file
sudo pritunl client export myUser --openvpn
# Import the client configuration file into your OpenVPN client
In this article, we have discussed how to configure a Pritunl VPN server on an Azure Virtual Machine and connect it to your home network. By following the steps outlined in this article, you will be able to access internal resources from your home network securely.