I have a system with two interfaces. Both interfaces are connected to the internet. One of them is set as the default route; a side effect of this is that if a packet comes in on the non-default-route interface, the reply is sent back through the default route interface. Is there a way to use iptables (or something else) to track the connection and send the reply back through the interface it came from?
The above doesn't require any packet marking with ipfilter. It works because the outgoing (reply) packets will have the IP address that was originally used to connect to the 2nd interface as the source (from) address on the outgoing packet. |
|||||
|
|
The following commands create an alternate routing table via
The other half of the job is recognizing packets that must get the mark 1; then use
I'm not sure if that's enough, maybe another rule is needed on the incoming packets to tell the conntrack module to track them. |
|||
|
|