mirror of
https://github.com/zyclonite/zerotier-docker.git
synced 2025-01-09 06:58:13 +01:00
23 lines
556 B
Bash
23 lines
556 B
Bash
|
#!/usr/bin/env sh
|
||
|
|
||
|
set -o errexit
|
||
|
set -o pipefail
|
||
|
set -o nounset
|
||
|
# set -o xtrace
|
||
|
|
||
|
echo "Waiting for network interface to be ready..."
|
||
|
|
||
|
while ! ifconfig | grep -q zt; do
|
||
|
echo -n "."
|
||
|
sleep 1
|
||
|
done
|
||
|
|
||
|
echo "Network interface is ready. Starting bridge..."
|
||
|
|
||
|
PHY_IFACE=eth0
|
||
|
ZT_IFACE=$(ifconfig | grep zt | awk '{print $1}')
|
||
|
iptables -t nat -A POSTROUTING -o $PHY_IFACE -j MASQUERADE
|
||
|
iptables -A FORWARD -i $PHY_IFACE -o $ZT_IFACE -m state --state RELATED,ESTABLISHED -j ACCEPT
|
||
|
iptables -A FORWARD -i $ZT_IFACE -o $PHY_IFACE -j ACCEPT
|
||
|
|
||
|
echo "Bridge started."
|