I have a server with two routes to the internet.
Router A with a MAC address of 12:34:56:78:90:AB
and
Router B with a MAC address of CD:EF:12:34:56:78
It is a linux box. I want to force it to route return packets via the router
that the original packet came from. I was thinking something like:
Use iptables on the server to add an fwmark of 1 to in-bound packets
originating
from Router A
and an fwmark of 2 to packets originating from Router B
iptables -t mangle -A INPUT -m mac --mac-source 12:34:56:78:90:AB -j
MARK --set-mark 1
iptables -t mangle -A INPUT -m mac --mac-source CD:EF:12:34:56:78 -j
MARK --set-mark 2
then use iproute to add a routing rule based on the fwmark
ip rule add fwmark 1 table <something something something>
ip rule add fwmark 2 table <something something something>
What I don't know is...
does a return packet inherit an fwmark from the originating packet? If it
doesn't, then marking the in-bound packet is pointless.
Can someone that has wrestled with this problem give me a few pointers. This
must be a reasonably common need, is there a standard methodology for
dealing with it?
Thanks.