Linux Routing with Multiple Network Interfaces

interfacelinuxrouting

My server has 2 network card installed and I manage to get it up and running. I can ping both interface but I can not ssh or access any service (ie web/ftp) if I connect using second interface.

Both network card have 2 different IP address and live on different subnet.

How do I create routing table so packet are returned via the interface where the packet coming from ie : "if packet coming to eth0, it should come out from eth0 using eth0 gateway. If packet is coming from eth1, then the outgoing response also coming out from eth1 using eth1 gateway"

Is this possible ?

Best Answer

Yes, this is possible using policy based routing. You need to use ip route and ip rule commands

Related Topic