ZeroTier+Pi Layer 2 Bridge for Flex Radio remote operation.
Danny, K5CG@hamoperator.org
Updated 12/29/2023 01:12
Keeping it simple, ZeroTier needs to link your mobile devices to a network interface on your LAN
which is local to your Flex radio. For Layer 2 bridging to work you need the IP address range of
ZeroTier members to be in the same subnet as your LAN but on IPs not already in use.
Network details for this example:
Subnet: 192.168.1.0/24
Router/gateway: 192.168.1.1
DHCP range: 192.168.1.100 to 200 (not used – avoid this range)
Setup a Raspberry Pi with the latest Raspberry Pi OS for the ZeroTier interface. Using IP address
192.168.1.2 (as STATIC not DHCP) for this example.
On the Pi (console or ssh)...
~ $ sudo apt-get install bridge-utils
~ $ curl -s https://install.zerotier.com/ | sudo bash
~ $ sudo zerotier-cli info
200 info xxxxxxxxxx 1.12.2 ONLINE
“xxxxxxxxx” is the auto-generated ZeroTier node id for this Pi. You’ll need this later.
Now setup the Pi bridge interface using IP 192.168.1.2.
~ $ sudo vi /etc/network/interfaces
auto eth0
iface eth0 inet manual
auto br0
iface br0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1
dns-search yourdomain.com
bridge_ports eth0
bridge_fd 0
bridge_maxage 0
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
If you don’t have a local domain on your LAN you can leave the dns-search line out.
sudo reboot
Now the ZeroTier setup...
Go to ZeroTier.com and create an account.
Go to the Networks list and “Create a network”. This will give you the 16 digit YourNetworkId at the
top of the page.
Keep Private mode in Access Control (default).
In Managed Routes enter 192.168.1.0/24 and leave the “Via” box empty. Click Submit. You should see:
192.168.1.0/24 (LAN)
IPv4 auto-assign is not needed in this use case – leave turned off.
Multicast – Allow Broadcast – leave on (default setting).
DNS can be left as defaults for this purpose. But if you have a domain on your LAN you can add your
router 192.168.1.1 as the gateway for that domain.
In the “Manually Add Member” box, enter the ZeroTier node id from the Pi (“xxxxxxxxxx” above).
In the Members area, locate the Pi node you just added, make sure the “Auth” checkbox is set and then
click the wrench icon. With the settings panel open, set both checkboxes to “Allow Ethernet Bridging”
and “Do Not Auto-Assign IPs”. Click the wrench icon again to close up the settings panel.
Leave the “Managed IPs” column empty. An IP address is not needed on this interface because it is a
member of the bridge.
Go back to the console or ssh into your Pi and run
~ $ sudo zerotier-cli join YourNetworkId
200 join OK
Make sure Pi is connected to the ZeroTier network.
~ $ sudo zerotier-cli listnetworks
200 listnetworks <nwid> <name> <mac> <status> <type> <dev> <ZT assigned ips>
200 listnetworks YourNetworkId yourdomain.com ma:ca:dd:re:ss OK PRIVATE InterfaceName -
“<status>” of OK is what you are looking for to move forward.
Edit the local config file for your network ID and set allowManaged=0
~ $ sudo vi /var/lib/zerotier-one/networks.d/YourNetworkId.local.conf
allowManaged=0
Add a command to crontab to add the zerotier interface to Bridge (br0) after boot time after a 30
second delay. I believe this is needed because the bridge will not accept the ZeroTier interface if the
service is not up at boot time.
~ $ sudo crontab -e
@reboot sleep 30 && /sbin/brctl addif br0 <InterfaceName>
I decided to also disable IPv6.
sudo echo net.ipv6.conf.all.disable_ipv6 = 1 >> /etc/sysctl.conf
sudo reboot
After the Pi comes up, wait one minute and log into it again. List IP Addresses.
~ $ ip a
eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master br0 state UP group default
qlen 1000
br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen
1000
inet 192.168.1.2/24 brd 192.168.1.255 scope global br0
ztxxxxxxxx: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 2800 qdisc pfifo_fast master br0 state
UNKNOWN group default qlen 1000
You should see that the interfaces named eth0, and the ztxxxxxxxx (ZeroTier) interfaces have no IP
address assigned and the br0 interface has the static IP address you assigned above (192.168.1.2).
Now you are done with the Pi bridge setup. Next, install the ZeroTier One application on your remote
device (SmartSDR PC) and add it to the ZeroTier network, authorize it, set the checkbox for “Do Not
Auto Assign IPs”, add another static IP address from your LAN subnet making sure the address is not
already in use and is outside of your DHCP range.
Go to Starbucks, grab a coffee, connect to their WiFi. Watch for your Flex radio to appear in the radio
chooser. Have fun.
These steps are intended to be a minimalist way to get remote Flex operation up and running.
Hopefully you have this working now. You may find other uses for remote access into your home LAN,
i.e. smart phone access to your CCTV system, etc. In that event you will probably want a more
complex configuration, enabling a range of IPs for Auto-assignment (DHCP on the ZeroTier network not to overlap the DHCP range of your home router) and then you would turn off the “Do Not AutoAssign IPs” checkbox on members that need an IP. A complete setup of that nature is outside the scope
of this document but it is mostly intuitive.
Please also see the drawings on the following pages.
A real world example (my configuration).
I moved all of my Ham Radio equipment to another VLAN on 192.168.22.0/24.
The DHCP Server for this subnet is 192.168.22.100-199.
The Flex is assigned 192.168.22.66.
The Pi (br0 interfacae) is assigned 192.168.22.73.
On the ZeroTier Web UI settings, the interface connected to the Pi has no IP and the Laptop I use for
remote operation has 192.168.22.13 (manually assigned).
Here is what my ZeroTier Network configuration looks like.
No DHCP required (turn off).
Network Members…
- Bridge to Pi (no IP required).
- Windows Laptop (for SmartSDR) add additional devices this way – assign an available IP manually.