Re: 2 NICs on same subnet

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

 



Sven Schuster wrote:
Hi everybody,

I have a problem which I'm quite sure can be resolved easily, but
at the moment I'm lacking the "how" :-)
I have a machine (RH ES 3) with two Intel e1000 cards attached to
a gigabit switch, each interface is assigned an IP address on the
same subnet (say 1.2.3.4 on eth0 and 1.2.3.5 on eth1).
What's happening is that if a connection to either of these addresses
is made, it's always received via the same interface (eth1 most of the
time), and the replies go out via this interface, too. But what I'd
like is that packets to 1.2.3.4 come in via eth0 and packets to 1.2.3.5
come in via eth1 and that replies from 1.2.3.4 leave via eth0, from
1.2.3.5 via eth1.
I've already tried to resolve this issue with arptables, doing

Probably not easilly solvable. The thing is that both interfaces are valid for sending responses out. So the kernel will probably use the first where it gets the match (not sure about exact algorithm, so it may as well be the last, or random).


Anyhow, said that, there are couple of things to try out.

For incomming packets, I do remember that there's kernel option to instruct Linux kernel to send ARP responses from matching interface, instead of interface ARP request was made on (ARP request is broadcast, so both interfaces will get it, and by default Linux doesn't send from "matching" interface). This way, client will get correct MAC address, and switch will send packets down the correct wire. Might help, but on the other hand it might not.

For outgoing packets, mark packets in INPUT chain of mangle table with different marks depending if source is 1.2.3.4 or 1.2.3.5. Than you can use fwmark with Linux Advanced Routing (see examples in howto, http://www.lartc.org/lartc.txt, chapter 11) to route packets to eth0 or eth1 depending on the fwmark. Should work (tm).

--
Aleksandar Milivojevic <amilivojevic@xxxxxx>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7


[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