IP address. - TCP-IP

This is a discussion on IP address. - TCP-IP ; From: "khan" Newsgroups: comp.os.ms-windows.networking.tcp-ip Subject: IP address. Date: Mon, 19 Jun 2006 03:45:21 -0700 I wanted to clarify, how the IP address is matched and forwarded. This is my understanding. Let us consider your working on a machine "X" with ...

+ Reply to Thread
Results 1 to 10 of 10

Thread: IP address.

  1. IP address.

    From: "khan"
    Newsgroups: comp.os.ms-windows.networking.tcp-ip
    Subject: IP address.
    Date: Mon, 19 Jun 2006 03:45:21 -0700

    I wanted to clarify, how the IP address is matched and forwarded.
    This is my understanding.
    Let us consider your working on a machine "X" with IP address is
    192.168.1.220, a IP packet is received with destination IP as
    192.168.1.220(i.e machine "X" itself is the destination).Let the
    subnet mask be 255.255.255.0.With this subnetmask, network id will be
    192.168.1 and host id will be 220.

    Now there are two possibilities according to me.

    1. Check the routing table & match the entire IP address if it matches
    completely and is the local IP address, pass the packectto transport
    layer of local machine.or else just forwards the packet to next
    appropriate router or to the host machine. or

    2.First the network part is compared and if matches, the host part is
    compared If matches,passes packet to the transport layer of local
    machine.


  2. Re: IP address.

    In article <1150714050.134346.319760@p79g2000cwp.googlegroups. com>,
    khan wrote:

    >I wanted to clarify, how the IP address is matched and forwarded.
    >This is my understanding.
    >Now there are two possibilities according to me.


    >1. Check the routing table & match the entire IP address if it matches
    >completely and is the local IP address, pass the packectto transport
    >layer of local machine.or else just forwards the packet to next
    >appropriate router or to the host machine. or


    >2.First the network part is compared and if matches, the host part is
    >compared If matches,passes packet to the transport layer of local
    >machine.


    Your #1 allows for routing to other machines, but your #2 does not.
    If you are not going to allow routing, then your #2 is not as efficient
    as it could be: you might as well just compare the -entire- destination
    IP address against each of the complete IP addresses assigned to that
    interface. If you are not going to allow routing, then knowing that
    an IP address is in the same network but is not your own address
    is not of any benefit.

    On small machines, comparing against the known IP address might be
    used. On larger machines (machines on which multiple interfaces are
    expected), the routing table is likely used for all traffic. There are
    a number of different ways to implement routing tables.

  3. Re: IP address.

    Hello,

    khan wrote :
    >
    > I wanted to clarify, how the IP address is matched and forwarded.
    > This is my understanding.
    > Let us consider your working on a machine "X" with IP address is
    > 192.168.1.220, a IP packet is received with destination IP as
    > 192.168.1.220(i.e machine "X" itself is the destination).Let the
    > subnet mask be 255.255.255.0.With this subnetmask, network id will be
    > 192.168.1 and host id will be 220.


    All that subnet stuff is irrelevant regarding routing. No need to
    mention it.

    > Now there are two possibilities according to me.
    >
    > 1. Check the routing table & match the entire IP address if it matches
    > completely and is the local IP address,


    Check if the destination address matches any local host prefix in the
    routing table. E.g. the loopback interface has a whole prefix
    127.0.0.0/8, and not only the single address 127.0.0.1.

    > pass the packet to transport
    > layer of local machine.or else just forwards the packet to next
    > appropriate router or to the host machine.


    Else, check if the destination address matches any non local host prefix
    in the routing table and route accordingly.

  4. Re: IP address.

    In article <1150714050.134346.319760@p79g2000cwp.googlegroups. com>,
    "khan" wrote:

    > From: "khan"
    > Newsgroups: comp.os.ms-windows.networking.tcp-ip
    > Subject: IP address.
    > Date: Mon, 19 Jun 2006 03:45:21 -0700
    >
    > I wanted to clarify, how the IP address is matched and forwarded.
    > This is my understanding.
    > Let us consider your working on a machine "X" with IP address is
    > 192.168.1.220, a IP packet is received with destination IP as
    > 192.168.1.220(i.e machine "X" itself is the destination).Let the
    > subnet mask be 255.255.255.0.With this subnetmask, network id will be
    > 192.168.1 and host id will be 220.
    >
    > Now there are two possibilities according to me.
    >
    > 1. Check the routing table & match the entire IP address if it matches
    > completely and is the local IP address, pass the packectto transport
    > layer of local machine.or else just forwards the packet to next
    > appropriate router or to the host machine. or
    >
    > 2.First the network part is compared and if matches, the host part is
    > compared If matches,passes packet to the transport layer of local
    > machine.


    The network mask and routing table are only used when SENDING packets.
    If the machine has IP forwarding enabled and receives a packet whose
    destination doesn't match one of its own addresses, THEN it will use the
    mask and routing table to determine how to forward it.

    --
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***
    *** PLEASE don't copy me on replies, I'll read them in the group ***

  5. Re: IP address.

    Barry Margolin a écrit :
    >
    > The network mask and routing table are only used when SENDING packets.


    On certain OSes at least (e.g. Linux), the routing table is used either
    when receiving or sending a packet. The network mask is not used for
    routing, as the routing table already contains its own masks/prefix
    lengths. The network mask is a setup parameter used to build the routing
    table, not an operational parameter used for routing.

    > If the machine has IP forwarding enabled and receives a packet whose
    > destination doesn't match one of its own addresses, THEN it will use the
    > mask and routing table to determine how to forward it.


    Again, it won't use the mask but only the routing table.

  6. Re: IP address.


    Pascal Hambourg wrote:
    > Hello,
    >
    > khan wrote :
    > >
    > > I wanted to clarify, how the IP address is matched and forwarded.
    > > This is my understanding.
    > > Let us consider your working on a machine "X" with IP address is
    > > 192.168.1.220, a IP packet is received with destination IP as
    > > 192.168.1.220(i.e machine "X" itself is the destination).Let the
    > > subnet mask be 255.255.255.0.With this subnetmask, network id will be
    > > 192.168.1 and host id will be 220.

    >
    > All that subnet stuff is irrelevant regarding routing. No need to
    > mention it.
    >
    > > Now there are two possibilities according to me.
    > >
    > > 1. Check the routing table & match the entire IP address if it matches
    > > completely and is the local IP address,

    >
    > Check if the destination address matches any local host prefix in the
    > routing table. E.g. the loopback interface has a whole prefix
    > 127.0.0.0/8, and not only the single address 127.0.0.1.
    >
    > > pass the packet to transport
    > > layer of local machine.or else just forwards the packet to next
    > > appropriate router or to the host machine.

    >
    > Else, check if the destination address matches any non local host prefix
    > in the routing table and route accordingly.


    does *nix e.g. FREEBSD also use the routing table to store local host
    / loopback network?


    when it comes to directly connected networks, for 'next hop', do they
    include the interface there (even though it's not really a hop away) ?
    or do they have some value meaning n/a ?
    and 'persumably' the interface for that directly connected network
    stored elsewhere

    and what is the name of that function (not routing surely!) where a
    host checks if the dest ip of the packet to send is local or remote,
    writes the relevant dest mac and forwards it out the (usually the same)
    interface ?

    thanks


  7. Re: IP address.

    q_q_anonymous@yahoo.co.uk a écrit :
    >
    > does *nix e.g. FREEBSD also use the routing table to store local host
    > / loopback network?


    I don't know about *BSD. Do you include Linux in *nix ?

  8. Re: IP address.


    Pascal Hambourg wrote:
    > q_q_anonymous@yahoo.co.uk a écrit :
    > >
    > > does *nix e.g. FREEBSD also use the routing table to store local host
    > > / loopback network?

    >
    > I don't know about *BSD. Do you include Linux in *nix ?


    yes, though I guess then the q qould be along the lines of "does
    ipchains or iptables..."


  9. Re: IP address.

    q_q_anonymous@yahoo.co.uk a écrit :
    >
    > does *nix e.g. FREEBSD also use the routing table to store local host
    > / loopback network?


    I can talk only about Linux. Linux has a special 'local' routing table
    with higher priority than the 'main' routing table, which contains local
    routes, that is routes whose destinations are the host itself. Here is a
    example on a box with two ethernet interfaces eth0 and eth1 with
    addresses 192.168.0.1/24 and 10.0.0.1/8, and the loopback interface lo
    with address 127.0.0.1/8 :

    local 10.0.0.1 dev eth1 proto kernel scope host src 10.0.0.1
    local 192.168.0.1 dev eth0 proto kernel scope host src 192.168.0.1
    local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
    local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1

    Just to mention, the local table also contains the link local broadcast
    routes (not listed above).

    > when it comes to directly connected networks, for 'next hop', do they
    > include the interface there (even though it's not really a hop away) ?
    > or do they have some value meaning n/a ?
    > and 'persumably' the interface for that directly connected network
    > stored elsewhere


    Direct routes have no next hop/gateway (sometimes reported as 0.0.0.0),
    only an output interface :

    Destination Gateway Genmask Flags Metric Ref Use Iface
    192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1

    or, using the same format as the above local routing table :

    192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.1
    10.0.0.0/8 dev eth1 proto kernel scope link src 10.0.0.1

    > and what is the name of that function (not routing surely!) where a
    > host checks if the dest ip of the packet to send is local or remote,
    > writes the relevant dest mac and forwards it out the (usually the same)
    > interface ?


    For me that's routing.

  10. Re: IP address.


    Pascal Hambourg wrote:
    > q_q_anonymous@yahoo.co.uk a écrit :
    > >
    > > does *nix e.g. FREEBSD also use the routing table to store local host
    > > / loopback network?

    >
    > I can talk only about Linux. Linux has a special 'local' routing table
    > with higher priority than the 'main' routing table, which contains local
    > routes, that is routes whose destinations are the host itself. Here is a
    > example on a box with two ethernet interfaces eth0 and eth1 with
    > addresses 192.168.0.1/24 and 10.0.0.1/8, and the loopback interface lo
    > with address 127.0.0.1/8 :
    >
    > local 10.0.0.1 dev eth1 proto kernel scope host src 10.0.0.1
    > local 192.168.0.1 dev eth0 proto kernel scope host src 192.168.0.1
    > local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
    > local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
    >
    > Just to mention, the local table also contains the link local broadcast
    > routes (not listed above).
    >
    > > when it comes to directly connected networks, for 'next hop', do they
    > > include the interface there (even though it's not really a hop away) ?
    > > or do they have some value meaning n/a ?
    > > and 'persumably' the interface for that directly connected network
    > > stored elsewhere

    >
    > Direct routes have no next hop/gateway (sometimes reported as 0.0.0.0),
    > only an output interface :
    >
    > Destination Gateway Genmask Flags Metric Ref Use Iface
    > 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
    > 10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1
    >
    > or, using the same format as the above local routing table :
    >
    > 192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.1
    > 10.0.0.0/8 dev eth1 proto kernel scope link src 10.0.0.1
    >
    > > and what is the name of that function (not routing surely!) where a
    > > host checks if the dest ip of the packet to send is local or remote,
    > > writes the relevant dest mac and forwards it out the (usually the same)
    > > interface ?

    >
    > For me that's routing.


    Thank You


+ Reply to Thread