Technology

Port Forward – Raspberry Pi for every boat.

nano /etc/rc.local

#port forward every boot
sysctl net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -p tcp --dport 801 -j DNAT --to-destination 192.168.1.1:80
iptables -t nat -A PREROUTING -p tcp --dport 802 -j DNAT --to-destination 192.168.1.2:80
iptables -t nat -A PREROUTING -p tcp --dport 803 -j DNAT --to-destination 192.168.1.3:80
iptables -t nat -A PREROUTING -p tcp --dport 804 -j DNAT --to-destination 192.168.1.4:80
iptables -t nat -A PREROUTING -p tcp --dport 805 -j DNAT --to-destination 192.168.1.5:80
iptables -t nat -A PREROUTING -p tcp --dport 806 -j DNAT --to-destination 192.168.1.6:80
iptables -t nat -A PREROUTING -p tcp --dport 807 -j DNAT --to-destination 192.168.1.7:80
iptables -t nat -A PREROUTING -p tcp --dport 808 -j DNAT --to-destination 192.168.1.8:80
iptables -t nat -A PREROUTING -p tcp --dport 809 -j DNAT --to-destination 192.168.1.9:80
iptables -t nat -A PREROUTING -p tcp --dport 8010 -j DNAT --to-destination 192.168.1.10:80
iptables -t nat -A PREROUTING -p tcp --dport 8011 -j DNAT --to-destination 192.168.1.11:80
iptables -t nat -A PREROUTING -p tcp --dport 8012 -j DNAT --to-destination 192.168.1.12:80
iptables -t nat -A PREROUTING -p tcp --dport 8013 -j DNAT --to-destination 192.168.1.13:80
iptables -t nat -A PREROUTING -p tcp --dport 8014 -j DNAT --to-destination 192.168.1.14:80
iptables -t nat -A PREROUTING -p tcp --dport 8015 -j DNAT --to-destination 192.168.1.15:80
iptables -t nat -A PREROUTING -p tcp --dport 8016 -j DNAT --to-destination 192.168.1.16:80
iptables -t nat -A PREROUTING -p tcp --dport 8017 -j DNAT --to-destination 192.168.1.17:80
iptables -t nat -A PREROUTING -p tcp --dport 8018 -j DNAT --to-destination 192.168.1.18:80
iptables -t nat -A PREROUTING -p tcp --dport 8019 -j DNAT --to-destination 192.168.1.19:80
iptables -t nat -A POSTROUTING -j MASQUERADE
#implement before exit 0
exit 0

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s