Network infrastructure - Network Communications

Original link: http://www.cnblogs.com/gyh04541/p/6891141.html
First, the Internet Protocol
    The so-called Internet protocol is communication between the computer and the computer, the agreed rules and standards for communication between the good, so that it can interact with each other, these rules is the Internet Protocol.
    Because between computers in different regions, different languages, resulting information can not be delivered, it is necessary to abide by these regulations and standards between computers, regardless of geography and language will be able to exchange traffic.
    Without these agreements, there is no current network, everyone's computers are isolated, resources can not be shared.
Two, OSI (Open Systems Interconnection Reference Model) Model five
     Starting from the underlying hardware, successively up a physical layer, data link layer, network layer, transport layer, application layer,
    1. Physical layer: by establishing fiber, cable, wireless networks, two cables, and other physical wire connection, the transmission level voltage (electric signal) based on the electrical characteristics representative of a high voltage, low voltage represents 0;
    2. Data Link Layer: separate transmit power level does not make sense, must specify how many groups a set of electrical signals, what does it mean, that it provides for grouping of electrical signals,
        In this layer, it has a uniform protocol: Ethernet protocol (Ethernet), each set of electrical signals is a data packet, called frames;
        Each frame comprises a header (head) and the data (data) section,
        head comprising: 18 bytes (fixed),
                     The sender (source address) of 6 bytes,
                    The recipient (destination address) of 6 bytes,
                    6 bytes of data portions,
         data comprising: minimum 46 bytes, up to 1500 bytes,
         mac address: in the head, comprising the source address and destination address, the port in each computer has a communication card, sending and receiving ends of the address is the address of the card, both the Mac address,
                  Each card in the Mac address of the factory have been fired in the card, the address is the world's only, a total of 48 binary, the top 12 manufacturers represented by the hexadecimal representation (before 6, after 6 represents production line number)
         Radio: There are Mac addresses within the same network, through the ARP protocol can communicate by way of broadcasting,
    3. Network Layer
        In the data link layer, because it is the way radio communication, resulting in the local area network, all the computers can receive data packets, and really want to accept only one computer, resulting in low efficiency, and can not be outside the LAN computer communications,
        Network layer function: network layer is the introduction of a new address for distinguishing the broadcast domain and subnet, i.e., the IP network address;
        IP address: 0.0.0.0 to 255.255.255.255 range, represented by a 32-bit binary, often with four segments decimal notation,
        IP address consists of two parts, identify the subnet part of the network, the host part identifies the host portion, separate from the computer determines whether or not the IP address in the same network, a subnet mask to determine the need,
        Subnet Mask: characteristic parameter identifying a subnet, is a 32-bit binary, decimal is represented by 10, is a part of the whole network, the host portion are all 0,
         Know the IP address and subnet mask, we can determine whether two IP addresses in the same subnet, through the AND operation (as are the corresponding 1, get 1, correspond to rest as long as the difference is 0) results are the same look, the same is the same subnet,
       The role of IP addresses, each computer is assigned a unique IP address, and determine whether these IP addresses belong to the same subnet,
       IP packets contained in the data portion of the Ethernet, IP packet data and also includes two head portions,
       head comprising from 20 to 60 bytes, 65,515 bytes containing data, Ethernet data portion of 1500 bytes at most, if the IP packet exceeds the need to split into several Ethernet packets, transmitted separately,
      ARP protocol: ARP, divided into seven osi model, the data link layer is transferred Mac address, get their Mac address is easy, but to know the Mac address of the other host, it is necessary by ARP protocol, network IP address mapping essence is the Mac address, the process: after 1 determines whether the IP address and subnet mask of the same network, transmission data packet, transmitted in Ethernet packets to all hosts apart, with their IP addresses match, the response is, to return to their Mac address,
      4. Transport Layer
       Establishing a communications port to port, it is connection-oriented, reliable communication protocol, a port range: 0--65535,0--1023 occupied by the system,
       tcp connection establishment process,
       1.client server sends a request to establish a connection (tcp segment, syn = 1, seq = x), the wait for an acknowledgment server,
       2.server receiving the request, if you agree to establish a connection to a client tcp packets (sxn = 1, sep = y), ack = 1, sep = x + 1 is client tcp acknowledgment packets received, and waits for the client acknowledges having received packet,
       3.client confirm receipt of the message, once again sending tcp packet to the server, the server acknowledge receipt of the message, the communication connection is established.
       tcp connection disconnection process,
       tcp is duplex transfer (data transfer in both directions),
       fin 1.tcp client sends a connection for the proposed connection abort tcp,
       After receiving the FIN 2.server, confirm that connection is closed in this direction,
       3. There server connection request tcp closed again, the transmission of a fin,
       4.client receiving the request, the connection is closed.
V. Application Layer
      Communication between the application layer, all programs, data, data format of the predetermined program, there are email, www, FTP, and other data formats, a data format must be agreement of these procedures, the application of these protocols constitute layer,
     The socket is an abstraction layer between the application layer and the transport layer, data exchange through a program for the two bi-directional communications, a socket "open - Read / Write - off" mode of implementation, the server and client are maintained a "file" in the open after the connection is established, you can write to each other for read or read other content to your own file, close the file at the end of the communication.
 
Sixth, the Internet flow
    1. The basic information of the machine,
    IP address,
    Subnet mask,
    Gateway,
    DNS name resolution,
    2. Go to your browser and enter the URL address,
    3.DNS resolve domain names
    4. obtain the content of the http, tcp contained in the data packet,
    5.TCP packets need to set the port, the recipient, the sender's randomly generated port http port,
    6.IP protocol contained in the tcp protocol, IP packet provided both IP addresses,
    7. The Ethernet protocol, IP packet embedded in an Ethernet packet. Ethernet packets need to set both the MAC address, sender MAC address-based machine, the recipient is a MAC address of the gateway xxxx (obtained through ARP protocol)
    8. The server response, forwarded through a plurality of gateways, the server receives the IP address, the four received Ethernet packets, the IP header according to the sequence number, the server will put together four packets, TCP packets taken out of the complete and then read out inside the "HTTP request", and then make a "HTTP response", and then sent back to the TCP protocol, the HTTP response is received after this unit, it can be displayed on the page, complete a communications network.

Reproduced in: https: //www.cnblogs.com/gyh04541/p/6891141.html

Guess you like

Origin blog.csdn.net/weixin_30764883/article/details/94795581