INTERNET_FACING_INTERFACE=$(determine_interface "Select the interface that is exposed to the internet:")
echo"$INTERNET_FACING_INTERFACE selected as internet facing interface"
echo"IP address of $INTERNET_FACING_INTERFACE is $(get_ip $INTERNET_FACING_INTERFACE)"
PINEPHONE_FACING_INTERFACE=$(determine_interface "Select the interface that is created by the PinePhone's tether script:")
echo"$PINEPHONE_FACING_INTERFACE selected as PinePhone facing interface"
echo"IP address of $PINEPHONE_FACING_INTERFACE is $(get_ip $PINEPHONE_FACING_INTERFACE)"
echo"Setting IP Tables... (will prompt for password multiple times)"
sudo iptables -t nat -A POSTROUTING -o $INTERNET_FACING_INTERFACE -j MASQUERADE
sudo iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i $PINEPHONE_FACING_INTERFACE -o $INTERNET_FACING_INTERFACE -j ACCEPT
echo"IP Tables set!"
echo"Attempting to set default route on PinePhone..."
echo"NOTE: Due to the fact we're running sudo in ssh without a shell, sudo is unable to hide your password! Make sure no one's looking at your screen before continuing!"
ssh 10.15.19.82 sudo -S ip route add default via $(get_ip $PINEPHONE_FACING_INTERFACE) dev usb0;echo"Success!"