【Network and Communication】Network Fundamentals

1. Computer network

1) Classification

①By geographical location

Local area network, wide area network, metropolitan area network.

② According to the network topology

Star, Ring, Bus, Irregular

③ According to the transmission medium

wired network, wireless

④By service object

Enterprise network, campus network

2) Composition

①Communication subnet

Complete the network communication function.
Provided by telecommunications companies or other providers of communications information.

②Resource subnet

Provide high-level services such as network shared resources and data processing capabilities.
It consists of hardware (host and peripherals) and software (network operating system, network database).

3)

2. Network protocol

1) OSI system (Open System Interconnect, OSI reference model)

Communication subnets generally only contain the lowest three or even two layers.
A total of 7 floors. From low to high are:

①Physical layer

Complete the actual communication. is the only layer that directly transmits data (bitstream).

Functions:
i> Correctly and transparently transmit the bit stream on the physical medium (binary transmission).
ii> Shield the differences between physical devices and transmission media, and provide a unified data transmission service for the data link layer.

②Data link layer

Function: Input medium.
Data is transmitted in frame bit units.
Main function: Strengthen the function of the physical layer to transmit the original bit stream, and at the same time modify the physical connection that may be wrong in the physical layer into a logically error-free data link.
Error control and flow control of data transmission are key functions of the data link layer.

Common protocols: SLIP, PPP, X.25, Frame Relay.

Common error detection: parity check code, cyclic redundancy code.

③Network layer

Function: addressing and shortest paths.
The unit of data transmission is a packet.
Main function: select the verified route, and transmit the packets distributed by the transport layer accurately.

④Transport layer

Function: End-to-end connection.
Important functions of the transport layer: multiplexing and demultiplexing.
Multiplexing: transmits datagrams from multiple ports of the application layer to the network layer
Demultiplexing : removes the head of the network layer segment and sends it to the sockets of multiple ports

⑤ Session layer

Function: Interconnect host communication.
Does not participate in specific data transmission, but establishes rules for data interaction.

⑥ Presentation layer

Function: Data representation.
Provides a common language for heterogeneous machine communication, performing any transformations required of application-layer data for interoperability.

⑦Application layer

Function: Handle network applications.
Serve end users.

2) TCP/IP reference model

The TCP/IP protocol is a complete set of network protocols on the physical layer. TCP provides transport layer services and IP provides network layer services.
The TCP/IP reference model has no presentation layer and session layer, and consists of 4 layers (from top to bottom):

①Application layer

The highest layer, including all high-level protocols: remote login protocol TELNET, file transfer protocol FTP, simple mail transfer protocol SMTP, domain name service DNS, network news transfer protocol NNTP, hypertext transfer protocol HTTP.

②Transportation layer

Function: Guarantee end-to-end conversations.
This layer consists of two end-to-end protocols: TCP and UDP.

③Internet layer (network layer)

A formal packet format and protocol, the IP protocol, is defined.
Function: Send IP packets to where they should go.
Packet routing and blocking avoidance are the main design issues here.

④Network interface layer

Few protocols are defined so that the TCP/IP protocol adapts to almost all hardware platforms.

4) Transmission Control Protocol (TCP)

A connection-oriented protocol that divides the incoming byte stream into segments and passes it to the Internet layer.
TCP handles flow control to prevent fast senders from sending too many packets to slow receivers that the receiver cannot handle.
TCP sticky packet problem

5) User Datagram Protocol (UDP)

is an unreliable, connectionless protocol for programs that do not require TCP's ordering and flow control capabilities.

6) IP protocol (Internet Protocol)

The main concern is how to send data from one device to another through an internetwork.
The IP protocol is used to connect multiple packet-switched networks. It transmits what is called a data packet between the source address and the destination address. It also provides the function of reassembling the data size to adapt to different networks. Requirements for package size.

7) ARP (Address Resolution Protocol)

A TCP/IP protocol for obtaining physical addresses based on IP addresses .
When the host sends information, it broadcasts the ARP request containing the target IP address to all hosts on the network, and receives the return message to determine the physical address of the target; after receiving the return message, the IP address and physical address are stored in the local ARP The cache is kept for a certain period of time, and the ARP cache is directly queried for the next request to save resources.

8) RARP (Reverse Address Resolution Protocol)

RARP works in the opposite way to ARP.
RARP sends out the physical address to be resolved in reverse and expects to return its corresponding IP address, the reply includes the IP address issued by the RARP server capable of providing the required information. Although the sender sends a broadcast message, RARP specifies that only the RARP server can generate a reply. Many networks designate multiple RARP servers, both to balance load and as a backup in the event of a problem.

9) ICMP (Internet Control Message Protocol, Internet Control Message Protocol)

ICMP is an error and control message protocol in the Internet.
IP exchanges error information or other important information through ICMP, which works at the network layer.

10)voip(Voice over Internet Protocol)

The analog signal (Voice) is digitized and transmitted in real time on the IP network (IP Network) in the form of a data packet (Data Packet).

Common protocols: sip session initiation protocol, MGCP media gateway control protocol, MEGACO (a protocol between media gateways), h.323 (IP telephony)

3. Error checking code

1) CRC (Cyclic Redundancy Check, cyclic redundancy code, polynomial code)

CRC is a hash function that generates a short fixed-digit check code based on data such as network data packets or computer files. It is mainly used to detect or verify errors that may occur after data transmission or storage. It uses the principle of division and remainder for error detection.
When the sender encodes and the receiver checks, the CRC code can be obtained by using the generator polynomial G(X) agreed in advance.

①Working principle

i> The basic principle of generating CRC code:

Any code consisting of a string of binary bits can correspond one-to-one with a polynomial whose coefficients are only '0' and '1'.
For example: the polynomial corresponding to the code 1010111 is x6+x4+x2+x+1

ii> Principles of CRC code set selection:

Information bits to be sent (k bits): k-1 degree polynomial K(X)
redundant bits (r bits): r-1 degree polynomial R(X)
code word (n=k+r bits): n-1 degree Polynomial T(X)=(X^r) K(X) + R(X).

The coding process of generating redundant codes from information codes is the process of finding R(X) when K(X) is known.

Calculation:
Polynomial of degree r: G(X). (The highest term is always one)
(X^r) K(X) divided by G(X) is R(X)
Note: The subtraction in the division process is a modulo 2 operation, That is, the XOR operation (the same addition and subtraction is 0, and the different addition and subtraction is 1), and the operation of addition, carry, subtraction and borrow is not considered.

②Example questions

i> The data to be sent is 11001001, the generator polynomial using CRC is P(X)=X3+X+1, then the remainder that should be added after the data is (001)
problem solving process

2) Parity check code

The principle is to add one bit after 7 is the ASCII code, so that the number of 1s in the code word is always odd or even. After transmission, if one of the bits is wrong, the receiver can find the error according to the same rules (odd or even).

①Vertical parity (vertical parity)

②Horizontal parity

③Horizontal vertical parity check

4. IP address

1) Type

IP addresses are divided into 5 types according to different network IDs:

Class A address

A class A IP address consists of 1 byte (each byte is 8 bits) of network address and 3 bytes of host address, the highest bit of the network address must be "0". The range of the first field of the address of class A IP is 0~127, but because the address of all 0s and all 1s is used for special purposes, the actual range of the first field that can be assigned is 1~126, and each network can accommodate 100 million multiple hosts.
Network number 127 is reserved for loopback and diagnostic functions.

Class B address

A class B IP address consists of a 2-byte network address and a 2-byte host address. The highest bit of the network address must be "10", and the address range is from 128.0.0.0 to 191.255.255.255. There are 16,382 Class B networks available, each of which can accommodate more than 60,000 hosts.

Class C address

A class C IP address consists of a 3-byte network address and a 1-byte host address. The highest bit of the network address must be "110". The range is from 192.0.0.0 to 223.255.255.255. Class C networks can reach more than 2.09 million, and each network can accommodate 254 hosts.
The first three octets indicate the network, and the last octet indicates the host on the network. Network Load Balancing provides optional session support for Class C IP addresses (in addition to supporting a single IP address) to accommodate customers using multiple proxy servers at the customer site.

Class D address

Class D addresses are used for multicast (Multicast).
The first byte of a class D IP address starts with "1110", which is a specially reserved address. It does not point to a specific network, and this type of address is currently used in Multicasting. A multicast address is used to address a group of computers at a time, and it identifies a group of computers that share the same protocol.
Class D IP addresses do not identify the network, and their address coverage ranges from 224.0.0.0 to 239.255.255.255.

Class E address

Class E IP addresses start with "1111" and are reserved for future use. The range of his first byte is 240~255, which is mainly used for Internet experiment and development.

2) Summarize network segments

Advantages of IP Route Summarization

1. Reduce the size of the routing table
2. Reduce the burden on the router
3. Reduce the packet addressing time

calculation method

1. Determine the subnet address of the network segment to be summarized.
2. Write the subnet address of each network segment in binary.
3. Compare the network addresses represented by the binary of each network segment, start from the 1st bit and record the same consecutive bits, and fill in 0 from different bits to the 32nd bit. The address thus obtained is the IP address of the aggregated network segment, and its network bits are the same number of consecutive bits.

For example,
the IP addresses are 10.1.8.0/24 and 10.1.9.0/24, and the summary network segment is 10.1.8.0/23.
Solution:
10.1.8.0/24 == 10.1. 0000 100 0 .0/24
10.1.9.0/24 == 10.1. 0000 100 1 .0/24
Starting from a different bit, replace with 0, you get
10.1. 0000 100 0 .0 = 10.1.8.0
subnet mask is 8+8 +7 = 23 bits
so the summary network segment is 10.1.8.0 / the first 23 bits are the same

3) Domain name division

In the Internet domain name system, sub-domains can be divided under the domain. Domain names at all levels are separated by dots, and arranged in multiple layers in a smaller and smaller manner from right to left.
The domain name hierarchy is divided into three layers, namely the top layer (TOP-LEVEL), the second layer (SECOND-LEVEL), and the sub-domain (SUB-DOMAIN).

The top-level domain name types are:
  .COM commercial organization or company . ORG
  non-profit organization, group
  . GOV government department
  . MIL military department.
  NET organization or company engaged in Internet-related network services.
  XX consists of two letters Country code, such as .CN for China, .UK for UK, etc.

5. Concept

1) Gateway

The gateway is the exit from the local area network to the wide area network, and can work at different levels above the network layer of the OSI model.

2) Router

Advantages of routers

1. Suitable for large-scale networks;
2. Excellent network topology, load sharing and optimal paths;
3. Can handle multimedia better;
4. High security;
5. Isolate unwanted traffic
6. Save LAN 7.
Reduce the host responsible for

Disadvantages of routers

1. It does not support non-routing protocols; 2.
The installation is complicated;
3. The price is high.
, server configuration, network connection equipment, etc.
Because the network bandwidth is certain, if there is a large amount of data communication, there will be traffic jams. If the communication is affected by a certain device, this device is the bottleneck in the network)

router structure

The router structure consists of two parts: routing and packet forwarding

Work

The routing processor selects the output port for the incoming packet according to the routing table.
An important parameter to measure router performance is the number of packets that the router can process per second.

application

Over wireless, bridge 2 routers

3) Twisted pair

①Twisted pair connection:

Straight-through cable is used to connect different types of equipment: computer-switch, switch--router
Crossover cable is used to connect the same type of equipment: computer--computer, switch--switch
Reverse cable is used for computer to directly connect to router:. computer--router

4)

6. Network Security

1) Same Origin Policy

It is a security policy implemented by the browser to restrict the script loaded on a page from accessing pages of other different origins, so as to avoid the occurrence of cross-origin (cross-domain) access.
The url of a web page consists of protocol, program, port and path.
Homologous means: two urls share the same protocol, domain name, and port.
For example: http://www.example.com/dir/index.html , the protocol is http://, the domain name is: www.example.com, and the port is 80.

2) Cross-site scripting attack

Including a lot of dynamic content in a website to improve the user experience is much more complicated than it used to be. The so-called dynamic content means that according to the user's environment and needs, the Web application can output the corresponding content. Dynamic sites will be subject to a type of attack called "Cross Site Scripting" (Cross Site Scripting, which security experts usually abbreviated to XSS, which should be css originally, but in order to distinguish it from Cascading Style Sheets (CSS). , hence the name XSS), while static sites are completely immune to it.
Users often click on links while browsing websites, using instant messengers, or even reading emails. Attackers can steal user information by inserting malicious code into the link. Attackers usually encode the link in hexadecimal (or some other encoding) so that users don't suspect its legitimacy. A website that receives a request containing malicious code will generate a page containing malicious code that looks like the legitimate page that site should generate. Many popular guestbook and forum programs allow users to post posts containing HTML and javascript. Suppose user A publishes a post containing a malicious script, then when user B browses the post, the malicious script will be executed to steal user B's session information. Details about the attack method will be explained below.

3)

7. Application

Chrome proxy settings

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325534621&siteId=291194637