Re: getting the NIC that my socket connection will go on

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 17, 2003 at 05:27:31PM -0500, Lee Chin wrote:
> Hi,
> I have an IP address I want to connect to.  How can I tell what NIC Linux will use to make that connection on? 

Whichever NIC the routing-table indicates as suitable. In general, and
assuming that you have no "special" routing rules, if you want to
connect (i.e. transmit a packet) to "ip_addr", interfaces for which
the following property holds:

  nic_ip_addr & nic_mask == ip_addr & nic_mask

will be considered suitable. Of these, the one which has the most
"restrictive" mask (mask with most "1"s in it) will be used.

/npat

-- 
After they make styrofoam, what do they ship it in?
  -- Stephen Wright
-
: 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

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux