Python full stack day03 computer Network Foundation

Source: Internet
Author: User
Tags new set domain name server domain server

First, the network protocol

A network protocol is a collection of rules, standards, or conventions that are established for data exchange in a computer network. It specifies the format in which information must be used in communication and the meaning of these formats.

A network protocol is the rule of communication between computers. In order to make it possible to communicate effectively on the network between computers in different locations and with different operating systems, a communication method which can be recognized by all kinds of computers and the information expressed by either party can be agreed by other parties, thus determining the standard of computer access to Internet communication.

Ii. OSI Layer Five protocol

The Internet Protocol is divided into OSI seven layer or TCP/IP five layer or TCP/IP four layer according to function, which corresponds to the relationship.

The TCP/IP layer five model is the application layer of the OSI seven layer, the presentation layer, the session layer and the application layer, and describes the origin and function of each layer from the point of view of TCP/IP five layer protocol. User contact is the application layer, network data transmission, top-down each layer is dependent on the next layer, each layer has its own specific protocol. The closer to the user, the lower the closer the hardware.

(1) Physical layer

The physical physical circuit is used to realize the network, the transmission high and low level (electrical signal) is 1, and the low is 0.

(2) Data link layer

Defines the grouping form of electrical signals, forming a unified standard, Ethernet Internet Protocol.

A set of electrical signals constitute a set of data packets and frames, a set of data frames (packets) are divided into header head and data part of the database.

Head contains: Source address, Destination address, data type

Data contains: The content of the information.

The protocol stipulates that all computers connected to the Internet must have a network card, the head contains the source address and the destination address refers to the network card address, each network card has a fixed non-changing MAC address. With these things, hosts within the same network can transmit data in the form of broadcasts.

(3) Network layer

Devices on different networks want to communicate, only by the data broadcast is not possible, at this time introduced a new set of addresses to distinguish between different broadcast domain/subnet, take the route to broadcast sending packets.

In order to communicate between devices in different networks, each device configures the IP address, subnet mask, and gateway. By IP address and subnet mask to determine the time on the same network. If no longer the same network, through the gateway communication, walking by the Protocol gateway to establish communication between the first, and then data transmission.

Note: If the communication, IP and subnet must have, cross-subnet communication depends on the IP address, the same subnet communication depends on the MAC address.

(4) Transport layer

Establish Port-to-port communication via TCP or UDP protocol

(5) Application layer

Applications work at the application level, and the application layer is the data format used to standardize the application layer. The TCP protocol of the Transport layer transmits the data to the program, and the type format of the data needs to be stipulated by the Protocol of the application layer, which constitutes the application layer.

Development application to invoke, using the transport layer of the TCP/UDP protocol, for ease of use, we use the socket communication, it will be complex TCP protocol disguised as an interface to invoke, convenient and fast.

If you want to achieve network communication, the four elements of the host every day are necessary, namely: IP address, subnet mask, Gateway, DNS. These four elements can be automatically acquired through the DHCP protocol, or they can be configured on their own.

Third, the user's online process

1, the machine gets a valid IP address, subnet mask, Gateway, DNS.

2. Open the browser and enter www.baidu.com in the address bar

3. Domain name resolution (and DNS resolution)

(1), the operating system first check their local hosts file whether there is a mapping of this URL, if there is, call this IP address mapping, complete the domain name resolution.

(2), if there is no mapping of this domain name in the hosts, look for the local DNS parser cache if there is a map of this URL, if you have to return data directly, complete the domain name resolution.

(3), if the hosts and the local DNS resolver cache does not have a corresponding URL mapping relationship, first find the local DNS server to query, when this server receives the query, if the domain name to be queried, included in the Local Configuration zone resource, then return the parsing results to the client, complete the domain name resolution, This parsing is authoritative.

(4), if the local DNS server local zone file and cache resolution is invalid, according to the local DNS server settings to send the request to 13 root DNS, the root DNS server receives the request will determine that the domain name (. com) is the server to authorize management, and returns an IP address that is responsible for the top-level domain name server. After the local DNS server receives the IP address information, it will contact the server responsible for the. com domain. When the server that is responsible for the. com domain receives the request, it will find a management. com domain's next-level DNS server address (baidu.com) to the local DNS server if it cannot implement the resolution itself. When the local DNS server receives this address, it will find the baidu.com domain server, repeat the above 3,2,1 action to query until the www.baidu.com host is found.

(5), the data is embedded in the TCP packet returned.

4. TCP protocol

The TCP protocol embeds the port of the HTTP protocol in the packet and sends it to the network layer

5. IP protocol

After a TCP protocol packet is received by the network layer, an externally embedded layer of IP packets (source IP address, Destination IP address) is sent to the data link layer.

6. Internet Protocol

IP packets arrive at the data link layer and will be hit with a layer of Ethernet packets (source MAC address, destination MAC address, data type). After the packet encapsulation is completed, the physical layer is sent to the Baidu server.

7. Server response

After the server receives the packet through the network, it analyzes the request of the client's open URL in the packet, responds, and sends the response back to the requesting host in the same way.

8. After the local computer receives the response packet returned from the server, the browser opens the Web page and completes the communication.

Python full stack day03 computer Network Foundation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.