Running ZeroTier on the Raspberry Pi?

ZeroTier is an open-source software-defined networking platform that allows devices to communicate as if they are on a local area network, even if they are across the internet. This makes it easy to connect multiple Raspberry Pis together into a virtual private network (VPN).

Running ZeroTier on the Raspberry Pi?

Benefits of Running ZeroTier on a Raspberry Pi

Setting up ZeroTier on a Raspberry Pi provides several advantages:

  • Creates a secure connection for your devices without complex VPN software
  • Allows Pis to communicate over the internet as if on a LAN
  • Easy to set up on multiple Pis to link them into a unified network
  • Software-defined, doesn’t require changes to your network infrastructure
  • Encrypts traffic end-to-end, preventing snooping and attacks

Installing ZeroTier on the Raspberry Pi

Installing ZeroTier on a Raspberry Pi is a very straightforward process using the Linux terminal:

Step 1: Get a ZeroTier Network ID

First, you’ll need to sign up for a free ZeroTier account on their website to get a network ID:

  1. Go to www.zerotier.com and create a user account
  2. Log into the new account and access the admin console
  3. Create a new network and make note of the 16-digit Network ID

Step 2: Install ZeroTier on the Raspberry Pi

Next, ssh into your Pi and run the following commands:

curl -s https://install.zerotier.com | sudo bash

This downloads and installs the latest version of ZeroTier. Next, join it to your network:

sudo zerotier-cli join {networkID}

Replace {networkID} with your real Network ID.

Step 3: Authorize the Device

Back in the ZeroTier admin console, you’ll now see your Pi listed as a pending device. Authorize it to join the network.

After a minute or two, your Pi should show as being online on the network. Any other devices you authorize to join will now be able to communicate with your Pi over ZeroTier.

Optimizing the Raspberry Pi for ZeroTier Performance

To get the best performance out of ZeroTier on a Raspberry Pi, there are a few configuration tweaks you can make:

  • Allocate more CPU time to ZeroTier:

sudo systemctl edit zerotier-one

In the editor that opens, add the following lines:

[Service]

Nice=-5

This gives ZeroTier processes higher priority on the Pi, reducing latency.

  • If your Pi has a lot of bandwidth, increase the transmission queue size in /var/lib/zerotier-one/zerotier-one.port:

BufferSize = 512000

  • Consider overclocking your Pi CPU or GPU for reduced ZeroTier latency. But monitor temperatures!

With the right tweaks, you can run ZeroTier on a Raspberry Pi with performance akin to a wired LAN.

Example Projects to Connect with ZeroTier

Once you have multiple Raspberry Pis on the same ZeroTier network, there are lots of fun projects you can do to make them interact:

Stream Video Between Pis

Use gstreamer to set up real-time video streaming between two Raspberry Pis, even if they are in different geographic locations.

Control One Pi from Another with SSH

Securely control one of your Raspberry Pis from another by SSHing between them. This also allows you to securely transfer files using SCP.

Set up NETWORK ATTACHED STORAGE (NAS)

Configure one of your Pis with an external hard drive to act as network attached storage. It will appear as just another drive when accessed over ZeroTier from your other Pis.

Distributed Computing Cluster

Link together 4+ Pis into a Beowulf cluster for distributed computing to leverage all of their CPU and GPU resources in parallel.

The possibilities are endless! ZeroTier lets you bypass geographic and network infrastructure limitations.

Key Takeaways When Using ZeroTier with a Raspberry Pi

  • Easy to set up, only takes a few minutes to install and authorize devices to join
  • Creates secure peer-to-peer encrypted tunnels between devices
  • Reduces latency by prioritizing ZeroTier process CPU usage
  • Enables fun experiments in streaming, cluster computing and remote control

Overall, ZeroTier is an ideal way to connect Raspberry Pis because it is lightweight, high performance, and bridges networks.

Conclusion

Connecting Raspberry Pis into a virtual private network with ZeroTier is a great way to unlock fun projects and learning opportunities. With just a simple software install and a few tweaks, you can reduced latency and start building multi-Pi interactive projects. Sign up for a free ZeroTier account and network ID to get started creating your own Raspberry Pi VPN mesh network today!

FAQs:

  1. What operating systems can run ZeroTier?
    ZeroTier can run on most operating systems including Windows, MacOS, iOS/iPadOS, Android, Linux, and more. This allows you to connect not just Raspberry Pis but also computers and mobile devices to your networks.

  2. Does ZeroTier replace a router?
    No, ZeroTier complements rather than replaces your existing network and router infrastructure. It enables site-to-site communication by wrapping packet traffic in encrypted tunnels across the public internet.

  3. Is ZeroTier actually free?
    Yes! ZeroTier offers free tier accounts for non-commercial use. Paid plans with priority support and advanced management tools are also available.

  4. Can ZeroTier access devices behind a firewall or NAT?
    Yes! ZeroTier is able to punch through consumer firewalls and NAT schemes to reach authorized client devices. This means you don’t have to configure port forwarding or DMZs.

  5. What is the maximum distance between ZeroTier devices?
    Effectively infinite! As long as there is an underlying internet connection, ZeroTier devices distributed globally can communicate as if they are on a LAN.

  6. Is ZeroTier faster than a VPN?
    In many cases, yes! Because ZeroTier optimizes traffic within its intelligent routing architecture instead of brute force tunneling or encryption alone. Throughput nears cleartext speeds.

  7. Can ZeroTier replace a site-to-site VPN?
    Absolutely. ZeroTier delivers site-to-site connectivity without the hassle of VPN gateways and infrastructure configuration across your WAN links. It peers encrypted traffic straight between clients.

  8. What are the security properties of ZeroTier?
    ZeroTier uses 2048-bit self-generated encryption keys to establish end-to-end secret pathways between clients on a network. This prevents man-in-the-middle attacks.

  9. Can ZeroTier isolate segments within a network?
    Yes, network rules and policy allow you to isolate clients into subnets or VLAN equivalents over the ZeroTier SDN overlay. Useful for management and security domains.

  10. Can I manage ZeroTier purely from a mobile device?
    The iOS and Android apps allow you to administer your networks and clients completely from your phone or tablet while on the go. Desktop access is not required.

  11. Does ZeroTier require opening any firewall ports?
    No port forwarding or exposure is required for ZeroTier to work thanks to its intelligent NAT traversal abilities. However some specific UDP/TCP ports can be opened to boost performance.

  12. Can ZeroTier tunnels carry any kind of traffic?
    Yes! Once joined to a network, devices can route all standard IP packet data across ZeroTier’s tunneled pathways between peers. This includes raw TCP, UDP, ICMP as well as ESP for encrypted IPsec traffic.

  13. What happens if a ZeroTier client device goes offline?
    Devices reconnect automatically based on keep alive signals and session persistence. Temporary interruptions will not break connectivity across your ZeroTier virtual network.

  14. Can ZeroTier connect multicast or broadcast streams?
    ZeroTier’s architecture delivers point-to-point tunnels between peers instead of L2 bridging. So multicast and L2 broadcast traffic types are not carried, but L3 unicast streams work perfectly well.

  15. How many devices can join a single ZeroTier network?
    Each ZeroTier network supports up to 200 clients on free accounts. Need to connect more? Additional device allocations can be purchased or you can spin up separate networks.

  16. What is the typical latency overhead from wrapping traffic through ZeroTier?
    ZeroTier adds negligible latency, usually between 10-40ms depending on internet link quality. This is low enough for strong realtime performance of voice, video, and other interactive streams.

  17. Can ZeroTier assign static IPs to devices?
    Yes, every device that joins a network can be assigned a static IP address from that network’s address space along with route announcement rules to enable direct targeted access.

  18. Does ZeroTier encryption reduce maximum transmission speeds?
    ZeroTier uses efficient encryption algorithms tuned for high speed operation. Typical internet link bottlenecks like last mile bandwidth have a much bigger impact than ZeroTier encryption overhead.

Leave a Comment