A script to automatically toggle a ZeroTier LAN-over-internet connection and add it to the routing table directly from a games folder that executes .sh-scripts inside RetroPie/Emulationstation, or from a Linux command line. For LAN gaming OR game streaming remotely over internet, and supports LAN games with broadcast peer games autodiscovery.
An example of use together with RetroPie Netplay can be found in this article.
Added a new 3 step logic instead of the old 2 all-on/all-off, so that one easily can restore ZT broadcast after reboot:
STATE => ACTION
- ZT off => Toggle to 2
- ZT on & BC off => Toggle to 3
- ZT on & BC on => Toggle to 1
(ZT=ZeroTier, BC=broadcast)
This is a REALLY quick and ugly modifcation of ../gsomoza/ztvpn.sh on GitHub, to allow for execution directly from RetroPie, and adding and removing the ZeroTier network from the routing table, so that ZeroTier peers are discovered automatically by some LAN games. Basically a raw copy with some added sudo and ip route commands...
The script does what it's supposed to on my home system and won't be very actively supported, updated or maintained.
For similar, but a little more complicated, solutions on Windows, see the ZeroTier Knowledgebase
- Raspberry Pi with Linux (but should work on most Linux distros, as well)
- ZeroTier
- RetroPie/Emulationstation with Steam or other games menu folders that execute .sh-scripts
(but should also work on other RetroArch installations or from the command line)
- Automatically toggle(connect&disconnect) a ZeroTier connection
- Add the ZeroTier connection to the routing table, so that certain LAN games that use broadcast network discovery can find the other hosts connected to the ZT-network
- Can be run directly from the RetroPie games list menus or from the command line.
1 - Download and copy the script into one of your RetroPie roms folder, typically "/home/pi/RetroPie/roms/..". Make sure it's executable.
Alternatively, in same folder, run:
git clone https://github.com/Vegz78/ToggleZeroTier && sudo chmod +x ./ToggleZeroTier/_ToggleZeroTier.sh
2 - Edit _ToggleZeroTier.sh with the desired global variables correct for your setup(ZeroTier Network ID & Device ID.)
3 - Start RetroPie and navigate to the chosen games list menu.
4 - Run the _ToggleZeroTier entry.
For more detailed setup and usage instructions, check out this article.
Edit the file /etc/emulationstation/es_systems.cfg as inspired by TechWizTime.
Add something like this:
<system>
<name>Steam</name>
<fullname>Steam</fullname>
<path>/home/pi/RetroPie/roms/moonlight</path>
<extension>.sh .SH</extension>
<command>%ROM%</command>
<platform>steam</platform>
<theme>steam</theme>
</system>