Hello,
What is the right way to determine on which interface card
(eth0 or eth1) will a packet be sent (according to the dest IP)?

I have a machine with two NICS (eth0 and eth1).
I have 2 different gateways.
I need to know on which interface (eth0 or eth1) will the
packet be send according to the dest IP.
I want to do in in a User Space function.

I think of one way to do this is:
Parse the routing table (/proc/net/route) as is done in
net-tools. (to be more specific rprint_fib() in lib/inet_gr.c
of net-tools.
Than according to the IP address and the netmask check if the
dest IP is for one gatway or the second.
If not - than it is the default gateway.

Is there another way ? Is it the correct way ?
Regards,
John
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to