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?

shapeshifter
  • 143
  • 1
  • 4
  • 1
    You need to provide more information like routing table `route -n` and interfaces IPs `ifconfig` and any other relevant config. – Khaled Sep 19 '12 at 06:58
  • is this not a one line iptables config? – shapeshifter Sep 19 '12 at 07: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 '12 at 07:32

1 Answers1

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?

user1008764
  • 1,176
  • 2
  • 8
  • 12
  • 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 '12 at 08: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. – user1008764 Sep 19 '12 at 08:19