Data Communication and Computer Network Review Notes

A rough overview of data communications and computer networks

Front

First understand the brief process from entering URL to displaying

  1. Input URI, resolve host domain name, resource location (URI resolution & DNS resolution/URL resolution)

After entering the URI (Uniform Resource Identifier), parse out the protocol, host , port, path and other information, and construct an HTTP request. The URL is then parsed to find the host IP address. [Strong caching, negotiation caching]

  1. The process of sending HTTP messages

    • The HTTP transmission operation is handed over to the protocol stack of the operating system [composition of the protocol stack: TCP (requires connection), UDP (no connection is required), IP (transmission network packet specifies the route)], and adds the TCP header, The IP header and the MAC header construct the request network packet.
    • Reliable resource transmission TCP, host remote location IP, switch two-point transmission MAC
    • Network card: Add the header and the start frame delimiter to the binary packet of the network packet, add the frame check sequence FCS for detecting errors at the end, and finally convert the binary packet into an electrical signal and send it to the switch
    • Switch: convert the electrical signal into a digital signal, then look up the MAC address according to the MAC address table and send the signal to the corresponding port until it reaches the router.
    • Router: Receive the data packet sent to itself, remove the MAC header, judge the host address according to the gateway column of the routing table, and send it.
  2. TCP three-way handshake to establish a network connection (TCP three-way handshake, {[SYN], [SYN, ACK], [ACK] [one confirms the sending ability of the client, confirms the sending ability and receiving ability of the server, and confirms the receiving ability of the client]] })

  3. The client sends a request (send HTTP message GET /HTTP/1.1)

  4. The server processes the response request, returns an HTTP message, and the client confirms (the server TCP sends an ACK to the client for confirmation, returns an Http/1.1 200 OK message, and the client TCP sends an ACK to the server for confirmation)

  5. Browser loads/renders page

  6. Close the browser and disconnect the TCP connection after waiting for a period of time

Data Communication Basics

Analog and digital signal concepts

Data is the entity that transmits information , and signal is the electrical or electromagnetic manifestation of data , which is the existing form of data during transmission.

  • Analog Signal: Data or signal that changes continuously .
  • Digital Signal: Data whose values ​​allow only a limited number of discrete values.

Advantages of Digital Communication

  1. Strong anti-interference ability , no noise accumulation
  2. Easy to encrypt
  3. Easy to store, handle and exchange
  4. Equipment is easy to integrate and miniaturize

Data communication system model composition (different descriptions are given from different angles)

  • The model includes three parts : source system , transmission system and destination system

  • The system model of data communication consists of three parts: data source , data communication network and data sink .

  • Textbook description: From the composition of the system equipment level ( system composition ) - equipment terminal subsystem, data transmission subsystem and data processing subsystem

Key performance indicators of data communication systems

(1) Effectiveness index : A measure of the transmission capability index of a data communication system, which refers to the amount of channel resources consumed by the transmission of a certain amount of information . Channel resources include channel bandwidth, transmission rate , and frequency band utilization time.

(2) Characteristic indicators . Error rate : The accuracy rate at which the receiving end obtains correct data . Reliability: the accuracy of the transmitted information , etc.

Definition, main functions and performance indicators of computer network

network definition

A computer network is a system that connects computer systems through communication equipment and lines , and realizes resource sharing and information transmission by fully functional software . Simply put, it is a collection of interconnected and autonomous computer systems

Main functions (five)
  • data communication
  • Resource Sharing
  • distributed processing
  • Improve reliability
  • load balancing
Performance indicators (seven)
  • bandwidth
  • time delay
  • delay-bandwidth product
  • round trip delay
  • throughput
  • rate
  • channel utilization

Shannon formula

C = W ∗ l o g 2 ( 1 + S / N ) C = W*log_2(1+S/N) C=Wlog21+S/N

Classification and characteristics of signals

Signal Classification
  1. Continuous and Discrete Signals

  2. deterministic and random signals

signal characteristics
  1. Temporal characteristics : the fast and slow characteristics of the signal over time
  2. Frequency characteristics : the signal is represented by a spectral function

transfer method

  1. Baseband Transmission and Bandwidth Transmission

  2. Serial transmission and parallel transmission.

  3. Synchronous and asynchronous transfers.

  4. Simplex transmission, half duplex transmission and full duplex transmission.

The difference between asynchronous transmission and synchronous transmission

  • Asynchronous transmission is character -oriented , while synchronous transmission is bit-oriented

  • Asynchronous transmission is in bytes , and synchronous transmission is in frames

  • The start and end of asynchronous transmission characters are judged by the start bit and stop bit, while synchronous transmission needs to be judged by extracting the synchronization information of the data

  • Asynchronous transmission has low timing requirements, while synchronous transmission requires a specific clock line to coordinate timing

  • Asynchronous transmission efficiency is lower than synchronous transmission

  • Asynchronous transmission of data can send multiple pieces of data one after another without considering time synchronization

Synchronous transmission should consider clock synchronization
  • Synchronous transmission : Bits are transmitted one after the other, with no gaps in between, and the duration of each bit is equal. There are two ways to synchronize the clocks of the sending and receiving parties . External sync (adding a Dangdu clock line) and internal sync (Manchester encoding).
  • Asynchronous transmission : transmission is performed in units of bytes , the interval between bytes is not fixed , but the duration of bits in each byte is equal . In other words, the bytes are asynchronous, but the bits are still synchronous. To do this, start and end bits need to be added to each character .

Transmission Rate and Bandwidth Utilization

Two transfer rates

(1) Modulation rate (baud rate, symbol transmission rate)
RB = 1 T ( s ) [ T is the modulation time length] R_B = \frac{1}{T_{(s)}} [T is the modulation time length ]RB=T(s)1[ T is the modulation time length ]

(2) Data signal rate (transmission rate)

R b = ∑ i = 1 n 1 T i l o g 2 M i R_b = \sum^{n}_{i=1}\frac{1}{T_i}log_2 M_i Rb=i=1nTi1log2Mi
n is the channel number of parallel transmission , T is the time length of the modulation signal wave of the first unit of the i-th channel , and M is the state number of the i-th channel of the modulation signal wave .

  • Transmission rate (bit/s) = R baud rate (symbol transmission rate) * the amount of information that each symbol can carry (log2X)
  • Frequency band utilization = frequency bandwidth occupied by the R_b/B system

Transmission impairments and transmission quality indicators, causes

  • Transmission damage: Data signals may be damaged in every link in the end-to-end connection transmission of the communication system , and this damage is diverse.
  • Transmission impairment indicators are bit errors , jitter , and drift , in addition to slippage , delay , and frame loss .
  • There are two reasons for transmission damage: one is external environmental factors and internal defects of the equipment . On the other hand, it is the mutual influence or transformation between transmission damages .

data transmission channel

Classification of channels

According to different angles, there are four classifications
  1. According to the signal type allowed to be transmitted by the channel , it can be divided into digital channel and analog channel

  2. According to the relationship between the transmission direction and time of the channel , it can be divided into simplex, half-duplex and full-duplex channels

  3. According to the method of channel use , it can be divided into dedicated channel and public exchange channel

  4. According to the transmission medium used by the signal , it can be divided into wireless channel and wired channel

Channels can be divided into two categories
  • One is the spatial propagation channels of electromagnetic waves, such as short-wave channels, ultra-short-wave channels, microwave channels, light wave channels, etc.; they have free spaces with various propagation characteristics , which are customarily called wireless channels ;
  • The other is the guided propagation channel of electromagnetic waves . Such as open wire channel, cable channel, waveguide channel, fiber channel, etc. They have guide bodies with various transmission capabilities , which are traditionally called wired channels .

Two Calculation Methods of Channel Capacity

Analog channel capacity calculation (Shannon formula), W is the channel width

C = W l o g 2 ( 1 + S N ) C=W log_2(1+\frac{S}{N}) C=Wlog2(1+NS)

2.25 ∗ 1 0 6 2.25*10^6 2.25106 pictures, each pixel has 16 brightness levels, the calculation of each information of the image:

  • The amount of information required for 16 brightnesses is: log 2 16 = 4 log_216=4log216=4
  • The amount of information in the picture is: 2.25 ∗ 1 0 6 ∗ 4 = 9 ∗ 1 0 6 2.25 * 10^6 * 4 = 9*10^62.251064=9106
Digital Channel Capacity Calculation (Quest Formula)

C = 2 W l o g 2 N C = 2W log_2N C=2Wlog2N
W is the channel width N and the number of value states of the transmitted channel


data transmission technology

sampling theorem

Steps in converting an analog signal to a digital signal: sampling, quantization, and encoding

The sampling theorem lays a theoretical foundation for the digitization of analog signals. If the highest frequency of a continuous analog signal S(t) is less than Fh, then the interval time is T ≤ 1 2 F h T\leq\frac{1}{2}FhT21F h is sampled by the periodic impulse pulse, and S(t) will be completely determined by such a sample value, and sampling is performed at equal intervals, which is also called the uniform sampling theorem.

Pulse Code Modulation (PCM)

There are three main ways:

  1. Pulse Code Modulation [PCM]

  2. Differential Pulse Code [DPCM]

  3. Adaptive Differential Pulse Coding [ADPCM]

Analog Pulse Modulation

  • adjustable
  • PAM pulse amplitude
  • PDM pulse width
  • PPM pulse phase (position)

Advantages and principles of folding binary code

  1. The last bit is used to indicate the polarity, and the bipolar voltage can be processed by unipolar encoding, which greatly simplifies the encoding circuit and encoding process

  2. Bit errors have less impact on voltage

Research reasons, requirements, and waveforms of baseband transmission technology

reason:

  1. Near-distance data communication widely uses baseband transmission

  2. The data transmission system has a process of processing baseband waveforms for transmission signal and channel matching

Algorithm encoding used for transmission

  • non-return-to-zero encoding
  • return-to-zero coding
  • Manchester encoding
  • Differential Manchester encoding

Three modulation methods and waveforms of frequency band transmission technology

  • modulation
  • FM
  • phase modulation

channel access technology

  • Access: the information exchange between the subject and the object or the change of the system state, the interaction between the subject and the object.

  • Subject: An active entity that causes information to flow or changes the state of the system, such as: people, processes, equipment, etc.

  • Object: is a passive entity that contains or receives information

Such as: records, files, processors, network nodes, etc.

  1. Channel access technology: A technology that ensures a single use of common channels when the common channels are not multiplexed

  2. Polling Access Techniques: Round Robin Polling, Pass-Through Polling

  3. Contention access technology: ALOAM, CSMA carrier sense multiple access technology

  4. Ring Access Technology: Token Ring , Slotted Ring

channel multiplexing technology

Benefits of using multiplexing: improving channel transmission efficiency

Frequency Division Multiplexing

principle:

  • The entire transmission frequency band is divided into several frequency channels , and each user occupies a frequency channel . Guard bands are left between frequency channels.

The main advantage

  • The implementation is relatively simple , the technology is mature, and the channel frequency band can be fully utilized

main disadvantage

  • The existence of the guard frequency band greatly reduces the efficiency of the FDM technology.

  • The nonlinear distortion of the channel changes its actual frequency band characteristics and easily causes crosstalk and intermodulation noise interference.

  • The amount of required equipment increases with the increase of the number of input channels, and it is not easy to miniaturize;

  • Frequency division multiplexing itself does not provide error control technology, which is not convenient for performance monitoring.

Wave Division Multiplexing

principle:

  • The entire wavelength band is divided into several wavelength ranges , and each user occupies one wavelength range for transmission.

Time Division Multiplexing

principle:

  • Divide time into small time slices, each time slice is divided into several channels (time slots) , and each user occupies a channel to transmit data.

TDM working characteristics: (suitable for digital channel communication)

  • The communication parties communicate according to the pre-designated time slots . And this time relationship is fixed;

  • For a moment, only the signal of a certain pair of devices is transmitted on the common channel, not the multiplexed signal; but for a period of time, the multiplexed signal separated by time is transmitted on the common channel.

Disadvantages of TDM:

  • If a user has no data to send, other users cannot occupy the channel, which will cause a waste of bandwidth.

  • Improvement: statistical time division multiplexing (STDM), the user does not occupy a certain channel fixedly, and puts data into it if there is an empty slot.

Code Division Multiplexing (CDMA)

CDMA divides the signal according to the difference of the pattern structure
  • Since each user uses a specially selected code pattern, they can use the same frequency band for communication at the same time without causing mutual interference.

  • If viewed from the perspective of frequency domain or time domain, multiple CDMA signals overlap each other.

  • In CDMA, each bit time is divided into m intervals called chips.

  • Usually the value of m is 64 or 128

  • Each station using CDMA assigns a unique m bit chip sequence The chip sequence uses a pseudo-random sequence

  • It is a direct sequence spread spectrum communication method

CHARACTERISTICS OF CHIP USED IN CDMA SYSTEM
  • The chips assigned to each station are not only different from each other, but also must be orthogonal to each other

  • The normalized inner product of any chip vector is 1

  • Let vector S denote the chip sequence of station S , and let vector T denote the chip sequence of any other station . The chip sequences of two different stations S and T are orthogonal, that is, the normalized inner product of vectors S and T is 0; S ∗ T = 0 S ∗ T = 0 S ∗ S = 1 S ∗ S = − 1 S* T=0\ S*T= 0\ S*S= 1\ S*S = -1ST=0 ST=0S S=1 S S=1

advantage:

  • Simplifies the channel, allowing users to randomly access any channel at any time

shortcoming:

  • Low channel bandwidth utilization

Multiplexing is to divide the frequency band resources of a single medium into many sub-channels , and these sub-channels are independent of each other and do not interfere with each other . From the perspective of the overall frequency band resources of the media, each sub-channel only occupies a part of the frequency band resources of the media.

Multiple access (more precisely, multipoint access) deals with the dynamic allocation of channels to users . This is necessary in applications where the user only occupies the channel temporarily , which is basically the case in all mobile communication systems. In contrast, in applications where channels are permanently assigned to users, multiple access is not required (as is the case for radio or television broadcast stations).

data exchange technology

circuit switching

The process by which the switching device finds out an actual physical line between the communicating parties . (The earliest circuit-switched connections were made by telephone operators via plugs, and now by computerized program-controlled switches .)

Features: An end-to-end path needs to be established before data transmission.

  • Call - establish connection - transmit - hang up

When data communication is performed with circuit switching, there are two restrictions:

  • The two stations on both sides of the communication must be active and available at the same time ;

  • Communication resources between the two stations must be available and must be dedicated.

This exchange method is more suitable for occasions where the amount of transmitted information is large and the communication object is relatively certain .

advantage:

  • After the connection is established, the transmission delay is small ; the processing overhead is small;

  • There are no restrictions on the format and encoding type of data information .

shortcoming:

  • It takes a long time to establish a connection;

  • Once the connection is established, the line is monopolized, and the line utilization rate is low;

  • User terminals of different types and characteristics cannot communicate with each other;

  • There are transmission losses;

message exchange

The entire message is sent together as a whole. During the switching process, the switching device stores the received message first , and then forwards it when the channel is free , and transfers it step by step until it reaches the destination. This data transfer technique is called store-and-forward

The main advantage:

  • High line utilization ;

  • The switch transmits data information in a "store-and-forward" manner, which can not only match the input and output transmission rates, but also prevent call blocking and smooth the peak value of communication traffic;

  • Easy to achieve intercommunication between various types of terminals;

  • It is not necessary for the sending and receiving ends to be active at the same time.

shortcoming:

  • Packet sizes vary, resulting in complex buffer management.
  • Large packets cause too long store-and-forward delays;
  • After an error occurs, the entire message is resent.

packet switching

Divide the packet into several equal-sized packets (Packets) for storage and forwarding .

advantage:

  • The storage requirement is small, and the memory can be used to buffer the grouping - the speed is fast;

  • Small forwarding delay - suitable for interactive communication;

  • If a packet fails, only the packet is resent - high efficiency ;

  • Each packet can be transmitted through different paths, with high reliability

Features:

  • There is no need to establish an end-to-end path before data transmission.
  • It has powerful error correction mechanism, flow control and routing selection functions.

During the transmission of packets or packets , the following three types of delays should be considered:

  • Propagation Delay : Refers to the time it takes for an electrical signal to travel through a physical medium .

  • Transmission delay: refers to the time required to send a message or packet , which is related to the line transmission rate and information format used.

  • Node delay: refers to the processing time required by the node switch to forward the received message or packet .


physical layer

Four characteristics of the physical layer

  • Electrical characteristics: specify the shape and size of the connector used for the interface , the number and arrangement of pins, and the fixing and locking device .
  • Mechanical characteristics: Indicates the range of voltages that appear on the various lines of the interface cable .
  • Functional characteristics: Indicate the meaning of a certain level of voltage appearing on a certain line .
  • Process characteristics: Indicate the sequence of occurrence of various possible events for different functions .

data link layer

Data link layer two channels

  • point-to-point channel
  • broadcast channel

The difference between physical link and data link

The difference between a data link and a link is that in addition to the physical link, the data link must also have some necessary procedures to control the transmission of data

Therefore, the data link has more hardware and software than the physical link required to implement the communication protocol .

Reliable transmission over the link

" The circuit is connected" means that the node switches at both ends of the link have been turned on, and the physical connection has been able to transmit bit streams

However, the data transmission is not reliable. On the basis of the physical connection, the "data link is connected" when the data link connection is established.

Since then, due to the detection, confirmation and retransmission functions of the data link connection, the less reliable physical link becomes a reliable data link for reliable data transmission. When the data link is disconnected, the physical circuit connection Not necessarily followed by disconnection.

The main functions of the link layer

  • link management

  • Frame delimitation (frame header and frame trailer)

  • Transparent transmission: It means that the data link layer has no restrictions on the transmission data delivered by the upper layer , as if the data link layer does not exist

  • flow control

  • error detection

  • Bit Error Rate BER : The ratio of transmitted erroneous bits to the total number of transmitted bits over a period of time

3 Fundamental Problems in Point-to-Point Channels

frame delimitation

  • Transparent transmission . Byte -oriented physical (asynchronous) links use byte stuffing (insertion of "escape characters") for transparent transmission;

Sender's processing:

  • Every occurrence of a 7E (PPP frame delimiter ) byte is converted to a 2-byte sequence ( 7D,5E ). Every occurrence of 7D ( escape character ) bytes is converted to a 2-byte sequence ( 7D,5D ).

  • For each ASCII code control character ( character whose value is less than 0x20 ), a 7D is inserted in front of the character

  • byte, and add 0x20 to the encoding of the character at the same time.

Recipient's processing

  • The data part of the original frame can be restored by inverse transformation.

Bit - oriented physical (synchronous) links use bit stuffing for transparent transmission; byte counting; illegal bit encoding

sender's processing

  • Scan the data part of the frame (usually implemented by hardware). As soon as 5 consecutive 1 bits are found, 1 bit 0 is immediately filled.

Recipient's processing

  • Scan the data part of the frame (usually implemented by hardware). As long as 5 consecutive bit 1s are found, the subsequent 1 bit 0 is deleted.

error detection

Cyclic redundancy check CRC , using error detection code to detect whether bit errors occur during data transmission

  • Each time the receiver receives a PPP frame , it performs a CRC check
  • If the CRC check is correct, accept the frame
  • Otherwise, the frame is discarded
  • The data link layer using PPP does not provide reliable transmission services upwards

PPP protocol and PPPoE protocol

The PPP protocol provides a standard method for transmitting datagrams of various protocols over point-to-point links

Consists of the following three parts

  • Encapsulation method for various protocol datagrams (encapsulation into frames)
  • Link Control Protocol LCP : used to establish, configure and test data link connections
  • A set of Network Control Protocols NCPs : each of which supports different network layer protocols

CSMA/CD (Carrier Sense Multipoint Access with Collision Detection) Protocol Working Mechanism

Adopt the strategy of listening while sending

working principle:

  • Monitor whether the channel is idle before sending, and send data immediately if it is idle.
  • When sending, continue to monitor while sending. If a conflict is detected, the sending is stopped immediately.
  • Wait for a random amount of time (called a backoff) before trying again.

Channel Utilization Calculation Method

  • Minimum frame length = contention period (round trip delay) * data transfer rate

stop-and-wait protocol

Channel utilization = data frame transmission delay / (data frame transmission delay + end-to-end round-trip delay)

  1. When the round-trip delay RTT is much greater than the data frame transmission delay Tp (for example, using a satellite link), the channel utilization is very low.
  2. If retransmission occurs, the channel utilization rate will be reduced for transmitting useful data information.
  3. In order to overcome the shortcoming of the low channel utilization rate of the stop-and-wait protocol, two other protocols are produced, namely the back-N frame protocol GBN and the selective retransmission protocol SR.

Realization Mechanism of Reliable Transmission—Stop-and-Wait Protocol SW (Stop-and-Wait)

  • Acknowledgments and denials - timeout retransmissions - lost acknowledgments - late acknowledgments

【Precautions】

  • When the receiving end detects that there is an error in the data packet , it discards it and waits for the timeout retransmission of the sender . But for a point-to-point link with a high bit error rate , in order for the sender to retransmit as soon as possible

  • A NAK packet may also be sent to the sender .

  • In order for the receiver to determine whether the received data packets are duplicates, the data packets need to be numbered . Due to the stop-and-wait protocol's stop-and-wait feature, only one bit number is enough, that is, numbers 0 and 1.

  • In order for the sender to determine whether the received ACK packets are duplicates, the ACK packets need to be numbered , and the number of bits used is the same as the number of bits used for data packet numbering . The data link layer generally does not have the situation that the ACK packet is late, so the implementation of the stop-wait protocol at the data link layer does not need to number the ACK packet .

  • The overtimer retransmission time setting is generally slightly longer than the RRT round-trip retransmission time .

Realization Mechanism of Reliable Transmission - Go-Back-N Protocol GBN (Go-Back-N)

sender
  • Send window size WT W_TWTThe value range of is 1 < W r ≤ 2 n − 1 1<W_r\le2^n-11<Wr2n1 wheren is the number of bits constituting the packet sequence number.

    • W r = 1 W_r=1 Wr=1 stop-and-wait protocol
    • W r > 2 n − 1 W_r > 2^n-1 Wr>2n1 The receiver cannot distinguish between new and old data packets
sending process
  • The sender can send all the multiple data packets whose serial numbers fall within the sending window without receiving the confirmation packet from the receiver ;

  • Only when the sender receives an acknowledgment of the sent data packet, the sending window can slide forward accordingly ;

  • When the sender receives multiple duplicate acknowledgments, it can start retransmission as early as possible before the retransmission timer expires, depending on the specific implementation .

  • When a data packet that has been sent within the sending window of the sender is timed out and retransmitted, all subsequent data packets that have been sent within the sending window must also be retransmitted . This is the origin of the name of the rollback N frame protocol.

receiver

Receiver's receive window size WR W_RWRThe range of values ​​is W p = l Wp = lWp=l , sothe receiver can only receive data packets in order.

Receiving process
  • The receiver only receives the data packet whose sequence number falls within the receiving window and has no error code , and slides the receiving window forward by one position , and at the same time sends back the corresponding confirmation packet to the sender .

  • Accumulated acknowledgment : In order to reduce overhead , the receiver does not necessarily send back a confirmation packet to the sender every time it receives a data packet that arrives in order and has no error, but can receive several data packets that arrive in sequence and are error-free. After the data is grouped (determined by the specific implementation), the confirmation packet is sent for the last data packet ;

  • Or you can carry out piggyback confirmation on the data packets received in sequence and without errors when you have data packets to send ;

  • When the receiver receives the data packets that arrive out of order, in addition to discarding them, it must confirm the most recently received data packets in order ;

Realization Mechanism of Reliable Transmission—Selective Retransmission Protocol SR (Selective Request)

sender
  • Send window size WT W_TWTThe value range of is 1 < WT ≤ 2 n − 1 1<W_T\le2^n-11<WT2n1 where n is the number of bits constituting the packet sequence number.
    • W r = 1 W_r=1 Wr=1 Same as stop-and-wait protocol
    • W r > 2 ( n − 1 ) W_r>2^{(n-1)} Wr>2( n 1 ) The receiver cannot distinguish new and old data packets
sending process
  • The sender can send all the multiple data packets whose serial numbers fall within the sending window without receiving the confirmation packet from the receiver ;

  • Only when the sender receives the acknowledgment of the sent data packets in sequence , the sending window can slide forward accordingly ;

  • If the acknowledgment packet that arrives out of order is received, record it to prevent the overtime retransmission of the corresponding data packet, but the sending window cannot slide forward.

receiver
  • Receive window size WR W_RWRThe value range of l < WR ≤ WT l < W_R ≤ W_Tl<WRWT

  • W r = 1 W_r=1 Wr=1 Same as stop-and-wait protocol

  • W R > W r W_R>W_r WR>Wr, meaningless

Receiving process
  • The receiver can receive data packets that arrive out of order, but have no bit errors and the sequence number falls within the receiving window ;

  • In order for the sender to retransmit only the packets with errors , the receiver can no longer use cumulative acknowledgment , but needs to confirm each correctly received data packet one by one!

  • Only after the receiver receives the data packets in sequence, the receiving window can slide forward correspondingly .

Two services provided by the network layer

  • Connection Oriented Virtual Circuit Service
  • Connectionless Datagram Service

IPV4 address format, each type of address range

Class A address
  • The number of assignable networks is $:2^{(8-1)}-2= 126 $

  • The assignable ip address is: 2 24 − 2 = 16777214 2^{24}-2= 167772142242=16777214

Class B address
  • The number of assignable networks is 2 16 − 2 = 16384 2^{16-2}=163842162=16384
  • The number of IP addresses that can be allocated in each network is 2 16 − 2 = 65534 2^{16}- 2= 655342162=65534 (subtract 2 to remove the network address with the host number of all 0s and the broadcast address with all 1s)
Class C address
  • The number of assignable networks is 2 24 − 3 = 2097152 2^{24-3} =20971522243=2097152
  • The number of IP addresses that can be allocated in each network is $2^8-2= 254 $ ( minus 2 to remove the network address with the host number of all 0s and the broadcast address with all 1s )

Notice

  • Only class A, B, and C addresses can be assigned to each interface of a host or router in the network

  • The address with the host number **"all 0" is a network address** and cannot be assigned to each interface of the host or router

  • The address whose host number is **"all 1" is a broadcast address** and cannot be assigned to each interface of the host or router.

Subnetting Rules

Knowing how to get the
32- bit subnet mask of the network address through the subnet mask can show that the host number part of the classified IP address is borrowed a few bits as the subnet number

  • The subnet mask uses consecutive bits 1 to correspond to the network number and subnet number

  • The subnet mask uses consecutive bits of 0 to correspond to the host number

The network address of the subnet where the IPv4 address is located can be obtained by performing a logical AND (&) operation on the subnetted IPv4 address and its corresponding subnet mask

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-AJdz3EeC-1655397396243)(C:/Users/geer/AppData/Roaming/Typora/typora-user-images/ image-20220613153755418.png)]

CIDR classless addressing IP4 address

  • CIDR eliminates the traditional Class A, Class B and Class C addresses , as well as the concept of subnetting;

  • CIDR can allocate IPv4 address space more efficiently and allow the Internet to continue to grow in size before the new IPv6 is adopted.

  • CIDR uses **"slash notation", or CIDR notation**. That is, add a slash "/" after the IPv4 address, and write the number of bits occupied by the network prefix after the slash.

【Example】

Number of bits occupied by network prefix : 20

128.14.35.7 /20

The number of bits occupied by the host number: 32-20=12

CIDR actually forms a "CIDR address block" of consecutive IP addresses with the same network prefix.

As long as we know any address in the CIDR address block, we can know all the details of the address block

The difference between IP address and hardware address

The IP address is used to distinguish the functions of different networks , and the mac address is the unique identification of each interface on the network , not the unique identification of each network device.

  • The source IP address and destination IP address remain unchanged during packet forwarding ;

  • During data packet forwarding, the source MAC address and destination MAC address change link by link (or network by network) .

ARP protocol working mechanism, NAT protocol function

ARP working mechanism

  • The source host looks up the MAC address corresponding to the IP address of the destination host in its own ARP cache table . If found, the MAC frame can be encapsulated for sending; if not found, an ARP request (encapsulated in the broadcast MAC frame) is sent;

  • After the destination host receives the ARP request , it records the IP address and MAC address of the source host in its own ARP cache table , and then sends an ARP response (encapsulated in a unicast MAC frame) to the source host. IP address and MAC address of the host;

  • After the source host receives the ARP response , it records the IP address and MAC address of the destination host in its own ARP cache table, and then it can encapsulate the MAC frame it wanted to send and send it to the destination host;

  • Scope of ARP: used link by link or network by network , not across multiple networks;

  • In addition to ARP requests and responses, ARP also has other types of messages (such as "Gratuitous ARP (Gratuitous ARP)" for checking IP address conflicts;

  • ARP has a security verification mechanism, and there is an ARP spoofing (attack) problem.

Network Address Translation NAT (Network Address Translation)

  • NAT enables a large number of private network users using internal private addresses to share a small number of external global addresses to access hosts and resources on the Internet.

  • NAT shields the network address of the internal network host from the external network, and can provide certain security protection for the internal network host.

  • NAPT address to port number conversion (Network Address and Port Translation): Most networks use the TCP and UDP protocols of the transport layer to transmit data, and can use the port number and IP address of the transport layer for translation , using an IP address Implement network communication with multiple local hosts.

Two Packet Forwarding Mechanisms in IP Layer

  • Not subnetted

  • subnetting

  • Packet forwarding, also known as packet delivery, refers to the physical transmission or forwarding delivery mechanism of routers forwarding IP packets.

Three Exchange Mechanisms

  • Not subnetted
  • subnetting
  • CIDR mechanism

routing protocol

The basic working principle of Routing Information Protocol RIP

RIP (Routing Information Protocol) is one of the first widely used protocols in the interior gateway protocol IGP, and its related standard document is RFC 1058.

RIP requires each router in an autonomous system AS to maintain a record of the distance from itself to every other network in the AS. This is a set of distances, called "Distance Vector DV (Distance-Vector)".

  • RIP uses the hop count (Hop Count) as the metric (Metric) to measure the distance to the destination network.

  • The distance from the router to the directly connected network is defined as 1.

  • The distance from a router to a non-directly connected network is defined as the number of routers it passes plus 1.

  • A path is allowed to contain up to 15 routers. When the "distance" is equal to 16, it is equivalent to unreachable.

Therefore, RIP is only suitable for small Internet.

Features and types of ICMP protocol

  • Hosts or routers use ICMP to send error report messages and query messages .

  • ICMP messages are encapsulated in IP datagrams and sent.

There are two commonly used ICMP query messages:
  • Send back requests and answers , and test whether the destination site is reachable (Ping, tracert commands, the application layer directly uses ICMP at the Internet layer)
  • Timestamp requests and replies for clock synchronization and time measurement
Five situations of ICMP error report message
  1. Destination unreachable : When a router or host cannot deliver a datagram , it sends a destination unreachable message to the source.
  2. Source suppression : When a router or host discards a datagram due to congestion , it sends a source suppression message to the source to let the source know that the sending rate of the datagram should be slowed down.
  3. Time Exceeded : When the router receives an IP datagram whose destination IP address is not its own, it will subtract 1 from the value of its TTL field . If the result is not 0, the IP datagram is forwarded; if the result is 0, in addition to discarding the IP datagram, a time exceeded message is also sent to the source point.
  4. Parameter problem : When the router or destination host receives the IP datagram, it finds that there is a bit error in the header according to the checksum field in the header, discards the datagram, and sends a parameter problem message to the source.
  5. Change route (redirection) : The router sends the change route message to the host , letting the host know that the datagram should be sent to another router next time (through a better route)

IGMP protocol function

  1. The host informs the router through IGMP that it wants to receive or leave a specific multicast group.
  2. The router periodically queries whether the multicast group members in the LAN are active through IGMP , so as to realize the collection and maintenance of group membership in the connected network segment .

transport layer

Basic functions : How to provide direct communication services for application processes running on different hosts is the task of the transport layer, and the transport layer protocol is also called an end-to-end protocol .

User Datagram Protocol UDP (User Datagram Protocol):

  • no connection

  • Support one-to-one, one-to-many, many-to-one and many-to-many interactive communication.

  • Directly package the packets delivered by the application layer

  • Best-effort delivery, aka unreliable;

  • Flow control and congestion control are not used.

  • The header overhead is small, only 8 bytes

Transmission Control Protocol TCP (Transmission Control Protocol):

  • Connection-oriented: Each TCP connection can only have two endpoints EP, which can only be one-to-one communication.
  • Byte stream oriented: reliable transport, using flow control and congestion control.
  • The minimum of the header is 20 bytes, and the maximum is 60 bytes

TC is based on the basic principle of reliable transmission

1. TCP is based on a sliding window in bytes to achieve reliable transmission
  • Although the sender's send window is set according to the receiver's receive window , at the same time, the sender's send window is not always as large as the receiver's receive window.

  • TCP does not clearly stipulate how to deal with data that arrives out of order.

  • TCP requires the receiver to have cumulative acknowledgment and piggyback acknowledgment mechanisms , which can reduce transmission overhead. The receiver can send a confirmation at an appropriate time, or send the confirmation message along with it when it has data to send.

  • TCP communication is full-duplex communication. Each party in the communication is sending and receiving segments.

2. Serial number confirmation
  • An acknowledgment is required for each message received by the sender and receiver
3. Flow control (sliding window mechanism)

The so-called flow control (flow control) is to make the sender's sending rate not too fast, so that the receiver has time to receive.

  • The flow control of the sender can be easily implemented on the TCP connection by using the sliding window mechanism .

  • The TCP receiver uses the size of its own receive window to limit the size of the sender's send window .

  • After the TCP sender receives the receiver's zero-window notification, it should start the persistence timer . After the persistence timer expires, a zero-window detection message is sent to the receiver.

4. Congestion control mechanism
  • slow start
  • congestion avoidance
  • fast retransmission
  • fast recovery
  • timeout retransmission

The seven-layer architecture of OSI, the five-layer principle system and the four-layer architecture of TCP/IP

  • Seven layers: application layer-presentation layer-session layer-transport layer-network layer-data link layer-physical layer

  • Five layers: application layer-transport layer-network layer-data link layer-physical layer

  • Four layers: application layer-transport layer-network layer-link layer

Five-layer protocol architecture, illustrating the necessity of layering

"Layering" converts a large complex problem into several smaller local problems

  • Application layer: solve the problem of implementing specific network applications through the interaction of application processes

  • Network layer: problem solving network-based communication between processes

  • Transport layer: solves the problem of network- based communication between processes and provides end-to-end logical communication.

  • Network layer: solve the problem of packet transmission (routing) on ​​multiple networks , and provide logical communication between hosts.

  • Data Link Layer: Solve the problem of packet transmission on a network (or a link).

  • Physical layer: solves the problem of what signal to use to transmit bits .

Terminology in computer network architecture

  • Entity: any hardware or software process that can send or receive information

  • Peer Entity: An entity in the same hierarchy as the sending and receiving parties

  • Protocol : A collection of rules governing the logical communication between two peer entities

  • Three Elements of an Agreement

    • Syntax: Defines the format of the information exchanged

    • Semantics: Define the operations to be completed by both the sender and the sender

    • Synchronization: Define the timing relationship between the sender and receiver

  • Service: Under the control of the protocol, the logical communication between two peer entities enables this layer to provide services to the upper layer .

    • To implement the protocol of this layer, the services provided by the lower layer also need to be used.

    • Protocols are " horizontal ", services are " vertical ".

    • Entities can see the services provided by the adjacent lower layers, but do not know the specific protocol for implementing the services. That is, the protocol below is transparent to the entity above.

  • Service access : a logical interface for exchanging information between two adjacent entities in the same system , used to distinguish different service types.

  • Service primitives : - The upper layer must exchange some commands with the lower layer to use the services provided by the lower layer . These commands are called service primitives.

  • Protocol data unit PDU : The data packet transmitted between the peer layers is called the protocol data unit of this layer.

  • Service data unit SDU : In the same system, the data packets exchanged between layers are called service data units.

channel capacity limit

**Nay's Criterion:** Under assumed ideal conditions, in order to avoid intersymbol interference, the symbol transmission rate has an upper limit.

  • The highest symbol transmission rate of an ideal **low traffic channel (no upper and lower limits specified)** = 2W Baud = 2W symbols/second

  • The highest symbol transmission rate of the ideal band channel = W Baud = W symbols/second

  • Ideal low-pass channel : all low-frequency components of the signal, as long as their frequency does not exceed a certain upper limit, can pass through this channel without distortion, and all high-frequency components whose frequency exceeds the upper limit cannot pass through this channel.

Ideal band-pass channel : "Band-pass rectangle" only allows the signal frequency components between the upper and lower limits to pass without distortion , and other frequency components cannot pass through.

w: channel bandwidth (in Hz), Baud: baud, that is, symbols/second

Shannon's formula C = W ∗ log 2 ( 1 + S n ) C=W*log_2({1+\frac{S}{n}})C=Wlog2(1+nS)

The symbol transmission rate is also called the baud rate , modulation rate , waveform rate or symbol rate .

The relationship between symbol and bit rate

  • When 1 symbol carries only 1 bit of information, the baud rate (symbol/second) and the bit rate (bit/second) are numerically equal;
  • When 1 symbol carries n bits of information, when the baud rate is converted into a bit rate, the value must be multiplied by n.
  • Using multi-system: To increase the information transmission rate (bit rate), we must try to make each symbol carry more bits of information .

application layer

Domain Name System DNS (Domain Name System)

  • Domain Name System (DNS) is a naming system used by the Internet to convert hostnames with specific meanings that are easy for people to remember into IP addresses that are easy for machines to process.
  • The Internet adopts a hierarchical tree-like domain name structure...-third-level domain name. second-level domain name. top-level domain name
Three types of top-level domain name TLD (Top Level Domain)
  • National top-level domain nTLD Generic top-level domain gTLD Reverse domain arpa
  • The mapping relationship between domain names and IP addresses must be stored in the domain name server for all other applications to query. Obviously not all information can be stored in one name server.
  • DNS uses domain name servers distributed around the world to convert domain names to IP addresses.
Four Different Types of Name Servers
  • root name server
  • TLD server
  • Authoritative Name Servers
  • local name server
Two domain name resolution query methods
  • recursive query
  • iterative query
Nameservers and in-host caching
  • Improve DNS query efficiency, reduce the load on the root domain name server and reduce the number of DNS query messages on the Internet.
The DNS message is encapsulated using the UDP protocol of the transport layer, and the port number of the transport layer is 53

Replenish

Five types of status codes specified in the RFC standard

  • 1**: Prompt information, indicating that the current protocol processing is in the middle state, and the client needs to continue to operate
    • 101 Switching Protocols : The client uses the Upgrade header field and requests to change to other protocols on the basis of the HTTP protocol for communication . The server agrees to change the protocol to communicate and send 101 to the client
  • 2**: Success status, the message has been received and processed correctly
    • 200 OK : non-HEAD request, usually there will be body data in the response header

    • 204 No Content : Similar to 200, the difference is that there is no body data

    • 206 Partial Content : It is the basis of HTTP block download or resumable transmission. The data in the body is not the entire content of the resource, but only a part. The Content-Range in the header field indicates the specific range of the response message body data

  • 3**: Redirection, the requested resource is moved, and the client needs to resend the request
    • 301: Permanent Redirect

    • 302 Temporary Redirection -> Both will use the field Location in the response header to indicate the URI that needs to be redirected later

    • 304: cache redirect , redirect to cached data

  • 4**: The client is wrong, the message is wrong, and the server cannot handle it correctly

    400 Bad Request : General client error code

    403 Forbidden : Forbidden to access resources

    404 Not Found : Generally, the resource on the server has not been found

    405 Method Not Allowed : Some methods are not allowed to operate resources, such as POST can not be used only GET

    406 Not Acceptable : The resource cannot meet the client's request conditions

    408 Request Timeout

    409 Confict : multiple requests conflict

    413 Requset Entity Too Large : The body of the request message is too large

    414 Request-URI Too Long

    429 Too Many Request

    413 Request Header Fields Too large : A certain field or volume of the request header is too large

  • 5**: server error, an internal error occurred while processing the request

    500 Internal Server Error : General server error code

    501Not Implemented: The requested resource is not yet supported

    502 Bad GateWay : The error code returned by the gateway or proxy

    503 Service Unavailable: The server request is too busy and cannot respond temporarily. There is a Retry-After field in the response header, indicating how long the client can try again


To be continued~~~

Guess you like

Origin blog.csdn.net/qq_42829848/article/details/125325579