On 19 Mar 2007, in the Usenet newsgroup comp.os.linux.networking, in article
<(E-Mail Removed) .com>,
(E-Mail Removed)
wrote:
>Suppose you have two network cards on the same PC
>and connect them to a Linksys router and the router assigns
>192.168.1.100 and 192.168.1.101
>
>I want to test a UDP code that sends to one of these IP addresses
>through the router.
>
>However, the table route seem to force a loopback,
>i.e. it knows that the destination IP address is on the same PC so
>the router is never reached.
You have two choices. You can hack the networking code, and eliminate
the loopback function - this doesn't mean disabling the interface, but
actually re-working the stack so that the bits are sent out the appropriate
interface. Good luck with that, as the task is not simple.
The other choice would be to configure the Linksys router to act as a NAT
(network address translator) device - such that it accepts packets for
(example) 192.168.2.xxx and translates the address to the "other"
192.168.1.xxx destination. This will still have problems, as the _replies_
will be routed via the loopback as they will have source and destination
addresses on the same 192.168.1.xxx network.
>I want to force a looparound, where datagrams destined for IP2 go out
>on IP1 card to the router, and back on card IP2, obviously making sure
>they do not go out again on IP1 in a loop but to the receiving code.
This will work for "one-way" traffic, but not for TCP or anything that
required a reply of any form.
>Is making changes to the route table the only solution? How?
You've decided that the single/computer, two NIC method will solve some
problem - but you need to find a more appropriate solution to what ever
that original question is.
Old guy