Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iptables question 1

Status
Not open for further replies.
Jan 9, 2008
1
US
can someone tell me what does the following line mean ? sorry my background is checkpoint

EXTERNAL_WEB_SERVER=151.200.87.181
INTERNAL_WEB_SERVER=192.168.1.22
iptables -t nat -A PREROUTING -p tcp -d $EXTERNAL_WEB_SERVER --dport https -j DNAT --to $INTERNAL_WEB_SERVER:10000


iptables -t nat -A PREROUTING -p tcp -s 210.245.110.133 -d $EXTERNAL_WEB_SERVER --dport 4141 -j DNAT --to $INTERNAL_WEB_SERVER:80
 
This block sets two variables with IP Addresses
Code:
EXTERNAL_WEB_SERVER=151.200.87.181
INTERNAL_WEB_SERVER=192.168.1.22

This line sets a Destination NAT (DNAT). Any TCP packet received by this machine destined for port 443 (https) at 151.200.87.181 will be rewritten to a new destination, port 10000 at 192.168.1.22.
Code:
iptables -t nat -A PREROUTING -p tcp -d $EXTERNAL_WEB_SERVER --dport https -j DNAT --to $INTERNAL_WEB_SERVER:10000

Another DNAT. Only TCP packets from 210.245.110.133 destined for port 4141 at 151.200.87.181 will be rewritten to port 80 (http) at 192.168.1.22.
Code:
iptables -t nat -A PREROUTING -p tcp -s 210.245.110.133 -d $EXTERNAL_WEB_SERVER --dport 4141 -j DNAT --to $INTERNAL_WEB_SERVER:80

Then the packets are passed to the FORWARD chain (and so on) for further processing. Like so

Inbound -> PREROUTING -> FORWARD -> POSTROUTING -> Outbound
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top