Created
June 10, 2021 02:50
-
-
Save scktt/b586dd4bf5a19be91a978c6b2abb5976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# where plex network is the zt-network-id plex is connected to | |
plexnetwork=XXXX | |
plexserver=172.30.1.6 | |
plexport=32400 | |
# install updates | |
DEBIAN_FRONTEND=noninteractive | |
apt update | |
apt dist-upgrade -y | |
apt install iptables-persistent iftop -y | |
# install zerotier | |
curl -s https://install.zerotier.com | sudo bash | |
# | |
if [ -x $(which zerotier-cli) ]; then | |
zerotier-cli join $plexnetwork | |
fi | |
# setup iptables routing | |
echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf | |
iptables -t nat -A PREROUTING -p tcp --dport $plexport -j DNAT --to-destination $plexserver:$plexport | |
iptables -t nat -A OUTPUT -p tcp -m tcp --dport $plexport -j DNAT --to-destination $plexserver:$plexport | |
iptables -t nat -A POSTROUTING -j MASQUERADE | |
netfilter-persistent save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment