zoukankan      html  css  js  c++  java
  • TCP-IP Architecture and IP Packet

    Why Internet working?

    1. To build a “network of networks” or internet.
    2. operating over multiple, coexisting(共存的), different networks
    3. providing ubiquitous(无处不在的) connectivity through IP packet transfer .
    4. achieving huge economies of scale.

    TCP/IP Protocol Suite

    Encapsulation(封装)

    • Base:HTTP Request ->TCP header->IP header->Ethernet header

    Internet Addresses

    • Each host has globally unique logical IP address
    • Separate address for each physical connection to a network
    • Routing decision is done based on destination IP address
    • IP address has two parts:
    1. netid(网络标识符) and hostid
    2. netid unique, facilitates routing
    • Dotted Decimal(十进制) Notation(记号):
      int1.int2.int3.int4
      (intj = jth octet)
      128.100.10.13

    Internet Protocol

    1. Provides best effort, connectionless packet delivery
    • motivated by need to keep routers simple and by adaptibility to failure of network elements
    • packets may be lost, out of order, or even duplicated(复制)
    • higher layer protocols must deal with these, if necessary
    1. IP also includes:
    • Internet Control Message Protocol (ICMP)
    • Internet Group Management Protocol (IGMP)

    IP Packet Header

    1. Minimum 20 bytes
    • Up to 40 bytes in options fields
    1. Version: current IP version is 4.
    2. Internet header length (IHL): length of the header in 32-bit words.
    3. Type of service (TOS): traditionally priority of packet at each router. Recent Differentiated Services redefines TOS field to include other services besides best effort.
    4. Total length: number of bytes of the IP packet including header and data
    5. Identification, Flags, and Fragment Offset: for fragmentation and reassembly.
    6. Time to live (TTL): number of hops packet is allowed to traverse(穿过) in network.
    • Each router along the path to the destination decrements this value by one.
    • If the value reaches zero before the packet reaches the destination, the router discards the packet and sends an error message back to the source.
    1. Protocol: specifies upper-layer protocol that is to receive IP data at the destination. Examples include TCP (protocol = 6), UDP (protocol = 17), and ICMP (protocol = 1).
    2. Header checksum(校验和): verifies the integrity of the IP header.
    3. Source IP address and destination IP address: contain the addresses of the source and destination hosts.
    4. Options: Variable length field, allows packet to request special features such as security level, route to be taken by the packet, and timestamp at each router. Detailed descriptions of these options can be found in [RFC 791].
    5. Padding: This field is used to make the header a multiple of 32-bit words.

    IP Header Processing

    1. Compute header checksum(校验和) for correctness and check that fields in header (e.g. version and total length) contain valid values
    2. Consult routing table to determine next hop
    3. Change fields that require updating (TTL, header checksum)
  • 相关阅读:
    Codeforces Round #581 div.2 A,B,C
    19年牛客多校第十场记录
    tarjan 学习笔记
    POJ 3177 Redundant Paths (tarjan无向图求缩点)
    hdu 4738 Caocao's Bridges (tarjan求桥)
    hdu 1540 Tunnel Warfare (线段树维护一维联通区间)
    遍历 redis 数据库
    非web 的 java程序 打成jar包 在linux上运行
    java-疑问-远程连接linux服务器找不到文件路径
    java-查询图片url导出到本地
  • 原文地址:https://www.cnblogs.com/vancasola/p/7657491.html
Copyright © 2011-2022 走看看