Added Mordhau-Open-Ports.bash
This commit is contained in:
parent
7ce518369f
commit
8c72ea3f31
14
Mordhau/Mordhau-Open-Ports.bash
Executable file
14
Mordhau/Mordhau-Open-Ports.bash
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash --posix
|
||||
|
||||
set -e
|
||||
|
||||
firewall-cmd --add-port 7770-7779/tcp --permanent
|
||||
firewall-cmd --add-port 27000-27009/tcp --permanent
|
||||
firewall-cmd --add-port 15000-15009/tcp --permanent
|
||||
firewall-cmd --add-port 26000-26009/tcp --permanent
|
||||
|
||||
echo "All ports open for Mordhau servers - reloading firewall-cmd..."
|
||||
|
||||
firewall-cmd --reload
|
||||
|
||||
echo "Finished opening ports."
|
@ -24,7 +24,6 @@ usage() {
|
||||
All above flags must be passed with arguments"
|
||||
}
|
||||
|
||||
|
||||
error() {
|
||||
printf '%s\n' "$1" >&2
|
||||
exit 1
|
||||
@ -60,14 +59,19 @@ while :; do
|
||||
usage
|
||||
;;
|
||||
*) # Default case: No more options, so break out of the loop.
|
||||
break
|
||||
break ;;
|
||||
esac
|
||||
|
||||
shift
|
||||
done
|
||||
|
||||
[[ "${IP}" == "" ]] && error "--ip requires an argument"
|
||||
[[ "${FORWARD_PORT}" == "" ]] && error "--forward-port requires an argument"
|
||||
[[ "${INBOUND_PORT}" == "" ]] && error "--inbound-port requires an argument"
|
||||
|
||||
firewall-cmd --permanent --add-forward-port=port="${INBOUND_PORT}":proto=tcp:toaddr="${IP}":toport="${FORWARD_PORT}"
|
||||
firewall-cmd --permanent --add-port="${INBOUND_PORT}"/tcp
|
||||
firewall-cmd --add-masquerade
|
||||
firewall-cmd --reload
|
||||
|
||||
echo "Routing all data on ${INBOUND_PORT} to ${IP}${FORWARD_PORT}"
|
||||
echo "Routing all data on ${INBOUND_PORT} to ${IP}:${FORWARD_PORT}"
|
Loading…
Reference in New Issue
Block a user