How does a computer choose a network interface? - TCP-IP

This is a discussion on How does a computer choose a network interface? - TCP-IP ; If my computer has two routable network interfaces: Address: 24.68.32.202 Subnet Mask: 255.255.255.192 Address: 80.42.150.10 Subnet Mask: 255.255.255.0 And I try to connect to address 24.68.40.10 which is not on the same subnet of either interface, how does the computer ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: How does a computer choose a network interface?

  1. How does a computer choose a network interface?

    If my computer has two routable network interfaces:

    Address: 24.68.32.202
    Subnet Mask: 255.255.255.192

    Address: 80.42.150.10
    Subnet Mask: 255.255.255.0

    And I try to connect to address 24.68.40.10 which is not on the same
    subnet of either interface, how does the computer choose which
    interface to use? Is it assumed that simply because an address is
    routable, it is potentially connectable to the internet and thus
    either interface may be used?

    Thanks

  2. Re: How does a computer choose a network interface?

    In article ,
    wrote:
    >If my computer has two routable network interfaces:
    >
    >Address: 24.68.32.202
    >Subnet Mask: 255.255.255.192
    >
    >Address: 80.42.150.10
    >Subnet Mask: 255.255.255.0
    >
    >And I try to connect to address 24.68.40.10 which is not on the same
    >subnet of either interface, how does the computer choose which
    >interface to use? Is it assumed that simply because an address is
    >routable, it is potentially connectable to the internet and thus
    >either interface may be used?


    No, it depends on the routing table.

    --
    -- Rod --
    rodd(at)polylogics(dot)com

  3. Re: How does a computer choose a network interface?

    Details can very by stack, but in broad handwaving terms, the logic is
    something like:

    Look for a route to the exact destination - aka a host route - one
    where all the bits of the destination of the route match the packet's
    destination. If there is one, use that. If not, next step.

    Look for a route to a matching (sub)net - aka a subnet route. If
    there is one, use that. If not, next step.

    Look for a "default" route - this is the route to use when there are
    no previous matches.

    There can be variations where the source IP address is included in the
    route lookup. Some stacks may have multiple default routes. "Ties"
    between routes (equal matches among routes of the same type) may be
    broken by amorphous things like "metrics" specified when the route is
    created.

    Now, as to _how_ that routing table is populated, that is a whole
    different story, all together...

    rick jones
    --
    The glass is neither half-empty nor half-full. The glass has a leak.
    The real question is "Can it be patched?"
    these opinions are mine, all mine; HP might not want them anyway...
    feel free to post, OR email to rick.jones2 in hp.com but NOT BOTH...

  4. Re: How does a computer choose a network interface?

    In article ,
    Rick Jones wrote:

    >Look for a route to the exact destination - aka a host route - one
    >where all the bits of the destination of the route match the packet's
    >destination. If there is one, use that. If not, next step.
    >
    >Look for a route to a matching (sub)net - aka a subnet route. If
    >there is one, use that. If not, next step.
    >
    >Look for a "default" route - this is the route to use when there are
    >no previous matches.



    There is a detail missing from that is too obvious to mention for those
    who already know the answer to the question, but might not be obvious
    to the person who asked it. The detail is that each entry in a
    typical host routing (forwarding) table contains all of the following
    information (and often more):

    1. destination network address of the route, such as 10.0.0.0 or 192.168.3.4
    2. destination netmask such as 255.0.0.0 (/8) or 255.255.255.255 (/32)
    3. network interface from which to send packets along the route
    4. the gateway or address of the router that will forward packets

    The `netstat -r` command is often available to dump your computer's
    routing table, including the network interface associated with each
    route.


    Vernon Schryver vjs@rhyolite.com

  5. Re: How does a computer choose a network interface?

    On 2008-06-06 12:51:20 -0400, agendum97@gmail.com said:

    > And I try to connect to address 24.68.40.10 which is not on the same
    > subnet of either interface, how does the computer choose which
    > interface to use? Is it assumed that simply because an address is
    > routable, it is potentially connectable to the internet and thus
    > either interface may be used?



    Another important thing from the routing protocol world - packets will
    get routed through the interface where the most specific route is
    (longest netmask match) - so, if the routing table for your host had an
    entry that routed 1.2.3.4 through interface A, and the default route
    was on interface B, or even the subnet was on interface B, it would
    attempt to go out A (this example is deliberately broken).

    This really only comes into play in the routing protocol world, and
    I'll leave a discussion of that (mercifully) out of this post.

    --
    _ __ _
    __| |_ __ / _| |_ 01100100 01101101
    / _` | ' \| _| ' \ 01100110 01101000
    \__,_|_|_|_|_| |_||_| dmfh(-2)dmfh.cx


+ Reply to Thread