nick wrote: > Hi folks, > > Yesterday I asked a question on this mailing list regarding a > multi-homed host, and big thanks to Ralph's kind responose. But I think > i'm still puzzled by the symptom. So I'd like to rephrase my question as > follows: > My multi-homed host have two ethernet interfaces, their ip addreses > are not on the same subnet. The only routing rule is "default gateway > via eth0" besides the usual direct links. > This host may send out a packet spontaneously (f.e. I issue a ping > comand from this host), or send out a packet in response to a coming-in > packet (f.e. someone thousands miles away is pinging this host). In each > case, the outgoing packet must have a source address in its ip header. > In the first case, my guess is that the src addr would be determined by > the route (,therefore using eth0's ip). For the 2nd case, the "ideal" > src addr should be taken from the dst addr of the incoming packet. > Therefore, if someone is pinging my host through eth1's IP, then my host > should respond a packet whose src addr is eth1's IP. > Am I right? If my host is not behaving like this, what could have > gone wrong with my configuration? How can I trace this in the kernel? > Which kernel code should I look into for answer? linux/net/ip_output.c? > Linux's TCP/IP stack is huge to me, I kindof lost in it... > > Thanks, > -nick > Have another look at LARTC. It works this way: Create two new tables in /etc/iproute2/rt_tables, say eth0.out and eth1.out. Execute the following commands: ip route add default via <eth0 gw> table eth0.out ip route add default via <eth1 gw> table eth1.out ip rule add from <eth0 ip> lookup eth0.out ip rule add from <eth1 ip> lookup eth1.out ip route flush cache Bye, Patrick - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html