The system summarizes knowledge of computer network

 

 

A: an overview of the five network protocol architecture

  1. Application Layer: to accomplish specific network applications through the interaction between the application process. The application layer protocol defines the rules of communication and interaction between the application process. For different network applications require different application layer protocols. In many Internet application layer protocol, such as Domain Name System DNS, HTTP protocol support Web applications, e-mail support SMTP protocol, and so on. We interact with the application layer data units called packets.

  2. Transport Layer: responsible for providing universal data transmission services to the process of communication between two hosts. With this application process service delivery application layer packets. "Universal" means not directed at a particular network application, but several applications can use the same transport layer service.

Since a host can run multiple threads simultaneously, it has the transport layer demultiplexing and multiplexing functions. The so-called multiplex refers to multiple application-layer processes can use the following transport layer services; transport layer is divided by the delivery of the information received, respectively, above the application layer would like to use the process.

  3. Network Layer: may go through many data link between two communicating computers in a computer network. It may go through a lot of subnetworks, the network layer is the task is to choose the appropriate inter-network routing and switching nodes to ensure timely delivery of data. When transmitting data, the network layer, the transport layer segment or user generated data packets encapsulated component group and the packet is transmitted. In the TCP / IP architecture, since the network layer using the IP protocol, and therefore it is also called an IP datagram packet, referred to as datagrams.

  4. The data link layer: data transfer between two hosts, is always transmitted on a section of the link, which requires the use of dedicated link layer protocol. Between two adjacent nodes to transmit data, the data link layer framing the assembled IP datagram network layer, a transmission frame on the link between two adjacent nodes. Each frame comprising data and control information necessary (such as: synchronization information, address information, error control, etc.).

  When receiving data, the control information so that the receiving end can know which bit of a frame to which the bits from the beginning and the end. Thus, after receiving the data link layer frame, data can be extracted portion, on to the network layer. Control information further enable the receiving end can detect the received frame has no difference. If an error occurs, the data link layer is simply discards the frame went wrong, in order to avoid further waste of network transmission resources going in the network. If the need to correct errors in the data link layer transmission, it is necessary to use reliable transmission protocol to correct errors occurring. This method will make the link layer protocol is complicated.

  5. The physical layer: the physical layer data units are transmitted bits. Role of the physical layer to achieve transparent transfer between the computer nodes adjacent bit stream, the specific transmission medium masked differences and physical devices as possible. The above data link layer so that the specific transmission medium regardless of what network Yes.

Two: ARP protocol works

  ARP protocol network layer IP address mapping and completion of the physical address. First, each host will establish a list of their ARP ARP buffer to indicate correspondence between IP addresses and MAC addresses. When the source host needs to send a data packet to the destination host, will first check whether the MAC address of the corresponding IP address is present in their ARP table; if, directly sends the data packet to the MAC address; if not, the local network sends a broadcast ARP request packet, this query the MAC address corresponding to the destination host.

  This ARP request data package including the IP address of the source host IP address, the hardware address, and the destination host. After all the network host receives this ARP request, it checks the destination IP packet and its own IP address whether or not the same. If not identical to ignore this data packet; if identical, the host is first added MAC address of the sender and the IP addresses to its ARP list, if the information of the IP ARP table already exists, it is overwritten, and then to the source the host sends an ARP response packet, it needs to tell each other that they are looking for MAC address; the source host receives this ARP response packet, IP address of the destination host will be the MAC address and ARP added to your list, and use this information start data transmission. If the source host has not received ARP response packet, it represents an ARP query failed.

Three: IP address classification

  IP address is the Internet Protocol address, a uniform address format of the IP protocol provides, assign it a logical address for each network on the Internet and each host in order to mask the differences in the physical address. IP address addressing scheme IP address space is divided into A, B, C, D, E five categories, wherein A, B, C is the base class, D, E and class reserved for use as a multicast, to a special address.

  Each IP address comprises two identification code, i.e. network identifier and a host identifier. All hosts on the same physical network use the same network ID.

Four: The main features of TCP

  1.TCP is connection-oriented. (Just like phone calls, as before the call need to dial-up connection is established, after the call to hang up the release of the connection);

  2. Each TCP connection only has two ends, each TCP connection is only a point (one to one);

  3.TCP provide reliable service delivery. Transmitting data over a TCP connection, error-free, is not lost, will not be repeated, arrive in order;

  4.TCP provide full duplex communication. TCP application process to allow communication between the two sides can transmit data at any time. TCP connections at both ends have a transmission buffer and a reception buffer for temporarily storing the data communicating parties;

  The byte stream oriented. The TCP "flow" refers to a sequence of bytes flowing into or out of the process the process. "Byte stream oriented" means: Although TCP and application interaction is a primary block (sizes), but the application post down TCP data only as a series of byte stream unstructured.

Five: The main features of UDP

  1.UDP is connectionless, packet-oriented;

  2.UDP no congestion control, and therefore does not cause a congestion transmission source host of the network is reduced frequency (useful for real-time applications, such as broadcast, video conferencing, etc.);

  3.UDP support one to one, one to many, and many-to-many interactive communication;

  4.UDP header overhead small, only 8 bytes, than the first 20 bytes of TCP is smaller.

Six: three-way handshake

  TCP connection establishment called the handshake, the handshake between the client and the server need to exchange three TCP segments.

Initially the client and server are in the CLOSED (closed) state. In this example A (Client) initiative to open a connection, B (Server) passive open connection.

A beginning, TCP server process B, first create a Transmission Control Block TCB, ready to accept the connection request of the client process. Then the server process is in LISTEN state, waiting for a connection request from the client. If so, respond immediately.

The first handshake: TCP Client A's also the first to create a Transmission Control Block TCB. Then, when the intention to establish a TCP connection, sends a connection request to segment B, then the header of the synchronization bit SYN = 1, while selecting an initial sequence number seq = x. TCP predetermined, the SYN segment (i.e., segment SYN = 1) can not carry data, a number of ammunition consumed. This is, TCP client enters SYN-SENT (Sent synchronous) state.

Second handshake: When B receives the connection request, if you agree to establish a connection, it sends an acknowledgment to A. In the acknowledgment segment should SYN and ACK bits are set to 1-bit acknowledgment number is ack = x + 1, and also choose an initial sequence number seq = y for themselves. Please note that this segment can not carry data, but also have to consume a number. Then TCP server process enters SYN-RCVD (received synchronization) state.

Third handshake: after confirmation process receives TCP client B, but also gives acknowledgment to B. Acknowledgment message ACK segment set, an acknowledgment number ack = y + 1, and their number seq = x + 1. At this ACK segment may carry data. However, if the number does not carry data is not consumed, in this case, the next sequence number of the data segment is still seq = x + 1. At this time, TCP connection has been established, A to enter the ESTABLISHED (established connection) state.

Guess you like

Origin www.cnblogs.com/zhonghu/p/11607581.html