#!/bin/bash
public_address=
'132.98.83.2'
local_address=
'172.19.121.211'
lan_destination_address_prefix=
'172.19.121.'
lan_address=`
seq
13 32`
for
the_address
in
${lan_address}
do
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}04 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:5188
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}05 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:51888
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p udp -m udp --dport 3${the_address}06 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:47998
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p udp -m udp --dport 3${the_address}07 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:47999
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p udp -m udp --dport 3${the_address}08 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:48000
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}15 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:47996
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}17 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:47995
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}18 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:49008
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}19 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:49034
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}20 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:47998
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}21 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:47999
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}22 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:48000
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p udp -m udp --dport 3${the_address}23 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:47995
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}24 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:50000
iptables -t nat -A PREROUTING -d ${public_address}
/32
-p tcp -m tcp --dport 3${the_address}25 -j DNAT --to-destination ${lan_destination_address_prefix}${the_address}:47997
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 5188 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 51888 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p udp -m udp --dport 47998 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p udp -m udp --dport 47999 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p udp -m udp --dport 48000 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 47996 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 47995 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 49008 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 49034 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 47998 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 47999 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 48000 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p udp -m udp --dport 47995 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 50000 -j SNAT --to-
source
${local_address}
iptables -t nat -A POSTROUTING -d ${lan_destination_address_prefix}${the_address}
/32
-p tcp -m tcp --dport 47997 -j SNAT --to-
source
${local_address}