A Smart Ethernet Switch for Earth
Go to file
2015-06-02 16:29:23 -07:00
artwork Add signed binary build of Mac GUI wrapper. 2015-05-17 19:48:21 -07:00
attic Clean old netconf-service from attic. 2015-05-26 18:16:12 -07:00
controller Go ahead and add flags and invFlags to the Rule table. 2015-05-25 13:20:10 -07:00
ext Yet another /Users/api path in packages script. 2015-06-02 12:01:00 -07:00
include Completely factor out "desperation" from the core. I thought of a significantly simpler way to move all of this logic entirely into the containing service, liberating the core from any concern over the nature of its pipe to the outside world. 2015-05-21 15:58:26 -07:00
java Fixed sending a port number of 0 to ZT1. 2015-06-01 20:03:28 -07:00
js/zt1-api-client Delete some temporary code. 2015-05-26 13:34:08 -07:00
node Apply @marning suggested SSE auto-detect to make builds easier on non-x86 platforms: aa2fd044cb 2015-06-01 19:43:06 -07:00
osdep Add some proxy debugging, and auto-resolve and periodically re-resolve TCP fallback tunnel hostname. 2015-05-21 15:22:41 -07:00
root-topology Fix to create-test-root-topology. 2015-04-30 16:13:17 -07:00
service Right now only FreeBSD can use BSDEthernetTap, which will probably get renamed accordingly. NetBSD and OpenBSD do not support tap, only tun, so they will have to wait. 2015-05-25 11:11:37 -07:00
tcp-proxy TCP fallback tunneling is now working. That hurt more than expected. 2015-05-22 14:52:23 -07:00
ui A visit to the Windows house of pain: 2015-05-18 20:30:54 -07:00
windows Add BackgroundResolver to Windows build. 2015-06-01 16:06:50 -07:00
.gitignore Merge organized .gitignore 2015-06-02 12:49:32 -07:00
AUTHORS.txt docs 2015-04-16 16:15:25 -07:00
LICENSE.txt New git repository for release - version 0.2.0 tagged 2013-07-04 16:56:19 -04:00
make-freebsd.mk Apply @marning suggested SSE auto-detect to make builds easier on non-x86 platforms: aa2fd044cb 2015-06-01 19:43:06 -07:00
make-linux.mk Eliminate "which" dependency in Linux makefile. 2015-06-02 16:29:23 -07:00
make-mac.mk Fix paths again in Mac pkg build. 2015-06-02 11:59:05 -07:00
Makefile Basic OpenBSD compile fixes -- still need to update BSDEthernetTap, will do that later. Should be able to re-use FreeBSD port for OpenBSD, but we will see. 2015-05-15 08:48:53 -07:00
objects.mk Background resolver. 2015-05-21 13:44:33 -07:00
one.cpp docs 2015-06-02 16:16:14 -07:00
README.md Eliminate "which" dependency in Linux makefile. 2015-06-02 16:29:23 -07:00
selftest.cpp Apply @marning suggested SSE auto-detect to make builds easier on non-x86 platforms: aa2fd044cb 2015-06-01 19:43:06 -07:00
version.h Re-incorporation: ZeroTier Networks -> ZeroTier, Inc. [Delaware] 2015-02-17 13:11:34 -08:00

ZeroTier One

ZeroTier is a software defined networking layer for Earth.

It can be used for on-premise network virtualization, as a peer to peer VPN for mobile teams, for hybrid or multi-data-center cloud deployments, or just about anywhere else secure software defined virtual networking is useful.

ZeroTier One is our OS-level client service. It allows Mac, Linux, Windows, FreeBSD, and soon other types of clients to join ZeroTier virtual networks like conventional VPNs or VLANs. It can run on native systems, VMs, or containers (Docker, OpenVZ, etc.).

Visit ZeroTier's site for more information. You can also download professionally packaged binary installers/packages for a variety of supported OSes there if you don't want to build ZeroTier One from source.

Building from Source

For Mac, Linux, and BSD, just type "make" (or "gmake" on BSD). You won't need much installed; here are the requirements for various platforms:

  • Mac: Xcode command line tools, and Packages if you want to build an OSX .pkg installer ("make mac-dist-pkg"). It should build on OSX 10.7 or newer.
  • Linux: gcc/g++ or clang/clang++ (Makefile will use clang by default if available.)
  • FreeBSD (and other BSD): C++ compiler (G++ usually) and GNU make (gmake).

Each supported platform has its own make-XXX.mk file that contains the actual make rules for the platform. The right .mk file is included by the main Makefile based on the GNU make OSTYPE variable. Take a look at the .mk file for your platform for other targets, debug build rules, etc.

Windows, of course, is special. We build for Windows with Microsoft Visual Studio 2012 on Windows 7. A solution file is located in the windows subfolder. Newer versions of Visual Studio (and Windows) may work but haven't been tested. Older versions almost certainly will not, since they lack things like stdint.h and certain STL features. MinGW or other ports of gcc/clang to Windows should also work but haven't been tested. Build steps for Windows are a bit more complicated. For the moment you are on your own there.

Mobile versions are in progress. They don't work yet, and in any case only the glue code will be included in this repository. The full mobile apps are in private repositories on our own git server.

Supported Platforms

CPU architecture shouldn't matter unless it's smaller than 32-bit or something really bizarre like a "middle-endian" processor. We have reports of ZeroTier One running on arm32, arm64, and MIPS. It builds and runs out of the box on Raspberry Pi, BeagleBone, BananaPi, and other ARM-based developer/hobbyist boards.

ZeroTier is written in C and C++ (C++03 / ISO/IEC 14882:2003) and uses data structures and algorithms from the C++03 STL. We do not use any C++11 features (yet), since we want to support a few old and embedded platforms that don't have C++11 compilers. You will require a compiler and headers new enough to support 64-bit integers (long long) and the stdint.h header. The latter could also be faked by adding defines for things like uint32_t, int64_t, etc.

Typing "make selftest" will build a zerotier-selftest binary which unit tests various internals and reports on a few aspects of the build environment. It's a good idea to try this on novel platforms or architectures.

Running

Running zerotier-one with -h will show help.

On Linux and BSD you can start the service with:

sudo ./zerotier-one -d

A home folder for your system will automatically be created.

The service is controlled via the JSON API, which by default is available at 127.0.0.1 port 9993. We include a zerotier-cli command line utility to make API calls for standard things like joining and leaving networks. The authtoken.secret file in the home folder contains the secret token for accessing this API. See README.md in service/ for API documentation.

Here's where home folders live (by default) on each OS:

  • Linux: /var/lib/zerotier-one
  • BSD: /var/db/zerotier-one
  • Mac: /Library/Application Support/ZeroTier/One
  • Windows: \ProgramData\ZeroTier\One (That's for Windows 7. The base 'shared app data' folder might be different on different Windows versions.)

Running ZeroTier One on a Mac is the same, but OSX requires a kernel extension. We ship a signed binary build of the ZeroTier tap device driver, which can be installed on Mac with:

sudo make install-mac-tap

This will create the home folder for Mac, place tap.kext there, and set its modes correctly to enable ZeroTier One to manage it with kextload and kextunload.

Windows, of course, is special. Once again you're on your own there for now. Running the .exe with -h will show options, including one to run at an admin console rather than as a service.

Joining A Network

ZeroTier virtual networks are identified by 16-digit hexadecimal network IDs, which devices are identified by 10-digit addresses. To get your address run:

sudo zerotier-cli status

(Use ./zerotier-cli if you're running it right from your build folder.)

You should see something like:

200 info ########## ONLINE #.#.#

That 10-digit hex code is you. It's derived via a one-way proof of work function from your cryptographic public key. Your public key can be found in identity.public in ZeroTier's home folder, while identity.secret contains your full identity including the secret portion of the key pair.

By the way -- those identity files define your device's identity. Moving them to another system will move that identity. Be careful when cloning virtual machines that have identities stored on them. If two devices have the same identity, they'll "fight" over it and you won't know which device will receive network packets. (Multi-homing isn't supported yet, but we have plans for something like that.)

If you want to do a quick test, you can join Earth. It's a global public network that anyone can join. Type:

sudo zerotier-cli join 8056c2e21c000001

Then:

sudo zerotier-cli listnetworks

After a few seconds to a minute you should see something like:

200 listnetworks 8056c2e21c000001 earth.zerotier.net ##:##:##:##:##:## OK PUBLIC zt0 ##.##.##.##/7

Earth will assign you an IP address in the "unofficially available" globally unrouted 28.0.0.0/7 IP block so as to avoid conflicts with local networks. (Your networks can use any IP scheme, or can even leave IP addresses unmanaged.) Once you get an IP, you should be able to ping something:

ping earth.zerotier.net

Go to http://earth.zerotier.net/ to see a short little welcome page that will tell you your IP and Ethernet MAC address.

Earth is a pretty public place. If you don't want to stick around run:

sudo zerotier-cli leave 8056c2e21c000001

The network (and associated interface) should be gone.

Joining and leaving virtual networks is almost as easy as an IRC channel or a chat room.

Networks are created and administrated by network controllers. Most users will want to use our hosted controllers. Visit our web site for more information. Later in this README there are brief instructions about building ZeroTier One with network controller support for those who want to try running their own.

Macintosh and Windows installers also install a GUI application.

Installing

We don't have a "make install" rule quite yet. On Linux you can type:

make installer

This will build a binary that, when run, will install ZeroTier One on most current Linux distributions. We also have RPM and DEB build files in ext/installfiles/linux that wrap this installer in packages for RedHat/CentOS and Debian/Ubuntu derived distributions.

On Mac the best way is to install Packages and use:

make mac-dist-pkg

This builds a .pkg file that can be installed.

BSD has no installer yet. We're working on it.

Linux/BSD and Mac installations have an uninstall.sh file in their ZeroTier home folder that cleanly removes ZeroTier One from the system. Run this with:

sudo /path/to/ZeroTier/home/folder/uninstall.sh

Windows installers are insane. We build our .MSI installers with Advanced Installer Enterprise, since it's the only way we could find to allow us to build a combined 32-bit/64-bit MSI file that deploys a driver, a service, and an application properly while retaining basic human sanity and will to live. To avoid trauma we really recommend just installing the pre-build Windows binaries from our web site if you want permanent installation on Windows.

Using ZeroTier One in Docker Containers

To run the ZeroTier One service in a Docker container, run it with "--device=/dev/net/tun --cap-add=NET_ADMIN". This will allow ZeroTier One to open a "tap" virtual network port inside the container.

Alternately, you can use Ethernet bridging to bridge the docker0 device on your system to a ZeroTier virtual network. This allows you to run ZeroTier One on the host and bridge the entire Docker network backplane to a virtual network or other hosts.

We're working on better "official" Docker support. In the meantime there is a user-contributed project here.

Building with Network Controller Support

Network controllers are nodes responsible for issuing configurations and certificates to members of ZeroTier virtual networks. Most users won't need to run their own, so this code is by default not included in the ZeroTier One binary.

You can build a network controller on Linux or Mac with:

make ZT_ENABLE_NETWORK_CONTROLLER=1

This will build a version that contains the Sqlite-backed network controller and associated extensions to the JSON local service control API. You will need the development headers for sqlite3 installed. On Mac these ship as part of Xcode, while on Linux they'll be found in packages for the various distributions.

See the JSON API documentation in service/ for more information about how to control controllers.

Troubleshooting

For most users, it just works.

If you are running a local system firewall, we recommend adding a rule permitting UDP port 9993 inbound and outbound. If you installed binaries for Windows this should be done automatically. Other platforms might require manual editing of local firewall rules depending on your configuration.

The Mac firewall can be founder under "Security" in System Preferences. Linux has a variety of firewall configuration systems and tools. If you're using Ubuntu's ufw, you can do this:

sudo ufw allow 9993/udp

On CentOS check /etc/sysconfig/iptables for IPTables rules. For other distributions consult your distribution's documentation. You'll also have to check the UIs or documentation for commercial third party firewall applications like Little Snitch (Mac), McAfee Firewall Enterprise (Windows), etc. if you are running any of those. Some corporate environments might have centrally managed firewall software, so you might also have to contact IT.

ZeroTier One peers will automatically locate each other and communicate directly over a local wired LAN if UDP port 9993 inbound is open. If that port is filtered, they won't be able to see each others' LAN announcement packets. If you're experiencing poor performance between devices on the same physical network, check their firewall settings. Without LAN auto-location peers must attempt "loopback" NAT traversal, which sometimes fails and in any case requires that every packet traverse your external router twice.

Users behind certain types of firewalls and "symmetric" NAT devices may not able able to connect to external peers directly at all. ZeroTier has limited support for port prediction and will attempt to traverse symmetric NATs, but this doesn't always work. If P2P connectivity fails you'll be bouncing UDP packets off our relay servers resulting in slower performance. Some NAT router(s) have a configurable NAT mode, and setting this to "full cone" will eliminate this problem. If you do this you may also see a magical improvement for things like VoIP phones, Skype, BitTorrent, WebRTC, certain games, etc., since all of these use NAT traversal techniques similar to ours.

If you're interested, there's a technical deep dive about NAT traversal on our blog. A troubleshooting tool to help you diagnose NAT issues is planned for the future as are uPnP/IGD/NAT-PMP and IPv6 transport.

If a firewall between you and the Internet blocks ZeroTier's UDP traffic, you will fall back to last-resort TCP tunneling to supernodes over port 443 (https impersonation). This will work almost anywhere but is very slow compared to UDP or direct peer to peer connectivity.

License

The ZeroTier source code is open source and is licensed under the GNU GPL v3 (not LGPL). If you'd like to embed it in a closed-source commercial product or appliance, please e-mail contact@zerotier.com to discuss commercial licensing. Otherwise it can be used for free.