0

Sidenote

This question is nearly the same to this question: Forward all traffic on a specific port depending on the domain to another port but I have a totally different aim with my one.*

Schematic

I want to have an IPTABLE rule for this schematic: click to open image.

Description of Image

  • Traffic from 123.123.123.1 which accesses 123.123.123.3:80 is NOT going to be forwarded.
  • Traffic from 123.123.123.2 which accesses 123.123.123.3:80 IS going to be forwarded to 123.123.123.3:8080

I already went through http://www.howtoforge.com/nat_iptables and other pages about NAT and stuff but I couldn't manage to figure it out.

1 Answer 1

0

You should be able to set the source IP address as an argument and take the desired action accordingly:

# Reject forwards from 123.123.123.1 to 123.123.123.3 on port 80 TCP
iptables -A FORWARD -s 123.123.123.1 -d 123.123.123.3 -p TCP --dport 80 -j REJECT

# But accept forwards from 123.123.123.2 to 123.123.123.3 to port to TCP
iptables -A FORWARD -s 123.123.123.2 -d 123.123.123.3 -p TCP --dport 80 -j ACCEPT

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .