the computer foundation of Day3:python Learning notes--network filmWhat are Internet protocols and why do they have an Internet protocol?
? Internet protocol is essentially a set of unified standards that are specified to facilitate the connection of two computers.
OSI five-layer model
The following five-layer protocols are required for data transfer between computers:
? models, protocols, hardware
? Application layer, HTTP protocol, user-defined protocol
? Transport layer, TCP/UPD Protocol, four layer switch, four layer router
? Network layer, IP protocol, layer three switch, router
? Data Link layer, Ethernet, signal grouping, Network Bridge, Ethernet switch, network card
? Physical layer, transmission of electrical signals, repeaters, hubs, twisted-pair wires
The user perceives only the above layer of application, and the top-down layer relies on the next layer
Physical Layer
Mainly based on electrical characteristics to send high and low voltage (electrical signal), the higher voltage corresponds to 1, low voltage corresponds to 0.
Data Layer
The data layer defines a uniform grouping of electrical signals, the Ethernet Protocol (Ethernet) , which is then transmitted over a broadcast.
-
Ethernet protocol:
-
a group of electrical signals constitute a packet called ' frame '
-
each data frame is divided into: header head and data two parts
-
Span class= "Md-line md-end-block" > head contains (fixed 18 bytes): Sender/Source Address (6 bytes) + Receiver/Destination address (6 bytes) + Data type (6 bytes)
-
data contains (minimum 46 bytes, maximum 1500 bytes): Details of the packet
-
head length +data length = Shortest 64 bytes, maximum 1518 bytes, shard send over maximum limit
-
MAC Address: Each NIC is fired from the factory, the world's only MAC address, is the source and destination address contained in the head.
-
broadcast: with MAC address, Two hosts within the same network can communicate (one host obtains the MAC address of another host through the ARP Protocol) Ethernet uses the most primitive broadcast method, that is, the computer communication basically Roar
Data: Head + data
Network layer:
With Ethernet, MAC address, broadcast mode of transmission, the world's computers can communicate with each other, but the world's internet is separated by a small local area network composed of each other, the network layer introduced a new set of addresses to distinguish between different broadcast domain/subnet, this set of address is the network address.
IP protocol:
The protocol that specifies the network address is called the IP protocol, the address it defines is called an IP address, and the widely used version of V4 is IPv4, which specifies that the network address is represented by 32-bit 2 binary
Range 0.0.0.0-255.255.255.255
An IP address is usually written as a four-segment decimal number, for example: 172.16.10.1
IP Address composition
Note: The simple IP address segment only identifies the type of IP address, from the network part or the host part can not identify an IP in the sub-network example: 172.16.10.1 and 172.16.10.2 are not sure that they are in the same subnet
Subnet Mask (DNS)
The so-called "subnet mask" is a parameter that represents the characteristics of a sub-network, which is formally equivalent to an IP address. The subnet mask allows you to determine whether any two IP addresses are in the same subnet. The method is to use the two IP address and the subnet mask for each and operation (two digits are 1, the result of the operation is 1, otherwise 0), and then compare the results are the same, if so, it indicates that they are in the same sub-network, otherwise it is not.
IP packets
IP packets are also divided into head and data sections, without having to define a separate field for the IP packet, directly into the data portion of the Ethernet packet
Head: 20 to 60 bytes in length
Data: The maximum is 65,515 bytes.
In the "Data" section of the Ethernet packet, the maximum is only 1500 bytes. Therefore, if the IP packet exceeds 1500 bytes, it needs to be split into several Ethernet packets, which are sent by sub-development.
Ethernet Header--ip Header--IP data
ARP protocol: Get MAC address via IP + DNS
Data: Ethernet Header + IP header + IP data
Transport Layer
Network layer of IP to help our area of the molecular network, Ethernet layer of the Mac to help us find the host, in order to identify the application on this host, generated a port, that is, the application and the network card associated with the number, and the transport layer is to establish port-to-port communication.
-
TCP protocol
-
reliable transmission, TCP packets have no length limit, theoretically can be infinitely long, but in order to ensure the efficiency of the network, Typically, the length of the TCP packet does not exceed the length of the IP packet to ensure that a single TCP packet does not have to be split again.
-
Ethernet Header + IP header + TCP header + data
-
TCP three-time handshake and four-time wave
-
-
-
UDP protocol:
is unreliable, the" header "section is only 8 bytes, the total length is not more than 65,535 bytes, just put in an IP packet.
Ethernet Header + IP header + upd header + data
Application Layer
Users are using applications, all working in the application layer, the Internet is developed, everyone can develop their own applications, data diversity, must be set up a good data organization
Application Layer functionality: Specifies the data format of the application.
TCP protocol can be used for a variety of programs to pass data, such as email, WWW, FTP and so on. Then there must be different protocols for the format of e-mail, Web pages, FTP data, and these application protocols constitute the "Application layer".
User Online process
IP address of this machine: 192.168.1.100
Subnet Mask: 255.255.255.0
IP address of the gateway: 192.168.1.1
IP address of DNS: 8.8.8.8
User Data →http, custom →tcp, port →ip→ ethernet → Electrical signal transmission
Get data in reverse after receiving
The computer foundation of Day3:python Learning notes--network film