So... I figured out how to get ZeroTier working as an Ethernet bridge thanks to some help from @adam-ierymenko and the initial guide that another user posted at :
https://www.zerotier.com/community/topic/5/bridging-ethernet-to-zerotier-virtual-networks-on-linux
I did this using Ubuntu 15.10.
Install Ubuntu however you wish. I'd recommend at least 1gb of RAM and 16GB of hard drive space (My current install has 1gb of ram and 32gb of hard drive space).
You only need one interface actually connected to the physical network for both Management and the bridged traffic.
After you have created your VM, before powering it on, you should take care that your Hypervisor will allow Mac Spoofing.
In VMware, this is called Forged Transmits, and is done at a vSwitch level from what I understand. ( A little info is located here: https://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.vsphere.networking.doc%2FGUID-74E2059A-CC5E-4B06-81B5-3881C80E46CE.html)
In Hyper-V this is fixed on a per VM basis using the following powershell commands all typed on one line. Just replace MYVMNAME and MY_HYPERV_SWITCH with the values that are used from your own setup.
get-vmnetworkadapter -VMName MYVMNAME|where {$_.SwitchName -eq "MY_HYPERV_SWITCH"}|
set-vmnetworkadapter -MacAddressSpoofing on
In VMware
While Ubuntu is installing, create an account or log in to https://my.zerotier.com and create your network (or use your existing one). Things you need to make sure of:
- Your ZeroTier IP range is set to be part of your Network Subnet. IE: If your subnet is 192.168.10.0/23, you should make sure that ZeroTier is configured to be in the same range... For instance, my home network is configured as 192.168.10.0/23. ZeroTier is configured:
Note: The IP Autoassign settings are outside of the DHCP Scope of my DHCP server. IE: My DHCP server at home is set to hand out IPs between 192.168.10.100 and 192.168.10.150. Note here my Autoassign settings are 192.168.11.100 to 192.168.11.200.
Note 2: This would theoretically work, even if you are on a /24 network, as long as the ZT autoassign settings are outside the scope of your LAN's DHCP server. I have not tested this.
- The device that you want to be designated as the bridge is marked as both Allowed AND bridge in the ZT interface...
After you have installed Ubuntu, execute the following commands, which updates the package list, and ensures that the bridge-utils are installed. It also downloads and installs the ZeroTier binaries. Check the website: https://www.zerotier.com/product-one.shtml for the latest version.
All commands should be executed as root
apt-get update
apt-get install bridge-utils
wget https://download.zerotier.com/dist/zerotier-one_1.1.4_amd64.deb
dpkg -i zerotier-one_1.1.4_amd64.deb
After ZeroTier is installed, you need to start it:
service zerotier-one start
Then you need to get the Client ID for making sure you select the right one as the bridge.
zerotier-cli info
It will output something similar to :
200 info ee88c712ab ONLINE 1.1.4
The third item is your client's ID.
Next up, you will need to join the client to your ZeroTier network via:
zerotier-cli join your_network_id
You should see the Network ID in the top left corner of your screen after you click on your Network on the ZT Web Portal.
If you read through the guide at the site I posted above, he shows a network configuration guide using /etc/interfaces, which is the proper way to set it up. I went about it a different way by using a script that starts when the VM is rebooted, and waits for 30 seconds to ensure network connectivity...
Place the script in /usr/local/bin
Adjust the BRIDGE_IP and GATEWAY_IP, and SLEEP_TIMER to the correct values.
The script removes ALL IP addresses and routes related to eth0, br0, and zt0, and then sets them according to the parameters you set up.
#!/bin/bash
LAN_INT="eth0" #Internal LAN Interface
BR_INT="br0" #Bridge Interface
ZT_INT="zt0" #ZeroTier Interface
BRIDGE_IP="192.168.10.100/23"
GATEWAY_IP="192.168.10.1"
SLEEP_TIMER="30s"
RUN_TIME=`date`
#Delay Timer to give the system a chance to finish booting
sleep $SLEEP_TIMER
echo $RUN_TIME > /var/log/bridge.log
#Disable Interfaces, Remove IP addresses
echo "Disabling Interface" >> /var/log/bridge.log
/sbin/ifconfig $LAN_INT down >> /var/log/bridge.log
/sbin/ifconfig $ZT_INT down >> /var/log/bridge.log
/sbin/ip addr flush dev $LAN_INT >> /var/log/bridge.log
/sbin/ip addr flush dev $ZT_INT >> /var/log/bridge.log
echo "Setting up Bridging..." >> /var/log/bridge.log
/sbin/brctl addbr $BR_INT >> /var/log/bridge.log
/sbin/brctl addif $BR_INT $ZT_INT $LAN_INT >> /var/log/bridge.log
/sbin/ifconfig $LAN_INT promisc up >> /var/log/bridge.log
/sbin/ifconfig $ZT_INT promisc up >> /var/log/bridge.log
/sbin/ifconfig $BR_INT up >> /var/log/bridge.log
/sbin/ip addr add $BRIDGE_IP dev br0 >> /var/log/bridge.log
/sbin/route add default gateway $GATEWAY_IP
echo "Finished!" >> /var/log/bridge.log
I have the script configured to run at reboot via crontab -e
# m h dom mon dow command
@reboot sh /usr/local/bin/bridge-start
A few quick ping tests should reveal that your bridge can communicate on your LAN, as well as your ZT Network.
From your ZT Network, ping towards a LAN IP address, and everything should work.
It should be noted that if you are actually changing an existing ZeroTier network to make this work, all of the linux clients need to be stopped, and then started. Not restarted (the IP address doesn't change if you do service zerotier-one restart). Windows systems can restart the ZeroTier service from the services.msc file.
If you have any issues or find any typos or recommend a better format, feel free to leave a comment below!