diff options
Diffstat (limited to 'hosts/iroha/scripts/port-forward')
| -rwxr-xr-x | hosts/iroha/scripts/port-forward | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/hosts/iroha/scripts/port-forward b/hosts/iroha/scripts/port-forward index fa759d7..59eca03 100755 --- a/hosts/iroha/scripts/port-forward +++ b/hosts/iroha/scripts/port-forward @@ -1,12 +1,29 @@ #! /usr/bin/env sh -su -c "iptables -t nat -C PREROUTING -p tcp -i enp7s0 --dport 47984 -j DNAT --to-destination 192.168.211.252:47984 || \ -iptables -t nat -A PREROUTING -p tcp -i enp7s0 --dport 47984 -j DNAT --to-destination 192.168.211.252:47984; +if [ "$(id -u)" -ne 0 ]; then + echo 'This script must be run by root.' >&2 + exit 1 +fi + +# Sunshine +iptables -t nat -C PREROUTING -p tcp -i enp7s0 --dport 47984 -j DNAT --to-destination 192.168.211.252:47984 || \ + iptables -t nat -A PREROUTING -p tcp -i enp7s0 --dport 47984 -j DNAT --to-destination 192.168.211.252:47984 + iptables -t nat -C PREROUTING -p tcp -i enp7s0 --dport 47984 -j DNAT --to-destination 192.168.211.252:47984 || \ -iptables -t nat -A PREROUTING -p tcp -i enp7s0 --dport 47984 -j DNAT --to-destination 192.168.211.252:47984; + iptables -t nat -A PREROUTING -p tcp -i enp7s0 --dport 47984 -j DNAT --to-destination 192.168.211.252:47984 + iptables -t nat -C PREROUTING -p tcp -i enp7s0 --dport 47989 -j DNAT --to-destination 192.168.211.252:47989 || \ -iptables -t nat -A PREROUTING -p tcp -i enp7s0 --dport 47989 -j DNAT --to-destination 192.168.211.252:47989; + iptables -t nat -A PREROUTING -p tcp -i enp7s0 --dport 47989 -j DNAT --to-destination 192.168.211.252:47989 + iptables -t nat -C PREROUTING -p tcp -i enp7s0 --dport 48010 -j DNAT --to-destination 192.168.211.252:48010 || \ -iptables -t nat -A PREROUTING -p tcp -i enp7s0 --dport 48010 -j DNAT --to-destination 192.168.211.252:48010; + iptables -t nat -A PREROUTING -p tcp -i enp7s0 --dport 48010 -j DNAT --to-destination 192.168.211.252:48010 + iptables -t nat -C PREROUTING -p udp -i enp7s0 --dport 47998:48000 -j DNAT --to-destination 192.168.211.252:47998-48000 || \ -iptables -t nat -A PREROUTING -p udp -i enp7s0 --dport 47998:48000 -j DNAT --to-destination 192.168.211.252:47998-48000;" + iptables -t nat -A PREROUTING -p udp -i enp7s0 --dport 47998:48000 -j DNAT --to-destination 192.168.211.252:47998-48000 + +# KDEConnect +iptables -t nat -C PREROUTING -p tcp -i enp7s0 --dport 1714:1764 -j DNAT --to-destination 192.168.211.252:1714-1764 || \ + iptables -t nat -A PREROUTING -p tcp -i enp7s0 --dport 1714:1764 -j DNAT --to-destination 192.168.211.252:1714-1764 + +iptables -t nat -C PREROUTING -p udp -i enp7s0 --dport 1714:1764 -j DNAT --to-destination 192.168.211.252:1714-1764 || \ + iptables -t nat -A PREROUTING -p udp -i enp7s0 --dport 1714:1764 -j DNAT --to-destination 192.168.211.252:1714-1764 |