Network foundation (1)


Blog reference

TCP diagram

Network foundation (1)

TCP structure

Network interface layer

The physical layer defines some characteristics related to the interface of transmission media, i.e. mechanical characteristics, electrical characteristics, functional characteristics and process characteristics, and needs to complete the conversion between parallel transmission and serial transmission.
The data link layer provides transparent and reliable data transmission services to users of the layer. Transparency means that there are no restrictions on the content, format and coding of the data transmitted on the layer, and there is no need to explain the meaning of the information structure; reliability refers to the transformation of the physical connection provided by the physical layer into a logical error free data link in the transmission process. The specific methods include frame synchronization, error control, flow control and link management.
The main protocols in the data link layer are PPP, CSMA / CD and Ethernet 802.3.

Internet layer (IP layer)

The Internet layer only provides simple, flexible, connectionless and best effort datagram service. The Internet layer does not provide quality of service commitment, that is, the packets transmitted may be wrong, lost, duplicated and out of order. Of course, it does not guarantee the time limit of packet delivery.
The main protocols in the Internet layer include IP, ARP and ICMP.
IP protocol is the core of the Internet layer. The next hop IP is encapsulated and delivered to the network interface layer by routing selection. IP datagrams are connectionless services.
ICMP is the supplement of Internet layer, which can send back messages. It is used to detect whether the network is unobstructed (using ping command).
ARP is to find the MAC address of the host through the known IP.

Transport layer

The transport layer provides end-to-end (process to process) logical communication between application processes, and has the function of reuse and distribution, that is, different application processes of the sender can use the same transport layer protocol to transmit data; the transport layer of the receiver can deliver these data to the target application process correctly after stripping the header of the message. The transport layer will also perform error control on the message to provide reliable transmission.
The main protocols in transport layer are user datagram protocol UDP and transmission control protocol TCP

application layer

The application layer provides applications for users.
The main protocols in the application layer include DNS, FTP, Telnet, HTTP, SMTP, POP3 and IMAP, DHCP, etc.
DNS: provide domain name resolution service, provide domain name to IP address conversion, using port 53
FTP: transfer files between any computer in heterogeneous network, using port 21
Telnet: provide users with remote login service, using port 23, using clear code transmission, poor confidentiality, simple and convenient
Http: used to realize various links on the world wide web, that is, the connection between the world wide web client program and the world wide web server, using port 80
SMTP / POP3, IMAP: provide mail transmission, which is used to control the sending, transferring and reading mail from the mail server
DHCP: automatically assign IP addresses to new computers

TCP / IP protocol

ARP Protocol

Solve the mapping problem of IP address and MAC address of host or router in the same LAN.
Suppose that four computers on an Ethernet, namely computer a, B, X and y, communicate through TCP / IP protocol, then the data link layer of both sides must know the MAC address of the other party. Each computer has to store an IP address to MAC address translation table in its own cache, called ARP table. It stores a series of maps of IP address and MAC address of computers in the same subnet which are used recently. The ARP table is empty when the host is initially started. Now the source computer a ( wants to communicate with computer B ( Before computer a sends information, it must first get the mapping relationship of MAC address of computer B.

RARP protocol

RARP (Reverse Address Resolution Protocol) reverse address translation protocol (RARP) allows physical machines in the LAN to request their IP addresses from the ARP table or cache of the gateway server. The network administrator creates a table in the LAN gateway router to map the physical address (MAC) and its corresponding IP address. When setting up a new machine, its RARP client program needs to request the corresponding IP address from the RARP server on the router. If a record has been set in the routing table, the RARP server will return the IP address to the machine, which will be stored for future use. RARP can be used in Ethernet, fiber distributed data interface and token ring LAN

DHCP protocol

DHCP is a dynamic host configuration protocol, which is often used to dynamically assign IP addresses to hosts. It provides a plug and play networking mechanism, which allows a computer to join a new network and obtain IP addresses without manual participation;

ICMP Protocol

IP provides connectionless service that can be delivered as best as possible, so it can't solve the problems of data packet loss, duplication, delay or disorder in network layer. In order to improve the chance of IP datagram delivery, ICMP (Internet control message protocol) protocol is used in network layer to allow host or router to report errors and abnormal conditions

Rip protocol

Rip is a distributed routing protocol based on distance vector, which belongs to internal gateway protocol (IGP). The "distance" in RIP protocol is also called "hop count". Each time a router passes through, the hop count is increased by 1. According to the protocol, routers in the same autonomous system (A.S.) will exchange routing information with neighboring routers every 30 seconds to establish routing table dynamically. When transmitting data, rip will choose a route with the least number of routers.

OSPF Protocol

OSPF (open shortest path first). It was developed in 1989 to overcome the shortcomings of rip. The principle of OSPF is very simple, but its implementation is more complex. "Open" means that the OSPF protocol is not controlled by a single manufacturer, but publicly published. "Shortest path first" is due to the use of Dijkstra shortest path algorithm.

BGP protocol

BGP (border gateway protocol) is a protocol for exchanging routing information between routers in different autonomous systems. Its basic function is to automatically exchange non loop routing information between autonomous systems. It is an external gateway protocol (EGP). Border gateway protocol is often used between gateways in the Internet, The addresses that routers can reach and the number of hops to each router
    1) The scale of Internet is too large, which makes routing between autonomous systems very difficult;
    2) It is unrealistic to find the best route for routing between autonomous systems;
    3) The routing between autonomous systems must consider the relevant strategies;
    Therefore, BGP can only try to find a better route to the destination network, not to find the best route
    BGP adopts "path vector selection protocol", which is quite different from distance vector protocol and link state protocol;

IGMP protocol

IGMP protocol is used to establish and maintain multicast group membership between IP host and its directly adjacent multicast router. Multicast router does not need to keep the membership of all hosts. It only knows whether there is a group member of a multicast group on the network segment connected by each interface through IGMP protocol. The host only needs to save which multicast groups it has joined.
        In short, IGMP protocol allows the multicast router connected to the local LAN to know whether a process on the local LAN participates in or exits a multicast group.
    IGMP should be regarded as a part of TCP / IP protocol, and its work can be divided into two phases
    1) When a host joins a new multicast group, the host should send an IGMP message to the multicast address of the multicast group to declare that it wants to be a member of the group. After receiving the ICMP message, the local multicast router forwards the group membership to other multicast routers on the Internet
    2) Because the relationship among group members is dynamic, the local multicast router should periodically inquire the routers on the local area network to know whether these hosts are still members of the group. As long as there is a host response to a group, the multicast router considers the group to be active. However, a group still has no host response after several inquiries, Then the group membership is no longer forwarded to other multicast routers

TCP / IP data encapsulation

Network foundation (1)

TCP / IP data encapsulation

Network foundation (1)