Gameserver/scripts/forward_tanksoffreedomii.sh

33 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Collection of scripts to deploy a server hosting several open-source games
# Copyright (C) 2022 Jarno van der Kolk
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
set -e
if [ -z $1 ]; then
echo "Usage: $(basename $0) [YOUR IP]"
exit 1
fi
yourip="$1"
firewall-cmd --permanent --add-masquerade
firewall-cmd --permanent --add-port=3939/udp
firewall-cmd --permanent --add-port=3940/udp
firewall-cmd --permanent --add-forward-port=port=3939:proto=udp:toport=3939:toaddr=${yourip}
firewall-cmd --permanent --add-forward-port=port=3940:proto=udp:toport=3940:toaddr=${yourip}
firewall-cmd --reload