Skip to content

Instantly share code, notes, and snippets.

@michele-tn
Last active May 19, 2025 09:28
Show Gist options
  • Save michele-tn/423d1ac079afcf20b6bec32043d25414 to your computer and use it in GitHub Desktop.
Save michele-tn/423d1ac079afcf20b6bec32043d25414 to your computer and use it in GitHub Desktop.

Overview

This guide provides a comprehensive walkthrough for setting up ZeroTier on an OpenWRT router. ZeroTier enables secure, high-performance virtual networking between devices across the globe—making it ideal for IoT deployments, remote management, and peer-to-peer networks.


❓ Why Use ZeroTier in IoT Environments?

ZeroTier is a powerful tool for Internet of Things (IoT) scenarios due to:

  • High performance: Low latency, high throughput virtual interfaces.
  • 🔐 Built-in encryption: End-to-end secure communication.
  • 🌍 Global connectivity: Seamlessly connects devices behind NAT/firewalls.
  • ⚙️ Auto IP management: No need for static IPs or port forwarding.
  • 🧩 Ease of deployment: Minimal setup and maintenance.

① Install ZeroTier

Open a terminal session on your OpenWRT router and run:

opkg update && opkg install zerotier

This command updates the package list and installs ZeroTier.


② Configure ZeroTier

Now configure ZeroTier with your network ID:

uci set zerotier.openwrt_network=zerotier
uci add_list zerotier.openwrt_network.join='YOUR_NETWORK_ID'
uci set zerotier.openwrt_network.enabled='1'
uci commit zerotier

📝 Note: Replace 'YOUR_NETWORK_ID' with your actual network ID from your ZeroTier Central account.


③ Start the ZeroTier Service

Enable and start the ZeroTier service:

/etc/init.d/zerotier enable
/etc/init.d/zerotier start

This ensures ZeroTier starts automatically after a reboot.


④ Verify ZeroTier Interface

Check if a ZeroTier virtual interface has been created:

ifconfig | grep zt

You should see an interface like ztxxxxxxxx, confirming successful connection.


⑤ Authorize the Router on ZeroTier Central

To complete the connection:

  1. Go to https://my.zerotier.com
  2. Log in and select your network.
  3. Find your router (Node ID or MAC address).
  4. ✅ Check the "Auth?" box.
  5. (Optional) Assign a fixed IP like 192.168.100.2.
  6. (Optional) Give the device a friendly name.

⑥ Final Steps

Wait a few minutes for ZeroTier to fully establish the connection. You can now communicate with your router over the virtual network as if it were local.


🛠️ Troubleshooting

  • If the interface doesn't appear, double-check your Network ID.
  • Ensure your router has internet access.
  • Restart the router and try again.

📚 Resources


✅ Summary

ZeroTier provides a seamless, secure, and powerful way to connect your OpenWRT router to any network—especially in IoT, remote support, and mesh network scenarios.

For suggestions or tweaks, feel free to fork this Gist or leave a comment!

━━━━━━━━ Secure ● Flexible ● Ideal for IoT ━━━━━━━━

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment