3

I have a switch on which 4 modem/routers and 2 servers are connected. Each server has 2 processes running and 2 NICs connected. What I want is that each process is routed out of either one of the NICs, but having a different default gateway, so that the traffic goes to a different router for each process.

UPDATE 1:

Essentially what I want to do is this: Control, on the process level, what NIC the traffic goes out of.

UPDATE 2:

I know that with 'Network Namespaces" I can send traffic from a process out of a specific NIC. My issue here is that both NICs should be on the same subnet. At the same time, traffic from NIC-1 should be directed to ROUTER-1 and traffic from NIC-2 to ROUTER-2

UPDATE 3:

I am asking this from a Linux perspective.

2
  • This isn't how networking works. Default gateways are a system-wide "gateway of last resort" - they're not defined at the NIC level. – Dan Feb 6 '15 at 9:35
  • @Dan Please see my edit. – dlyk1988 Feb 6 '15 at 9:40
3

Since your question isn't spesific for any OS, I'll answer in some general way too.

This can be done two ways:

  • legacy way: you distinguish the processes by uid they run as, and for each specific uid you install specific packet filter rules that forward the traffic as you want. To different gateways, for example.
  • modern way: you bind each process to a specific routing table, thus the system routes the packet accordingly to the routing table.

Update: my answer still stands after both of your updates. :P

Still doable for Linux: LARTC is a good place to start. First, you create multiple routing tables, second, you create rules to assign specific kinds of traffic to these routing tables.

2
  • Could you be so kind as to see my third update and amend your answer? – dlyk1988 Feb 6 '15 at 9:44
  • yeah, sure. here it is. – drookie Feb 6 '15 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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