Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
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 6:58
    
is this not a one line iptables config? –  shapeshifter Sep 19 '12 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 '12 at 7:32

1 Answer 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?

share|improve this answer
    
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 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. –  user1008764 Sep 19 '12 at 8:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.