netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: "John Que" <qwejohn@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: determine outgoing interface (eth0,eth1) for a packet according to the dest IP
Date: Tue, 25 Apr 2006 09:43:49 +0200	[thread overview]
Message-ID: <200604250943.49422.ak@suse.de> (raw)
In-Reply-To: <ada605fb0604250031r2e4a74e7id0b5079fabde9517@mail.gmail.com>

On Tuesday 25 April 2006 09:31, John Que wrote:
> 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)?

You can send a rtnetlink RTM_GETROUTE message to ask the kernel.
Result is the interface index in RTA_OIF, which can be converted
into a name.

-Andi


  reply	other threads:[~2006-04-25  7:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-25  7:31 determine outgoing interface (eth0,eth1) for a packet according to the dest IP John Que
2006-04-25  7:43 ` Andi Kleen [this message]
2006-04-25  7:58   ` David S. Miller
2006-04-25 14:44   ` John Que
2006-04-25 14:48     ` Andi Kleen
2006-04-26 10:24       ` John Que
2006-04-26 13:58         ` Herbert Xu
2006-04-30  9:17           ` Lennert Buytenhek
2006-04-30 12:55             ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200604250943.49422.ak@suse.de \
    --to=ak@suse.de \
    --cc=netdev@vger.kernel.org \
    --cc=qwejohn@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).