I'm wondering if it is possible to route a same packet differently based on which interface it comes from. For example, there are two Ethernet interfaces on a Linux box, eth1 and eht2. for IP packets with same destination and source IP addresses, if the packet comes from eth1, then next hop will be IP-X and if the packet comes from eth2 the next hop will be IP-Y.
|
feedback
|
|
Yes, you can do it exactly like that. However, you probably don't really want to. The problem with these kinds of schemes is that they tend to break traffic in the other direction and as a result, the network doesn't work. What you probably actually want is source-based routing. Linux permits you to create multiple routing tables. Each one can have its own separate routes and gateway. You can then choose which routing table is used by a packet based on the interface it's received on or the source address. Typically the source address is what you really want. For example, that's the sensible way to connect a single machine to more than one Internet connection. | |||
|
feedback
|