0

I want to forward traffic destined for a specific ip from my internal network via a specific interface. I have two interfaces which are currently load balanced. I need all requests for a certain ip to go out via eth0 otherwise my external ip changes and sessions are dropped.

eg. all requests from 10.1.1.1/24 to ip 11.22.33.44 on port 443 must go out via interface eth0.

How can I do this with iptables?

3
  • 1
    You need to provide more information like routing table route -n and interfaces IPs ifconfig and any other relevant config.
    – Khaled
    Sep 19, 2012 at 6:58
  • is this not a one line iptables config? Sep 19, 2012 at 7:21
  • 1
    I am asking this because there could be no need to do anything at if for example you have the default gateway setup via interface eth0. So, you need to provide more information to get better help. Otherwise, we should start guessing.
    – Khaled
    Sep 19, 2012 at 7:32

1 Answer 1

1

ok in my understanding you would like to route all traffic out on eth1 except traffic from 10.1.1.1 to 11.22.33.44.this traffic should go out on eth0. in this case you had to configure policy routing. i answered a question like this last week. have a look at:

How can I route different traffic over different interfaces (routes) by protocol?

2
  • policy routing is for making routing decisions based on anything aside destination ip address. For destination IP criteria a good old routing fits perfect.
    – DukeLion
    Sep 19, 2012 at 8:11
  • but in his routing decision source ip and destination port is used to make a routing decision. so i think policy routing is that what he need. Sep 19, 2012 at 8:19

You must log in to answer this question.

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