Port forwarding HTTP to an internal server


/sbin/iptables -t nat -A PREROUTING -p tcp -i ethX \
-d aaa.bbb.ccc.ddd –dport 80 -j DNAT –to eee.fff.ggg.hhh:80

/sbin/iptables -A FORWARD -p tcp -i ethX \
-d eee.fff.ggg.hhh –dport 80 -j ACCEPT

Where:
ethX is your public ethernet number
aaa.bbb.ccc.ddd is your public IP address
eee.fff.ggg.hhh is your interal IP address

Port 80 is the default port for HTTP, unless you changed it to something else on your servers, do the same on the two iptables parameters.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

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

%d bloggers like this: