table of Contents
Knowledge of computer networks is a specialized discipline. Here only a brief introduction the basics of computer networks.
A, C / S architecture and B / S structure
1.1 C / S architecture
C: client client S: server server
The so-called C / S architecture is client / server, is that some networked computer application architecture is employed.
Generate data exchange between resource users to access the server by downloading the client, using the client and server
1.2 B / S architecture
C: browser browser S: server server
C / S structure commonly used in web pages.
Users browse the web, access to resources in the server through a browser, to perform some action. Such as Lynx, Taobao, Baidu, Jingdong web pages.
Second, the computer network models
2.1 OSI seven-layer model
OSI (Open Systems Interconnection Reference Model) seven-layer model is the standard network reference model ISO (International Organization for Standardization) to develop
About OSI seven-layer model, do not do too much introduction, Baidu want to learn a lot of information. Here I am just referring to the next there is such a thing.
- Application layer
- Presentation layer
- Session Layer
- Transport Layer
- Network layer
- data link layer
- Physical Layer
2.2 Internet five models
Internet use is really five models from OSI seven-layer model, and some people attributed to the five-model four-layer model, in fact, almost
Five models:
- Application layer
- Transport Layer
- Network layer
- data link layer
- Physical Layer
Four-layer model
- Application layer
- Transport Layer
- Network layer
- Physical link layer
Third, the introduction of five layers role model
Here are the contents of said bloggers own understanding. If wrong, please whisper bb.
Physical Layer
By high physical transmission medium low level signal, the computer is represented as 0 and 1.
data link layer
The data encapsulated in a frame. Each data frame is divided into: a header and a data head portion of two data
packet header: a fixed 18 bytes, 6: sender address / 6: receiver address / 6: Data Type
mac address : the sender, the recipient address is mac address. Each card has a unique mac address: 12 hexadecimal number (the first six digits are the manufacturer ID, the last six pipelined number)
Network layer
IP addresses: IPv4: 32-bit binary represented: dotted decimal notation from 0.0.0.0 to 255.255.255.255, the range is limited, not shown all the network devices, so there ipv6
Subnet Mask: by the subnet mask and ip ip is determined whether the two are in the same network segment, do a bitwise ip address and subnet mask by
ARP protocol: broadcasting a transmission data packet, the destination hosts mac address
IP (Internet) parse the IP datagram protocol peer host address obtained by ARP (Address Resolution) Protocol
Transport Layer
TCP (Transmission Control) protocol: establishing a reliable connection-oriented transmission path ( three-way handshake four wave ), transmits the data to the port number of the peer host address, required ACK response, inefficient, not loss, there is fast retransmission, etc. mechanism.
The UPD (user datagram protocol): without establishing a connection, send the data directly to the port number of the peer host address, no response, high efficiency, easy loss
Port: The port range 0-65535,0-1023 to occupy the port system . + IP subnet mask is determined uniquely by a device, uniquely determined by a software-only IP subnet mask + + port number.
The following will detail the process of TCP connection is established
Application layer
HTTP (Hyper Text Transfer) protocol
DNS (Domain Name System ): Providing Domain Name Service
FTP (File Transfer) protocol
Four, TCP protocol to establish a connection
tcp protocol:
Reliable connection-oriented transport, TCP packet length is not limited, and can be theoretically infinite, 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 re-segmentation is not necessary .
udp protocol:
Unreliable transport, "header" section of only a total of eight bytes, a total length of no more than 65,535 bytes, exactly into an IP packet.
tcp packets
tcp three-way handshake and four wave
Why TCP protocol is connection-oriented reliable transmission. The reason is that on the one hand, TCP needs to establish a reliable connection, and connection-oriented is what we call the three-way handshake and four waving . Other reason is that, reliable transmission , each of which is embodied in an ack packets need to be confirmed to ensure that the peer host port receives the packet. If you do not receive there will be a series of similar fast retransmission mechanisms, will resume transmitting data. If no response time will be disconnected.
tcp protocol to establish a connection process has been hailed as the image of the three-way handshake
When the process of release of connection is described as the image of the four wave
Three-way handshake:
- The first handshake: When a client initiates a connection request for no server, the server will always be in a listening state, always waiting for the client request initiated until the client initiates a connection request. (Server if a slag male, who is with him all the good he accepted)
- The second handshake: server client will initiate a connection request to make a confirmation response and establish a data transmission path, while the server and client attempts to establish a data reception path.
- Third handshake: When the client receives a confirmation request to establish a data transmission path, the establishment of data sent by the server will receive path request to make confirmation.
At this point after a three-way handshake before becoming established communication connection transmission
data transmission:
- When the client sends information to the server must wait to confirm the server receives data to be successful. Otherwise, there will be another operation. If the connection failed attempt for a long time will be disconnected.
Four waving :
- The first wave: the client is connected to the server connection request transmission data from transmission path.
- Second wave: a request sent by the client server will be confirmed
- The third wave: and then the server will initiate a server receives the disconnection request data connection path
- The fourth wave: the client receives a request, it will send a confirmation request to the server disconnect
At this point after four waved before becoming disconnected communication transmission
Five, DNS Domain Name Service
In fact, when the user in the browser address bar enter the url, it is to visit the site through the domain name server site. Such aswww.baidu.com
The DNS (Domain Name System) is the domain name to make parsing operation, resolved to an IP address. The DNS resolution service is provided.
Common DNS server addresses are: 114.114.114.114
,8.8.8.8
- 114.114.114.114 is the mobile, Telecom and China Unicom generic DNS, mobile phones and computer terminal can be used, clean and free of advertising, parsing success rate is relatively high, domestic users use more, but the speed is relatively fast, stable, is domestic Internet users commonly used DNS
- 8.8.8.8 DNS GOOGLE is provided by the company, the address is a global, relatively speaking, more suitable for foreign as well as access to foreign sites users