Accessing Your Raspberry Pi Securely From The Internet Using ZeroTier - Kelvin Zhang
Accessing Your Raspberry Pi Securely From The Internet Using ZeroTier - Kelvin Zhang
Accessing Your Raspberry Pi Securely From The Internet Using ZeroTier - Kelvin Zhang
About
Blog
Projects
[email protected]
When you need to access your Raspberry Pi from home, exposing your
public IP/using dynamic DNS and opening ports can expose your Pi to
potential security threats, especially if you're using password-based
authentication or running services behind these ports.
If you're wondering how secure and reliable ZeroTier is, check out their
manual. ZeroTier is also open source, with their codebase available on
GitHub.
Installation
ZeroTier Central
ZeroTier Central is the web panel where you control your virtual network
and manage connected devices. First, set up your network by registering
your account at https://my.zerotier.com/. Next, create your network by
navigating to https://my.zerotier.com/network and clicking Create. Then,
click on your newly created network entry and follow these steps:
1. Change the name to something less random
Raspberry Pi
We will now set up ZeroTier on your Raspberry Pi. Note that if you are using
a Raspberry Pi B or Zero W and run into issues, you may have to apply a
patch detailed here (thanks to mrexodia for the tip!). Follow the following
instructions:
1. Run the shell command under their download page (the more secure,
GPG option is recommended).
zerotier-one
one/networks.d/[Network ID].conf
9. If you have UFW or any other firewall software installed, ensure that you
allow traffic going to and from your private IP range
Client Devices
Finally, let's set up your client devices you will use to connect to the
Raspberry Pi from any Internet-available network in the world. On Linux
clients, the setup is the same as for the Raspberry Pi. ZeroTier also has
Android and iOS apps which you can find on their download page. After
connecting your client devices to the same network, you can check that the
other devices are resolvable using sudo zerotier-cli listpeers . Finally, you
can connect to your Raspberry Pi by using the private IP address you
assigned to it.
Conclusion
For me, using ZeroTier is a very pleasant experience. I can access my
Raspberry Pi from anywhere in the world with an Internet connection
without having to use port forwarding or exposing my Pi directly to the
Internet. Another added advantage is that I can add a UFW/iptables rule to
block all inbound traffic to SSH and other services originating from all IP
addresses other than my home and ZeroTier IP address ranges. The time
spent setting up your devices is well worth the security and convenience
which ZeroTier provides.
If you found this blog post useful or have any questions, leave a comment
below or tweet me @KelvZhan!
← Back to Blog
20 Comments
1 Login
Name
DiemKae − ⚑
2 years ago
These instructions also worked perfectly on Ubuntu systems (18.04.6 LTS and
20.04.4 LTS) in my lab!
1 0 Reply • Share ›
K
Kelvin Z. Mod > DiemKae − ⚑
2 years ago
Pleasure to help!
0 0 Reply • Share ›
iAmBecomeDeath − ⚑
3 years ago edited
1 0 Reply • Share ›
K
Kelvin Z. Mod > iAmBecomeDeath
− ⚑
3 years ago
0 0 Reply • Share ›
0 0 Reply • Share ›
papafriki − ⚑
6 years ago
Thank you for this great tutorial. In five minutes I had everything configured and I
do not care being behind cgnat
1 0 Reply • Share ›
K
Kelvin Z. Mod > papafriki − ⚑
6 years ago
0 0 Reply • Share ›
mrexodia − ⚑
6 years ago
For the Raspberry Pi B and Raspberry Pi Zero W I had to do some extra steps to
get it to work: https://github.com/zerotier...
1 0 Reply • Share ›
K
Kelvin Z. Mod > mrexodia − ⚑
6 years ago
Thanks for your comment! I have updated my blog post to reflect this.
1 0 Reply • Share ›
S
sch MATKA − ⚑
6 years ago
1 0 Reply • Share ›
K
Kelvin Z. Mod > sch MATKA − ⚑
6 years ago
Indeed! With ZeroTier, if you need SSH access outside from outside of
your access using an Android device, JuiceSSH (an Android SSH client)
+ ZeroTier is a very good combination.
0 0 Reply • Share ›
DiemKae − ⚑
2 years ago
This guide is a distillation of the necessary stuff to install and use ZT, THANKS!
One thing I've seen is that my pi4b drops its connection frequently, at random
times (i.e. it doesn't seem to be an "idle timeout" AFAIK).
0 0 Reply • Share ›
Therm Hal − ⚑
4 years ago
any issues with frontier networks and ZeroTier on remote RPI access?
0 0 Reply • Share ›
A
Arch linux − ⚑
6 years ago
0 0 Reply • Share ›
A
Al Jones − ⚑
6 years ago
0 0 Reply • Share ›
K
Kelvin Z. Mod > Al Jones
− ⚑
6 years ago
You're welcome!
0 0 Reply • Share ›
F
Francisco Márquez Chaves − ⚑
6 years ago
0 0 Reply • Share ›
K
Kelvin Z. Mod > Francisco Márquez Chaves − ⚑
6 years ago
You're welcome!
0 0 Reply • Share ›
M
MarcV > Kelvin Z. − ⚑
3 years ago
0 0 Reply • Share ›
K
Kelvin Z. Mod > MarcV − ⚑
3 years ago
0 0 Reply • Share ›