dronesim Docs
  • DRONESIM
  • Simulation setup
    • Accessing the simulation dashboard
    • Navigating the User Interface
  • Testing SITL without a transmitter or gamepad
  • Connecting to local apps
    • MAVProxy
    • Mission Planner
    • QGroundControl
  • Development tutorials
    • Forwarding MAVLink packets
    • Getting Started with MAVSDK and PX4
    • Getting Started with Pymavlink – Connecting to a Drone Simulator
  • Setting Up a VPN for UAS Projects Using ZeroTier
Powered by GitBook
On this page

Setting Up a VPN for UAS Projects Using ZeroTier

PreviousGetting Started with Pymavlink – Connecting to a Drone Simulator

Last updated 7 months ago

Blog Post:

When working on Unmanned Aerial Systems (UAS) projects, connectivity is often one of the most critical aspects, especially when you have multiple devices like Raspberry Pis, laptops, and ground control stations that need to communicate seamlessly. One reliable solution for this is setting up a VPN (Virtual Private Network) using ZeroTier, a user-friendly and flexible VPN solution that allows you to create secure, encrypted networks for your UAS components, regardless of where they are located.

In this post, we’ll guide you through the process of setting up ZeroTier to connect your UAS devices like Raspberry Pis, laptops, and ground control stations over a virtual private network, enabling secure, real-time communication.

If you are interested in routing MAVLink packets across these connected devices, be sure to also check out our previous blog post on Forwarding MAVLink Packets Using MAVLink Router.


Why Use ZeroTier for UAS Projects?

ZeroTier is a versatile VPN solution, ideal for UAS projects for several reasons:

  • Easy Setup: ZeroTier offers a simple installation and setup process with minimal configuration.

  • Cross-Platform: It supports various platforms, including Raspberry Pi (Linux), Windows, macOS, and mobile devices.

  • Remote Access: Devices can connect to the same virtual network from anywhere in the world, as long as they have internet access.

  • Encrypted and Secure: ZeroTier provides end-to-end encryption, ensuring that your telemetry and control data remain secure.

By connecting all your devices via ZeroTier, you can create a private and secure environment for sending telemetry data, issuing commands to your drone, and integrating your autopilot system.


Step 1: Create a ZeroTier Account and Network

The first step is to create a ZeroTier account and set up a network:

  1. Sign Up for ZeroTier: Visit the website and create an account (it’s free to start).

  2. Create a New Network:

    • Once you’re logged in, navigate to the "Networks" section and click Create a Network.

    • This will generate a unique Network ID for your virtual network.

  3. Configure the Network:

    • In the network configuration page, set your network to Private so that only devices you authorize can join.

    • You can also enable IPv4 auto-assign to ensure that all devices are automatically assigned an IP address within your virtual network.


Step 2: Install ZeroTier on Your Devices

Once your network is set up, the next step is to install ZeroTier on all your UAS devices (e.g., Raspberry Pis, laptops, and ground stations) that need to be connected to the VPN.

Installing ZeroTier on Raspberry Pi (Linux)

  1. Update Your Raspberry Pi: Before installing, ensure that your Raspberry Pi is up to date:

    sudo apt-get update
    sudo apt-get upgrade
  2. Install ZeroTier:

    Run the following commands to install ZeroTier:

    curl -s https://install.zerotier.com | sudo bash
  3. Join the ZeroTier Network:

    After installation, join your ZeroTier network by running:

    sudo zerotier-cli join <your_network_id>

    Replace <your_network_id> with the unique Network ID created in the previous step.

  4. Authorize the Device: Go back to your ZeroTier web dashboard, where you’ll see the Raspberry Pi’s ID listed under "Members." Check the box to authorize it, allowing the device to fully join the network.

Installing ZeroTier on Laptops (Windows/macOS/Linux)

  • Linux: For Linux-based laptops (like Ubuntu), you can follow the same steps as for Raspberry Pi, using the terminal commands to install ZeroTier.


Step 3: Testing the ZeroTier Network

Once all your devices have joined the ZeroTier network and have been authorized, they should be able to communicate with each other using their ZeroTier-assigned IP addresses. Here’s how to check if the network is functioning correctly:

  1. Check the Device IP Addresses:

    • On each device, run the following command to view the ZeroTier-assigned IP:

      zerotier-cli listnetworks
    • You’ll see the assigned IP under the Assigned Addresses section.

  2. Ping Between Devices:

    • Try pinging one device from another using the ZeroTier IP. For example, if your Raspberry Pi was assigned the address 192.168.192.100:

      ping 192.168.192.100

    If the devices are correctly connected, you should see successful ping responses, indicating that the VPN is functioning and the devices can communicate.


Step 4: Integrating with Your UAS Setup

With ZeroTier set up, all your UAS devices, such as your Raspberry Pi (acting as a companion computer), ground control station (GCS), and other laptops, are now on the same virtual network. This provides a secure and consistent environment for communicating telemetry data and controlling your drone.

Using ZeroTier with MAVLink Router

Now that your devices are connected via ZeroTier, you can start forwarding MAVLink packets across them. For example, if your Raspberry Pi is connected to your drone’s flight controller, you can use MAVLink Router to forward telemetry data to your laptop over ZeroTier.

On the Raspberry Pi, run MAVLink Router to forward data from a serial port (e.g., /dev/ttyUSB0) to your laptop’s ZeroTier IP:

mavlink-routerd /dev/ttyUSB0:115200 --endpoint <laptop_zerotier_ip>:14550

Replace <laptop_zerotier_ip> with the ZeroTier IP of your laptop or ground control station.

For more detailed instructions on how to set up MAVLink Router for UAS projects, check out our previous post on Forwarding MAVLink Packets Using MAVLink Router.


Step 5: Advanced ZeroTier Configuration (Optional)


Benefits of Using ZeroTier for UAS Projects

  1. Global Connectivity: With ZeroTier, your devices can be spread across different physical locations, yet still communicate as if they’re on the same local network.

  2. Secure Communication: ZeroTier uses end-to-end encryption, ensuring that all MAVLink data, telemetry, and control commands are secure from interception.

  3. Seamless Integration: ZeroTier is compatible with a variety of devices, making it easy to integrate your Raspberry Pis, laptops, and other systems into a unified network.

  4. Scalability: Whether you have just a few devices or many, ZeroTier scales easily, making it ideal for complex UAS setups.


Conclusion

Setting up a VPN for your UAS project using ZeroTier is a great way to ensure secure, reliable, and flexible communication between your devices. Whether you’re working with drones in the field or conducting simulations, ZeroTier can simplify network management and enable seamless collaboration between ground control stations, onboard computers, and other devices.

By integrating this setup with tools like MAVLink Router, you can efficiently route telemetry data and commands across your UAS infrastructure. Make sure to refer to our previous guide on MAVLink Router for more insights into routing MAVLink packets within your ZeroTier network.

Happy flying, and enjoy your secure UAS communications setup!


References:

Windows/macOS: For Windows or macOS systems, simply download the ZeroTier installer from the , install it, and use the GUI to join the network by entering your Network ID.

ZeroTier allows for more advanced network setups, such as assigning static IPs, managing subnets, and creating more complex routing rules. If your UAS project requires additional networking functionality, you can explore ZeroTier’s advanced configuration options on their .

ZeroTier
ZeroTier download page
documentation page
ZeroTier Official Website
MAVLink Router GitHub