"wes chow" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> I've been playing with a multiple ethernet card configuration.  There's a
> lot of info online about how to deal with routing tables, *if the cards
> are on different networks*.  What I'm curious about is if I hook the two
> cards up to the same switch, with different IP addresses.  I'd like to be
> able to write servers that bind to the different addresses but run on
> the same machine.
>
> Problem is, I can't get it to work.  Here's ifconfig's output:
>
> eth0      Link encap:Ethernet  HWaddr 00:0C:6E:3D:F2:B0
>           inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:214294 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:168729 errors:0 dropped:0 overruns:0 carrier:168376
>           collisions:0 txqueuelen:100
>           RX bytes:40815289 (38.9 Mb)  TX bytes:115947325 (110.5 Mb)
>           Interrupt:10 Memory:ee000000-ee001080
>
> eth1      Link encap:Ethernet  HWaddr 00:50:BF:05:13:5F
>           inet addr:192.168.0.10  Bcast:192.168.0.255  Mask:255.255.255.0
>           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:30 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:100
>           RX bytes:3087 (3.0 Kb)  TX bytes:240 (240.0 b)
>           Interrupt:9 Base address:0x7000
>
>
> My routing table, though I don't think it matters:
>
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use
Iface
> 192.168.0.0     *               255.255.255.0   U     0      0        0
eth0
> 192.168.0.0     *               255.255.255.0   U     0      0        0
eth1
> loopback        localhost       255.0.0.0       UG    0      0        0 lo
> default         192.168.0.1     0.0.0.0         UG    1      0        0
eth0
>
>
> The computer with two ethernet cards is called milhouse, and a seperate
> machine on the network is boris.
>
> Now, when I ping 192.168.0.10 from boris, I only see eth0's light blink.
> I can completely disconnect eth1 and it still works.
>
> "ip neigh show"'s output:
>
> boris root # ip neigh show
> 192.168.0.2 dev eth0 lladdr 00:0c:6e:3d:f2:b0 nud reachable
> 192.168.0.10 dev eth0 lladdr 00:0c:6e:3d:f2:b0 nud reachable
>
> It shows that it thinks 192.168.0.10 belongs to eth0 of milhouse (based on
> the MAC address).  How do I get milhouse to accept traffic to 192.168.0.10
> only on eth1?  Is this possible at all?

Hi,

You have a very interesting setup over there and you have indeed god many
good advices so far.
What I am wondering about is that nobody has suggested using iproute2 for
this stuff.

Your setup reminds me of myself playing with load-balancing a while ago.

I think you should check out the Linux Advanced Routing & Traffic Control
HOWTO (and especially Chapter 4. of it).. www.lartc.org
Anyway, here is what I would do If I were you:

--script start--

#first creating routing table aliases
echo '102 table0' >> /etc/iproute2/rt_tables
echo '110 table1' >> /etc/iproute2/rt_tables

#then some definitions
NET0=192.168.0.0 #destination
GW0=192.168.0.1 #gateway

IFACE0=eth0
IFACE1=eth1
IP0=192.168.0.2
IP1=192.168.0.10


#then some action
ip route add $NET0 dev $IFACE0 src $IP0 table table0
ip route add default via $GW0 table table0

ip route add $NET0 dev $IFACE1 src $IP1 table table1
ip route add default via $GW0 table table1



#these you already have in place...
ip route add $NET0 dev $IFACE0 src $IP0
ip route add $NET0 dev $IFACE1 src $IP1
ip route add default via $GW0


#final steps
ip rule add from $IP0 table table0
ip rule add from $IP1 table table1

---script end--

Now your incoming packets should go the correct interface regarding its
IP-address.

Hope this works for you, if not then reading the LARTC HOWTO should help you
with fixing your configuration!

good luck
--kirler






--
[EMAIL PROTECTED] mailing list

Reply via email to