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 547C/548E
    Codeforces Round #608 (Div. 2) 题解
    Codeforces 7E
    beego项目部署方案
    beego中添加数据事务处理的两种方式
    Golang 高效实践之defer、panic、recover实践
    golang语法学习遇到的坑
    beego及bee安装遇到的问题汇总(gomodule启动项目)
    简单的class文件加密解密
    java导出生成word
  • 原文地址:https://www.cnblogs.com/vancasola/p/7657491.html
Copyright © 2011-2022 走看看