• Like
Tcp
Upcoming SlideShare
Loading in...5
×

Tcp

  • 1,373 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
1,373
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
160
Comments
0
Likes
3

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. TCP/IP Basics Happyman 2008/6/24
  • 2. Theory first
  • 3. Communications Architecture
    • Communications functions can be divided into subset activities
        • concept of layered communications
    • Each activity can be looked as a layer
      • A layer provides a specific service (function) to other layers
      • A layer has a specific protocol (control messages) to connect to other systems
    • Two standards:
      • IBM’s proprietary SNA
      • ISO’s Reference Model for Open Systems Interconnection (OSI model)
  • 4. The OSI Model Lower Layer connects one node to another Upper Layer directly assist the user 7 Application 6 Presentation 5 Session 4 Transport 3 Network 2 Data Link 1 Physical Layer Function Network Choosing the next node and the link to it Data Link Controls the flow of messages on the chosen link Physical Connecting to the physical medium that provides the link Layer Function Application Provides services directly to an application program Presentation Presentation of information to user in a format that the user will understand Session Controls the user to user dialogue – its direction and synchronization Transport Raises the quality of service provided by the network to the level required by user
  • 5. The OSI model
    • OSI Protocol Stack
    • 7. Application -- End user services such as email.
    • 6. Presentation -- Data problems and data compression
    • 5. Session -- Authenication and authorization
    • 4. Transport -- Gaurentee end-to-end delivery of packets
    • 3. Network -- Packet routing
    • 2. Data Link -- Transmit and receive packets
    • 1. Physical -- The cable or physical connection itself.
  • 6.  
  • 7. Network Protocol Operations
  • 8. TCP/IP and OSI
    • In OSI reference model terminology – the TCP/IP protocol suite covers the network and transport layer
    • TCP/IP can be used on many data-link layers (can support many network hardware implementations)
  • 9. But First…
  • 10. Ethernet – A Real Data-Link Layer
    • Discuss a real data-link layer.
    • Ethernet (IEEE 802.3) is widely used.
    • Supported by variety of physical layer implementations.
  • 11. CSMA/CD Carrier Sense Multiple Access with Collision Detection
    • Carrier Sense: can tell when another host is transmission
    • Collision Detection: cal tell when another host is transmission at the same time
  • 12. An Ethernet Frame
    • Preamble: a sequence of alternating 1s and 0s used for synchronization.
    • CRC: Cyclic Redundancy Check
  • 13. Ethernet Addressing
    • Each interface looks at every frame and inspects the destination address. If the address does not match the hardware address of the interface (or the broadcast address), the frame is discarded.
    • Some interface can also be programmed to recognize multicast address.
    • Hardware address or MAC (Media access contorl) address: 48 bits
    • Notation:
      • 01-23-45-67-89-ab or 01:23:45:67:89:ab
  • 14. Varieties of Ethernet
    • 10Mbs
      • 10Base2 (coaxial cable)
      • 10BaseT(UTP, Unshielded twisted pair )
    • Fast Ethernet (100Mbs)
      • 100BaseT (cat5)
    • Gigabit Ethernet
      • 1000BaseT -- 1 Gbit/s over cat-5 cable.
    • 10Gigabit Ethernet
      • The 10 gigabit Ethernet family of standards encompasses media types for single-mode fibre (long haul), multi-mode fibre (up to 300m), copper backplane (up to 1m) and copper twisted pair (up to 100m).
  • 15. How to see your MAC address?
  • 16. Back to TCP/IP
  • 17. IP: Internet Protocol in TCP/ IP
    • IP is the network layer
      • Packet delivery service
      • Translation between different data-link protocols.
    IP packet
  • 18. IP Characteristics
    • IP is a connectionless protocol
      • No concept of a job or a session (each packet is treated as an entity in itself)
    • IP is an unreliable protocol
      • It is unconcerned with whether a packet reaches its eventual destination, or whether they arrive in the original order
      • IP cannot tell if packets were lost or whether they were received out of order
    • IP packets are not identified as a part of a sequence or belonging to a particular job.
    IP packet 1 IP packet 2 IP packet 3 IP packet 4
  • 19.  
  • 20. IP Addresses
    • IP is a network layer – it must be capable of providing communication between hosts on different kinds networks (different data-link implementations)
    • The address must include information about what network the receiving host is on. This is what makes routing feasible. (possible)
  • 21. IP Addresses
    • IP addresses are logical addresses (not physical)
    • IPv4: 32bits
    • Include a network ID and a host ID.
    • Every host must have a unique IP address.
    • IP addresses are assigned by a central authority (American Registry for Internet Numbers of North America, IANA ).
  • 22.  
  • 23.  
  • 24. Number of IP Addresses 2^8=256 2^21=2,097,152 (2M) Class C 2^16=65535 (64K) 2^14=16384 (16K) Class B 2^24=16,777,216 (16M) 2^7=128 Class A # of host IDs per network ID # of network IDs Class
  • 25. Class A-D addresses 239.255.255.255 224.0.0.0 1111xxxx D 223.255.255.255 192.0.0.0 110xxxxx C 191.255.255.255 128.0.0.0 10xxxxxx B 127.255.255.255 0.0.0.0 0xxxxxx A Finish address Start address Leftmost bits Class
  • 26. Network and Host IDs
    • A Network ID is assigned to an organization by a global authority.
    • Host IDs are assigned locally by a system administrator.
    • Both Network ID and Host ID are used for routing.
  • 27. IP Addresses
    • IP Addresses are shown in dotted decimal notation:
    • 1.2.3.4 => 00000001 00000010 00000011 0000100
    • 124.40.41.110 => 0 1111100 .00101000.00101001.01101110 (class A)
    • 203.113.131.69 => 110 01011.01110001.10000011 .01000101 (class C)
  • 28. IP calculator
    • http:// jodies.de/ipcalc?host =210.59.224.193&mask1=25&mask2 =
  • 29. Host and Network address
    • A single network interface is assigned a single IP Address is called the host address.
    • A host may have multiple interfaces, therefore multiple host addresses .
    • Hosts that share a network all the same IP network address (network ID)
  • 30. IP broadcast and Network address
    • An IP broadcast addresses has a host ID of all 1s.
    • IP broadcasting is not necessarily a true broadcast, it relies on the underlying hardware technology.
    • An IP Address that has a host ID of all 0s is called a network address and refers to an entire network.
  • 31.  
  • 32. Divided a class B into 3 class C subnets.
  • 33. Subnet ing (subnetworking)
    • Subnets can simplify routing.
    • It’s possible to have a single wire network with multiple subnets.
  • 34. IP Subnet Table (1) CIDR = Classless Inter-Domain Routing
  • 35. IP Subnet Table(2)
  • 36. IP Subnet Table (3)
  • 37. IP Subnet table
  • 38. IP Subnet Table (5)
    • http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html#SUBNETS
    • http://packetiq.com/reference/subnet-mask-table.htm
    • Ask google ..
  • 39. Mapping IP Address to Hardware address
    • IP Address are not recognized by hardware.
    • If we know the IP address of a host, how do we find out the hardware address?
    • The process of finding the hardware address of a host given the IP address is called Address Resolution .
  • 40. Reverse Address Resolution
    • The process of finding out IP Address of a host given a hardware address is called Reverse Address Resolution .
    • Reverse Address Resolution is needed by diskless workstations when booting.
  • 41. ARP
    • The Address Resolution Protocol is used by a sending host when it knows the IP Address of the destination but needs the hardware (Ethernet, mac) address.
    • ARP is a broadcast protocol – every host on the network receives the request.
    • Each host checks the request against it’s own IP address – the right one responds.
  • 42. ARP cache
    • ARP does not need to be done everytime an IP datagram is sent – hosts remember the hardware addresses of each other.
    • Part of the ARP protocol specifies that the receiving host should also remember the IP and hardware address of the sending host.
  • 43.  
  • 44.  
  • 45. ARP command
  • 46. Services provided by IP
    • Connectionless Delivery (each datagram is treated individually)
    • Unreliable (delivery is not guaranteed)
    • Fragmentation / Reassembly (base on hardware MTU: maximum transfer unit)
    • Routing
    • Error detection
  • 47. IP Datagram
  • 48. IP Datagram Fragmentation
    • Each fragment (packet) has the same structure as IP datagram.
    • IP specifies that datagram reassembly is done only at the destination . (not on hop-by-hop basis)
    • If any of the fragment are lost – the entire datagram is discarded (and an ICMP message is sent to the sender)
  • 49. IP Flow Control & Error Detection
    • If packets arrive too fast – the receiver discards excessive packets and sends an ICMP message to the sender (SOURCE QUENCH)
    • If an error is found (header checksum problem) the packet is discarded and an ICMP message is sent to the sender.
  • 50. ICMP Internet Control Message Protocol
    • ICMP is a protocol used for exchanging control messages.
    • ICMP uses IP to deliver messages.
    • ICMP messages are usually generated and processed by the IP software, not the user process.
  • 51. ICMP Message Types
    • Echo Request
    • Echo Response
    • Destination Unreachable
    • Redirect
    • Time Exceeded
    • Redirect (route change)
    • More…
  • 52. IP …
    • Let’s go to TCP
  • 53. Transport Layer & TCP
    • IP is the network layer, TCP must be the transport layer right?
      • No.. Almost
    • TCP is only part of the TCP/IP transport layer, the other part is UDP (User Datagram Protocol)
  • 54. TCP/IP Layers
  • 55. UDP User Datagram Protocol
    • UDP is a transport protocol
      • Communication between processes
    • UDP uses IP to deliver datagrames to the right host
    • UDP uses ports to provide communication services to individual processes.
  • 56. Ports
    • TCP/IP uses an abstract destination point called a protocal port.
    • Ports are identified by a positive integer.(16 bit : 0-65535)
    • Operating systems provide some mechanism that proecsses use to specify a port.
    • Well known port numbers: http:// www.iana.org /assignments/port-numbers
  • 57.  
  • 58. UDP
    • Datagram Delivery
    • Connectionless
    • Unreliable
    • Minimal
  • 59. TCP: Transmission Control Protocol
    • TCP is an transport layer protocol support by TCP/IP.
    • TCP provides:
      • Connection-oriented
      • Reliable
      • Full-duplex
      • Byte-stream
  • 60. Reliable TCP
  • 61. Connection-Oriented
    • Connection oriented means that a virtual connection is established before any user data is transferred.
    • If the connection cannot be established – the user program is notified.
    • If the connection is ever interrupted – the user program can find out there is a problem.
  • 62. Reliable
    • Reliable means that every transmission of data is acknowledged by the reciver.
    • If the sender does not receive acknowledgement within a specified amount of time, the sender retransmits the data.
    • (Reliable does not mean that things don’t go wrong, it means that we find out when things go wrong)
  • 63. Byte stream
    • Stream means that the connection is treated as a stream of bytes.
    • The user application does not need to package data in individual datagrams. (as with UDP)
      • Somebody still needs to package data into IP packets, just the application doesn’t care.
  • 64. Buffering
    • TCP is responsible for buffering data and determining when it’s time to send the datagram.
    • It is possible for an application to tell TCP to send the data it has buffered without waiting for a buffer to fill up.
  • 65. Full Duplex
    • TCP provides transfer in both directions (over single virtual connection)
    • To the application program these appear as 2 unrelated data streams, although TCP can piggyback control and data communication by providing control information (such as ACK) along with user data.
    http://en.wikipedia.org/wiki/Piggybacking_%28data_transmission%29
  • 66. TCP ports
    • Interprocess communication via TCP is achieved with the use of ports.( just like UDP)
    • UDP ports have no relation to TCP ports. (different name spaces)
  • 67. TCP Segments
    • The chunk of data that TCP asks IP to deliver is called a TCP segment.
    • Each segment contains:
      • Data bytes from the byte stream.
      • Control information that identifies the data bytes.
  • 68. TCP segment format
  • 69. Addressing in TCP/IP
    • Each TCP/IP address includes:
      • Internet Address (IP)
      • Protocol (UDP or TCP)
      • Port Number
  • 70.  
  • 71. TCP/IP summery
    • IP: network layer protocol
      • Unreliable datagram delivery between hosts
    • UDP: transport layer protocol
      • Unreliable datagram delivery between processes
    • TCP: transport layer protocol
      • Reliable, byte-stream delivery between processes
  • 72. TCP or UDP
    • Electronic commerce?
    • Video server?
    • File transfer?
    • Email?
    • Chat groups?
  • 73. OK.
    • Reference:
      • http://www.slideshare.net/fgirella/tcpip
      • Images from http://en.wikipedia.org/