Re: Two NICs, same network...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 8 May 2007, semi linux wrote:

I've got an odd problem where I've got two NICs on the same network
and I want all traffic to one IP to go out one interface and all other
traffic to use the second interface.  I'm going to try an simplify my
actual setup, because a lot of it makes no difference to this post...

I know this has to be a iptables sort of setup since the routing table
can only make a difference on different networks and not based on
looking for a specific IP address.

The question is:

eth0 IP: 10.1.1.1
eth1 IP: 10.1.1.2

target: 10.1.1.3

(these IPs are just examples, there are no hard-fast rules surrounding
the other possibilities)

How do I make sure this goes out eth1 instead of eth0?  Do I use the
mangle rule with the physdev module?

I feel like I'm overlooking something or forgetting my basic network
ideas here...

you haven't quite given enough info here

if you have target2 10.1.1.4 and you want all traffic to target to go out eth0 and all traffic to target2 to go out eth1 then you would want to start out with defining host routes (the routing table _can_ look at specific hosts, not just networks)

in addition, I believe that you will need to play around with arp filtering to make sure that each NIC only responds to arp requests for it's IP addresses.

if you really only have one remote IP address and two local addresses and you want all communications between the target and 10.1.1.1 to use eth0 while all communications between the target and 10.1.1.2 to use eth1 things get more complicated

you would need to look into packet/connection tagging and iptables routeing decisions.

rather then try and go into that right now why don't you try to be a little clearer about exactly what you are trying to do.

David Lang


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux