I carefuly read your message, but the aim of your trying is still hiden for me :-(.
Basically if assigning two or more IP's from the same network IP alias is the best choice. If for some reason usage of diferent interfaces is needed, you should split the network into subnetworks (using NETMASK), so every iface has its own network ... and you can apply everything you learned about "cards on diferent networks" :-). Please read comments in text.
wes chow wrote:
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.
The reason is in the manner how kernel networking routines worx and fact, that both ifaces are on the same network. You shall be able to ping it even if stoping IP forwarding.
"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?
Hmm ... you can stop access to 192.168.0.10 on eth0 by firewall rules, but you will not be able to connect to 192.168.0.10 on eth1 anyway.
To get it work you should adjust interfaces similar to this:
ifconfig eth0 192.168.0.2 netmask 255.255.255.128 broadcast 192.168.0.255 (or 128)
ifconfig eth1 192.168.0.130 netmask 255.255.255.128 broadcast 192.168.0.255
so, on eth0 is (sub)network 192.168.0.0/25 and on eth1 192.168.0.128/25,
but from boris you'll be able directly ping only the iface on the same network,
the second only if IP forwarding (and firewall) allows it.
noro
-- [EMAIL PROTECTED] mailing list
