#!/bin/sh
set -x && wget -qO- http://ipecho.net/plain > ./public_ip.txt
for IP in $(cat ./public_ip.txt); do iptables -t nat -A PREROUTING -d $IP -m tcp -p tcp --dport 80 -j DNAT --to-destination 192.168.1.171; done
iptables -t nat -A POSTROUTING -d 192.168.1.171 -s 192.168.1.0/24 -j SNAT --to-source 192.168.1.1 && rm -f ./public_ip.txt