Options

TCP vs IP question

victorouvictorou Member Posts: 15 ■□□□□□□□□□
I'm kind of confused of what's the different job TCP and IP do. Any one can explain this for me using an virtual example, such as a driver driving a car on the road.?

One more question, in my book, it says, if IP knows the destination of the datagram, it sends the datagram on its way, if it doesn't know, IP sends the datagram to the host's default gateway. Does it mean the datagram can travel a shorter way if IP understands its header rather than a longer route if IP doesn't icon_confused.gif: Can Tracert show me if the datagram has taken a shorter route?

Thanks all.
BS in Information Technology
Certs: A+, Network+, MCP(70-270, 70-290)

Comments

  • Options
    WebmasterWebmaster Admin Posts: 10,292 Admin
    in my book, it says, if IP knows the destination of the datagram, it sends the datagram on its way, if it doesn't know, IP sends the datagram to the host's default gateway. Does it mean the datagram can travel a shorter way if IP understands its header rather than a longer route if IP doesn't
    No that has nothing to do with it. It means that the destination IP is in the same subnet as the source IP address, hence the packet can be delivered without the help of a router. This also means that the destination and source are both on the same broadcast domain. It doesn't need layer 3 connectivity (ie. a router) to route the packet to another broadcast domain (ie. LAN, subnet). In such a situation the network device (ie. computer) will use layer 2 funtionality. This is possible because when the source knows the destination is on the same broadcast domain, it will use the ARP protocol to send out a broadcast requesting the network device with the destination IP to respond with its MAC address.

    If the destination IP is not on the same subnet as the source IP, the source will assume it needs to be routed to a different subnet (broadcast domain, ie. LAN on other side of WAN link) and hence will send it to the default gateway (which is typically a router). All traffic that isn't destined for the local network is sent to the default gateway. Only then it is routed, hence only then there's a route, hence only then tracert applies.

    IP is like sending packets by snail mail. You address a 'packet', send it, and hope it gets delivered. TCP is like a phone call, you don't start transferring data until the destination confirmed the communication channel. There is no "TCP vs IP", no 'versus' as they are used in conjuction. TCP provides connection-oriented guaranteed delivery services for IP.

    For more info and the difference between TCP and IP:
    icon_arrow.gifwww.techexams.net/technotes/networkplus/tcpipsuite.shtml
    icon_arrow.gifwww.techexams.net/technotes/networkplus/osimodel.shtml
  • Options
    dissolveddissolved Inactive Imported Users Posts: 228
    IP carries TCP.

    I know the term TCP/IP term is confusing. Try not to compare them that way. They are on two different levels of the networking model. TCP/IP does not refer to two protocols (tcp and ip). TCP/IP represents a "suite" of protocols (arp, ip,tcp,udp,icmp etc etc)

    Here's an example of how tcp and ip work together:

    Say I am in the middle of a telnet session, and I type "a." Say "a" is one byte.


    "a" gets encapsulated by the transport layer. In this case, it's TCP since telnet is designed to use this protocol (tcp)to communicate. Once the transport layer encapsulates it, it becomes a segment. Just to re-state, it is so far at 21bytes (20 byte tcp header plus 1 byte data). The tcp header includes source and destination port number, options etc..

    the transport layer passes down the "segment" to the network layer.

    the network layer receives the segment. It knows it has to use IP to reach the other computer. How? It checks it's local routing table and does not see an entry for the dest IP. It encapsulates it with it's own header. The header includes the source and dest IP address etc and any options. Once the network layer adds it's own header, it becomes a datagram.

    The network layer passes it off the ip datagram to the physical layer. Which "frames" the packet. This basically makes it a complete "packet" at this point.

    It gets sent as electrical signals across the media (cat5 etc)

    note: If your computer realizes that the computer is not on your network, it will send it to the gateway. The gateway will re-frame the packet and send it to the next hop.

    So TCP is sometimes used (depending upon the application you're using). And IP is pretty much always used nowadays. TCP basically is used when you need to gurantee delivery. It tracks each byte of data. If each byte isnt received within a certain period of time, TCP will re-send it.

    Your best bet is to run a sniffer while you watch traffic cross the wire
  • Options
    victorouvictorou Member Posts: 15 ■□□□□□□□□□
    :D
    thank you so much, guys. very clear explanations. It helps me a lot.

    Actually, I'm trying to look for a real life example(online) which can be used to simulate the OSI model. It's easier for memorizing.

    Victor
    BS in Information Technology
    Certs: A+, Network+, MCP(70-270, 70-290)
Sign In or Register to comment.