IP-restricted port forwarding with iptables

Posted by Tom on Server Fault See other posts from Server Fault or by Tom
Published on 2010-06-09T02:58:39Z Indexed on 2010/06/09 3:02 UTC
Read the original article Hit count: 223

Filed under:
|

For an example, I have two authorized client computers, 1.1.1.1 and 2.1.1.1. My server running iptables is 3.1.1.1 and my firewalled web server is 4.1.1.1. When one of the authorized client IPs connects to 3.1.1.1 on port 80, I would like the connection to be forwarded to 4.1.1.1 on port 8888. If any other IP attempts to connect I would like it to refuse/drop the connection. What iptables config would accomplish this? Is there something more specific out there that would be better suited for this job?

© Server Fault or respective owner

Related posts about iptables

Related posts about port-forwarding