How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (2024)

Learn how to create and configure a self-hosted or a cloud VPN server using Meshnet.

Introduction

Whether you want to keep your online activity private by hiding your IP or protect your traffic by encrypting your internet connection, creating your own VPN server can be a solution to address these needs.

Setting up a VPN server requires a good understanding of network security. Therefore, it’s always a good idea to seek assistance from cybersecurity professionals. Still, by incorporating Meshnet into the process, you can configure your VPN server quickly, even if you have no prior experience.

Watch this video tutorial that will walk you through the process of setting up a VPN server using Meshnet and DigitalOcean, or scroll down for a written guide.

When you create your own VPN server, you have several options for how to set it up, including:

  • Hosting it on your own computer

  • Renting a cloud server

This guide describes both methods and shows how Meshnet’s routing infrastructure is used as a component of your VPN.

Note

Be aware that by setting up your own VPN server, you increase your online privacy but not to the same extent as when connecting to a regular VPN server provided by NordVPN, which follows a strict no-logs policy.

Using your own device as a VPN server

Creating your own VPN server at home can provide you with a secure and convenient way to access your home network.

Meshnet has an integrated routing traffic feature that allows you to set up one of your devices to act as a VPN server without additional software. To learn more about the feature and its capabilities, see Routing traffic in Meshnet.

Before you begin

Here are a few things to consider before you start setting up a VPN server for personal use:

  • Choose a device that is turned on all the time and has a reliable power source to prevent crashes and downtime.

  • Make sure that the device is capable of forwarding network traffic. Meshnet allows routing traffic through devices that run the following platforms:

    • Windows 10 (64-bit) and Windows 11

    • macOS Catalina (Version 10.15) and later

    • Linux

Note

Routing traffic through mobile devices is not available.

Set up a VPN server

  1. On the device you’ve chosen to serve as a VPN host, install NordVPN.

  2. Log in to your account and turn on Meshnet.

  3. Link devices to Meshnet by enabling Meshnet on your other devices or by sending invitations to other NordVPN users.

  4. Ensure your traffic routing permissions and local network permissions are enabled for each client device.How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (1)

Caution

To ensure the security of your home network and the devices inside it, we highly recommend enabling the local network permission only for devices that you have the utmost confidence in.

Connect to your VPN server

Once your home VPN server is set up, you can use any device connected to your Meshnet as a VPN client. To do this:

  1. On your client device, log in to your NordVPN account.

  2. Start routing traffic through the linked host device you set up. For specific instructions, see the Routing traffic in Meshnet article.

Now you can access other devices on your home network by their local IP address. This requires you to know the IP address of each device.

Set up a VPN server in the cloud

Because you can rent a server in a country of your choice, setting up a VPN server in the cloud gives you the ability to access content that might otherwise be restricted in your region.

Choose a cloud service provider

To set up a VPN server on a cloud service platform, first, choose a cloud service provider. Most cloud platforms charge a monthly subscription fee. However, some also offer a free version, like Amazon Web Services or Microsoft Azure.

Note

If you choose to rent a cloud server for your VPN, keep in mind that most cloud server providers can disclose your personal information to authorities if they are required to do so by law.

Create a virtual machine on the cloud platform

For the purposes of this guide, DigitalOcean Droplets will be used to show how to configure a virtual machine (VM). The exact steps you need to follow will depend on the cloud service platform you’ve chosen.

Droplets are Linux-based VMs provided by DigitalOcean. They allow you to create and manage virtual servers for your needs.

  1. Sign up for DigitalOcean and log in to your account.

  2. Create a VM by clicking Create and selecting Droplets.

  3. Select the region where you want your server to be located.

  4. Choose an operating system (for example, Ubuntu).

  5. Choose a plan and size for your VM.

  6. Add an SSH key following the instructions provided on the page (recommended) or create a password for the VM.

  7. In the Hostname box, enter a name for your VM and click Create.

Connect to the virtual machine

Once your server is up and running, you can log in to it using your SSH key or password based on the authentication method you’ve selected.

  1. Open Terminal (on Linux and macOS) or Command prompt (on Windows).

  2. If you chose the Password option upon Droplet creation, follow these steps:

    1. Enter the ssh root@<droplet_ip> command, replacing <droplet_ip> with the IP address of your VM. You can find your VM’s IP address at DigitalOcean Control Panel.Example

      ssh root@46.101.233.23
    2. When asked if you’re sure you want to continue connecting, type yes.

    3. Enter the password you created for your droplet.

  3. If you chose Add SSH keys:

    1. Enter the ssh -i </path/to/private/key> username@<droplet_ip> command, specifying the path of your private key in place of </path/to/private/key> and substituting <droplet_ip> with the IP address of your Droplet.Example

      ssh -i /Users/MeshnetUser/ssh_key.txt root@64.227.156.106
    2. When asked if you’re sure you want to continue connecting, type yes.

    3. Enter the passphrase for your key pair.

      How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (2)

Note

The latest builds of Windows 10 and Windows 11 include a built-in SSH client. Alternatively, you can use a third-party terminal emulator for Windows, such as Putty.

Install NordVPN on the virtual machine

Follow these steps to set up NordVPN on the virtual machine you created:

  1. Download and install the NordVPN Linux client by entering the command below.

    sh <(wget -qO - https://downloads.nordcdn.com/apps/linux/install.sh)
  2. Log in to your NordVPN account.

Log in to NordVPN

You can log in to your NordVPN account without the use of a graphical user interface (GUI) in two ways:

  • By running the nordvpn login command with the --token flag

  • By running the nordvpn login command with the --callback flag

Instructions for both methods are outlined below.

Log in using a token
  1. On any device, log in to your Nord Account dashboard and select the Meshnet (by NordVPN) card.

    How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (3)

  2. Under Manual setup, select Set up NordVPN manually.

    How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (4)

  3. Enter the verification code sent to your email address.

  4. Under Access token, click Generate new token.

    How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (5)

  5. In the dialog that appears, choose either a token that expires in 30 days or one that never expires, and then select Generate token.

    How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (6)

  6. Select Copy and close.

  7. On your virtual machine, run the nordvpn login --token <your_token> command, replacing <your_token> with the copied token.Example

    nordvpn login --token 3fe460cefb8dcf1478c92e45903cec9f9bdbadf7a456a6dfb35dc2c58ee39d5b

You should now see a welcome message.

Log in using a URL
  1. Run the following command:

    nordvpn login
  2. Open the provided link on any device in your browser.

  3. Complete the login procedure.

  4. Right-click the Continue button and select Copy link address.

  5. Run the nordvpn login --callback "<URL>" command, replacing <URL> with the previously copied link address.Example

    nordvpn login --callback "nordvpn://login?action=login&exchange_token=MGFlY2E1NmE4YjM2NDM4NjUzN2VjOWIzYWM3ZTU3ZDliNDdiNzRjZTMwMjE5YjkzZTNhNTI3ZWZlOTIwMGJlOQ%3D%3D&status=done"

You should now see a welcome message.

Tip

To preserve your token when logging out of the NordVPN app, use the nordvpn logout --persist-token command. Otherwise, your token will be revoked.

Note

If you encounter the error message “Whoops! Permission denied accessing /run/nordvpn/nordvpnd.sock,” enter sudo usermod -aG nordvpn $USER. Then, reboot your instance and log back in.

Enable Meshnet

On your VM, enable Meshnet by typing this command:

nordvpn set meshnet on

To view the Nord name and Meshnet IP address of your VM, enter the following command.

nordvpn meshnet peer list

Example

How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (7)

You will also see all your connected Meshnet devices, which have the potential to access this server, depending on their permissions.

Grant the traffic routing permission

To begin using the VPN server, you need to grant the traffic routing permission for each peer device that you want to have access to the server. Enable this permission from the server machine using the following command:

nordvpn meshnet peer routing allow <device>

Example

nordvpn meshnet peer routing allow secret.raccoon-everest.nord

For more information, see the Traffic routing permissions page.

Route traffic through your server

Your client devices should now be able to connect to the server. To do this, start routing traffic through the VM you set up, which you can now find among your Meshnet peer devices.

How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (8)

For specific instructions, see the Routing traffic in Meshnet article.

Your device's IP address should now match the public IP address of your instance. This way, your real IP address remains secure, and the websites you visit will detect the location of your VPN server instead of your actual device.

How to set up a VPN server through self-hosting or with DigitalOcean | Meshnet docs (2024)

FAQs

How do I create a self-hosted VPN server? ›

To set up your home router as a VPN server:
  1. Open up your preferred browser.
  2. Enter your router's LAN (internal) IP address into the search bar. ...
  3. Enter the router's username and password. ...
  4. Go into Settings (or Advanced Settings) > VPN Service.
  5. Enable the VPN Service.
Jul 30, 2024

Can I host my own VPN server? ›

Setting Up Your Own VPN Server

Creating a VPN at home requires time, technical knowledge, and a bit of elbow grease, but the result is a highly personalized and controlled online experience. You can tailor every aspect of a custom VPN, from choosing the security protocols to setting up the network configurations.

Can I use DigitalOcean as VPN? ›

Yes, DigitalOcean's VPN is suitable for teams and businesses. You can create multiple user accounts, manage access levels, and scale resources based on your organization's needs, helping to provide a secure and private network for your team members.

How to set up a VPN server? ›

Steps for setting up a VPN
  1. Step 1: Line up key VPN components. ...
  2. Step 2: Prep devices. ...
  3. Step 3: Download and install VPN clients. ...
  4. Step 4: Find a setup tutorial. ...
  5. Step 5: Log in to the VPN. ...
  6. Step 6: Choose VPN protocols. ...
  7. Step 7: Troubleshoot. ...
  8. Step 8: Fine-tune the connection.

Is OpenVPN self-hosted? ›

Our self-hosted solution and cloud-delivered service include the essential security controls needed to evolve from a trusted-perimeter security model to an identity-based ZTNA approach. Whether you're trying to access private resources, SaaS apps, or the internet – OpenVPN delivers remote access easily and securely.

What does a self-hosted VPN do? ›

Self Hosted VPNs

It grants you unshared access to the server's resources, inclusive of its entire bandwidth.

How do I turn my computer into a VPN server? ›

Create a VPN profile
  1. Select Start > Settings > Network & internet > VPN > Add VPN.
  2. Under Add a VPN connection, do the following: For VPN provider, choose Windows (built-in). In the Connection name box, enter a name you'll recognize (for example, My Personal VPN). ...
  3. Select Save.

How do I create an OpenVPN server? ›

The purpose of this article is to provide the know-how needed to configure a working OpenVPN server on a Windows PC.
  1. Step 1: installing OpenVPN software. ...
  2. Step 2: preparing EasyRSA. ...
  3. Step 3: generating certificates and keys. ...
  4. Step 4: OpenVPN server configuration. ...
  5. Step 5: configuring clients. ...
  6. Step 6: launching the server.

How much does it cost to host a VPN? ›

A VPN can cost anywhere from $2 to $12 per month depending on your requirements and budget constraints. Typically the costs reduce drastically when you opt for long-term plans.

Does DigitalOcean have their own servers? ›

DigitalOcean provides robust infrastructure and reliable network connectivity to businesses around the globe, with 15 distributed data centers in nine regions.

Can I host my website on DigitalOcean for free? ›

DigitalOcean's App Platform provides you with hosting for 3 static sites for free, and our Basic plan starts at $5 a month.

What is the legal address for DigitalOcean? ›

DigitalOcean's address for notice is: DigitalOcean, LLC, ATTN: Legal, 101 Avenue of the Americas, 10th Floor, New York, NY 10013 USA.

Where to host a VPN server? ›

Select a cloud service provider: Choose a cloud service provider that supports VPN server deployments, such as Amazon Web Services (AWS), Google Cloud Platform (GCP), or Microsoft Azure. These providers offer robust infrastructure and scalability options.

What is best server for VPN? ›

Switzerland, Iceland, Estonia, Canada, Singapore, Spain, the UK, Panama, Romania, and Germany are considered the best countries for VPN server locations due to strong privacy laws, advanced internet infrastructure, and minimal content restrictions.

What is the difference between a VPN and a VPN server? ›

If you had a job that required you to be on the road a lot, but you still needed to access your work PC remotely in an office, then you would want a VPN server. A VPN server is nothing more than a software program than runs on your office PC 24 hours a day, waiting for you (the VPN client) to connect to it remotely.

How do I make my computer a VPN server? ›

Create a VPN profile
  1. Select Start > Settings > Network & internet > VPN > Add VPN.
  2. Under Add a VPN connection, do the following: For VPN provider, choose Windows (built-in). In the Connection name box, enter a name you'll recognize (for example, My Personal VPN). ...
  3. Select Save.

How do I setup a virtual private network VPN? ›

  1. Open your device's Settings app.
  2. Tap Network & internet. VPN. If you can't find it, search for "VPN." If you still can't find it, get help from your device manufacturer.
  3. Tap the VPN you want.
  4. Enter your username and password.
  5. Tap Connect. If you use a VPN app, the app opens.

Top Articles
Limitations of Financial Analysis: Financial Analysis Example
Reports: 2024 Pay Increases Projected to Exceed Inflation | WorldatWork
Nullreferenceexception 7 Days To Die
Form V/Legends
13 Easy Ways to Get Level 99 in Every Skill on RuneScape (F2P)
Readyset Ochsner.org
Shorthand: The Write Way to Speed Up Communication
Is Sportsurge Safe and Legal in 2024? Any Alternatives?
Zitobox 5000 Free Coins 2023
W303 Tarkov
Classic Lotto Payout Calculator
Used Drum Kits Ebay
Alexandria Van Starrenburg
iOS 18 Hadir, Tapi Mana Fitur AI Apple?
Maplestar Kemono
Conan Exiles Colored Crystal
Fdny Business
Urban Dictionary: hungolomghononoloughongous
Nhl Tankathon Mock Draft
Accident On The 210 Freeway Today
Rust Belt Revival Auctions
Disputes over ESPN, Disney and DirecTV go to the heart of TV's existential problems
Sandals Travel Agent Login
Telegram Voyeur
Criterion Dryer Review
What Is a Yurt Tent?
Leben in Japan &#8211; das muss man wissen - Lernen Sie Sprachen online bei italki
A Man Called Otto Showtimes Near Carolina Mall Cinema
Valley Craigslist
Proto Ultima Exoplating
Vip Lounge Odu
Tamil Play.com
Moxfield Deck Builder
Santa Cruz California Craigslist
Metro By T Mobile Sign In
Kgirls Seattle
Magicseaweed Capitola
Tunica Inmate Roster Release
US-amerikanisches Fernsehen 2023 in Deutschland schauen
Umd Men's Basketball Duluth
Dragon Ball Super Super Hero 123Movies
Yakini Q Sj Photos
M&T Bank
Gas Buddy Il
Europa Universalis 4: Army Composition Guide
Meet Robert Oppenheimer, the destroyer of worlds
Arginina - co to jest, właściwości, zastosowanie oraz przeciwwskazania
Ihop Deliver
What Time Do Papa John's Pizza Close
Wild Fork Foods Login
Wieting Funeral Home '' Obituaries
Kenmore Coldspot Model 106 Light Bulb Replacement
Latest Posts
Article information

Author: Greg O'Connell

Last Updated:

Views: 5769

Rating: 4.1 / 5 (42 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Greg O'Connell

Birthday: 1992-01-10

Address: Suite 517 2436 Jefferey Pass, Shanitaside, UT 27519

Phone: +2614651609714

Job: Education Developer

Hobby: Cooking, Gambling, Pottery, Shooting, Baseball, Singing, Snowboarding

Introduction: My name is Greg O'Connell, I am a delightful, colorful, talented, kind, lively, modern, tender person who loves writing and wants to share my knowledge and understanding with you.