The purpose of this article is to summarize what I think is important and can be remembered as common sense in personal learning, plus some personal understanding. In addition, such as transmission layer, link layer each protocol frame structure is important content, but because of its bad memory will not be summarized here, specific or read a book ~

Main performance indicators of computer network

bandwidth

The band range of signals allowed to pass through a communication line, in Hertz (Hz), also indicating the capacity of a network communication line to transmit data, synonymous with “maximum data transmission rate,” in bits per second (b/s)

Time delay

The total time required for data to be transmitted from one end of the network to the other, which consists of four parts: transmission delay, propagation delay, processing delay and queuing delay.

Send time delay

The time it takes a node to push all the bits of the packet to the link, also known as transmission delay. Send delay = Packet length/bandwidth

Propagation delay

It takes time for bits to propagate in the form of electromagnetic waves in a link. Propagation delay = channel length/propagation rate of electromagnetic wave in the channel (light speed)

To deal with time delay

The amount of time necessary for data to be processed at switching nodes for storage and forwarding. For example, analyze the packet head, extract data from the packet, check errors, and find routes.

Queuing delay

Queue delay of the input queue and output queue after the packet enters the router

To sum up, total delay = transmission delay + propagation delay + processing delay + queuing delay

Delay-bandwidth product

The number of bits sent by the sender when the first bit sent by the sender is about to reach the end, also known as the length of the link in bits. Latency bandwidth product = propagation latency * bandwidth

Round-trip Time (RTT)

The total delay from the time when the sender sends data to the time when the sender receives the acknowledgement from the receiver. Round-trip delay includes processing delay, queuing delay, transmission delay and propagation delay.

Channel utilization

The percentage of time a channel is filled with data. Channel utilization = time when data is filled/(time when data is filled + no time when data is filled.

The physical layer of computer networks

element

A fixed-time signal waveform is used to represent a k-base digit, such as a 2-base digit with only 0 and 1 states.

Baud

Symbol transmission rate (baud rate), number of signal changes per unit time (number of symbols transmitted per unit time)

Nyquist’s theorem

The signal attenuation in the transmission process causes the signal waveform received by the receiver to lose the clear boundary between the symbols, which is called inter-symbol crosstalk. In other words, the higher the frequency, the more blurred the boundary between the symbols if attenuation occurs, and the frequency (symbol transmission rate) of the signal is finite. In an ideal low-pass (no noise, limited bandwidth, and true passage) channel, the limiting symbol transmission rate is 2W baud, and W is the channel bandwidth, in order to avoid cross-talk between symbols. Its toppling process has exceeded the class, belongs to the communication category, need not tangle.

Limit transmission rate =2Wlog2V (unit: b/s), where V represents the number of discrete levels of symbols. For example, four binary bits represent one symbol, so V=16

Shannon’s theorem

Shannon theorem gives the relationship between channel limit transmission rate, signal-to-noise ratio (average power/noise power of transmitted signal) and bandwidth.

Limit transmission rate =Wlog2(1+S/N), where S is the average power of the transmitted signal and N is the noise power of the channel.

Personal summary: If a symbol has more binary bits, its channel transmission power will be lower, and then the transmission rate will be lower. So Shannon’s theorem states that the number of binary digits corresponding to a code element is finite.

Encoding and modulation

The process of converting data into analog signals is called modulation, and the process of converting data into digital signals is called encoding.

Personal summary: Analog signal is continuous, such as waveform, suitable for long-distance transmission, such as long-distance transmission signal attenuation, interference, can be regenerated and restored through physical layer equipment amplifier, repeater. But the digital signal is discrete [0,1,0,1], if there is interference or attenuation, it cannot be repaired. So long-distance transmission requires a modem, to carry out digital/analog signal conversion.

Digital data is encoded into digital signals

Personal Summary: Only know Manchester coding/differential Manchester coding, bit in the middle of the jump can be used as the clock signal (clock signals according to jump can define the start-stop, non zero coding, for example, if no synchronous clock, when there is a multiple of 1 or 0 signal, unable to distinguish and how many 1 s and 0 s, so I need additional synchronization clock), and as the data signal, But it takes up twice as much bandwidth as the original baseband. Ethernet uses Manchester encoding.

Baseband transmission, band transmission and broadband transmission

Baseband transmission

Close transmission within a computer or between adjacent devices, which can be transmitted directly over a channel without modulation, often used in a local area network. The entire bandwidth of the transmission media is occupied by baseband signals, which transmit information in both directions. Commonly used non-return to zero coding and Manchester coding. Binary numbers are represented by high and low levels, such as 1010, where low represents 0 and high represents 1.

Band transmission

Modulation of baseband signals, suitable for long distance transmission by means of symbols.

Broadband transmission

With the help of frequency band transmission, link capacity can be decomposed into multiple channels, such as frequency division multiplexing to send signals with complementary interference.

Physical layer device

repeater

The result is to shape the signal, amplify it and forward it to eliminate distortion and attenuation caused by transmission. The repeater has two ports, input and output. The principle is regeneration of the signal rather than simply amplifying the decaying signal.

A hub

A Hub is essentially a multi-port repeater that forwards signals to all other ports in addition to signal regeneration, extending the range of network transmission.

The data link layer of a computer network

Link Layer function

  • Frame demarcation, frame synchronization and transparent transmission.
  • Flow control, reliable transfer, and sliding window mechanism (optional)
  • Error control
  • Media access control

framing

The sender encapsulates the packets submitted by the network layer into frames, which mainly solve the problems of frame definition, frame synchronization and transparent transmission

Delimited notation for character filling

Delimit the start and end of a frame with special characters, and if there are special characters in the data content, the escape character is preceded. The receiver deletes the first escape character.

Zero-bit filling head and tail marking method

01111110 is used to mark the beginning and end of the frame. For every 5 consecutive “1s” encountered in the data content, a “0” is automatically inserted after the data content. The reverse operation of the receiver is that every 5 consecutive “1s” received, the following “1” is automatically deleted. The zero-bit fill method is easily implemented by hardware and performs better than the character fill method.

Character counting/illegal coding

Not important, skip

Error control

Parity check code/cyclic redundancy code/Hamming code

Flow control and reliable transmission mechanism

The OSI view of the past was that the data link layer must provide reliable transport up, and this approach has worked well in history. But now the quality of communication lines is improved, and the probability of errors caused by poor communication link quality is greatly reduced. Therefore, it is now treated differently:

For wired transmission link with good communication quality, reliable transmission service is provided by transport layer.

For the wireless transmission link with poor communication quality, the data link layer provides reliable transmission service.

Here, the reliable transport mechanism is only placed in the link layer. The reliable transport service of the transport layer is based on the same principle. There is no need to worry about which layer the reliable transport service is placed in.

Reliable transmission mechanism is mainly divided into three protocols:

  • Single frame sliding window-stop protocol
  • Multiframe Sliding Window-Back N-frame Protocol (GBN)
  • Multi-frame sliding Window – Select Retransmission Protocol (SR)

The size of the sending window and the receiving window are different in these three protocols

  • Stop wait protocol, send window =1; Receive window =1
  • Back N frame protocol, send window = N; Receive window =1
  • Select retransmission protocol, send window =n; Receiving window =n

Here is an example of choosing a retransmission protocol. The other two protocols are understood

Medium Access Control (MAC)

It mainly solves the multi-point sharing a channel under the premise of non-interference, which is mainly divided into two categories

  • Static division channel, this understanding can be
  • Dynamic media Access control, also known as Multiple Access control (Multiple Access control), random media Access control. The CSMA/CD protocol is important.

Statically divided channel

  • Frequency Division Multiplexing (FDM)
  • Time division multiplexing (TDM, Time..)
  • Wavelength division multiplexing (WDM, Wavelength..)
  • Code division multiplexing (CDM, Code..)

Wavelength division multiplexing and code division multiplexing Wavelength division multiplexing is the frequency division multiplexing of light. The frequency and wavelength of visible light are the only mapping relationship. The multiplexing of different wavelengths of visible light is actually the multiplexing of light at different frequencies.

The more common ranking for Code Division Multiple Access (CDMA) is that each site is assigned a sequence of chips (such as 00011011), and sending 1 is mapped to 00011011 and 0 to its inverse Code 11100100. Its specific principle involves linear algebra knowledge, here know a general meaning, understand can.

Dynamic media access control

Multiple users on the channel send information randomly according to their own wishes. If multiple users send information at the same time, a collision will be sent. At this time, the message fails to be sent again according to certain rules until the message is successfully sent. Common protocols include ALOHA, CSMA, CSMA/CD, and CSMA/CA. The emphasis is on the CSMA/CD protocol. Their core idea is: contention channel, get the right to send information, so it is also called contention protocol.

ALOHA protocol (uh-huh)

The Additive Link online HAwaii System stands for Additive Link online HAwaii System and ALOHA is also the local dialect for hello.

The idea is that each site is free to send data, and if the data is sent successfully, it will receive confirmation, otherwise, the task will be sent conflict, and it needs to wait a random time to send again, until the data is sent successfully.

It can be seen that the pure ALOHA network throughput is very low, so people improve the original ALOHA protocol and produce the slotted ALOHA protocol. The ALOHA protocol synchronizes all sites in time and divides them into equal time slots. Specifies that only one frame can be sent at the beginning of each time slot. Thus avoiding the randomness of sending data and reducing the possibility of conflict.

Carrier Sense Multiple Access (CSMA)

Carrier Sense multiple access protocol (CSMA), which listens for idle channels before transmitting. There is no such thing as a “carrier” on the bus, just a borrowed word. There are three types of CSMA protocols

Channel state 1 – stick to Not insist on P – stick to
free Send data now Send data now Probability P sends data, otherwise deferred to the next time slot
busy Keep listening Abandon listening and wait for a random amount of time to listen again Keep listening

Even with channel interception, conflicts can occur because channels have propagation delays. For example, node A sends data at A certain time, at this time the signal has not reached B, B that is, to listen to the channel idle, also sends data in the opposite direction, so in the process of transmission conflict, and data is still sending, at this time bandwidth is wasted, so there is CSMA/CD protocol.

CSMA/CD (Carrier Sense Multiple Access with Collision Detection)

Carrier Sense Multiple Access/Collision detection protocol. The idea of CSMA/CD is “listen before you send, listen while you act, stop the conflict and resend randomly”. Its random retransmission mechanism uses binary exponential backout algorithm.

The protocol mechanism is as follows:

  1. The adapter (nic) takes a packet from the network layer, encapsulates it into an Ethernet frame, puts it in the adapter cache, and is ready to send. The cache is used to resend in case of conflicts or failures.
  2. If the adapter listens until the channel is free, it sends frames, otherwise it keeps listening.
  3. During transmission, the adapter continuously detects the channel, and if it finds a conflict, it aborts the data transmission and sends a congestion signal, amplifying the conflict until all users have.
  4. After the transmission is aborted, the adapter executes the exponential backoff algorithm and returns to Step 2.

Collision detection mechanism, refer to the illustration below.

CSMA/CA (Carrier Sense Multiple Access with Collision Avoid)

Collision avoidance. It is difficult to implement collision detection in infinite networks, and there are hidden station problems, so avoid algorithm is used. Its mechanism is to monitor the channel. If it is idle, the broadcast will inform other nodes not to send data at a certain time point, that is, to reserve the channel, so as to achieve collision avoidance.

Polling Access Media Control: token passing protocol

Contents of the agreement, such as the name of the agreement, can be agreed. Not very important.

Data link layer protocol for wide area networks

  • PPP and HDLC

PPP guarantees only error-free frames, but not reliable transmission (HDLC is). The cost of reliable transmission increases, and data frames may be discarded due to network congestion after ascending to the network layer. Therefore, reliable transmission at the data link layer does not guarantee reliable transmission at the network layer. Understand.

Data link layer device

Bridges: devices that interconnect extended networks, filter frames, store and forward frames, and isolate conflicting domains, but not broadcast domains.

Switch, a multi-port bridge.

The network layer of a computer network

Network Layer Functions

  • Heterogeneous network interconnection. When the physical layer or link layer relay system (repeater, hub, bridge, switch) is used, a network is only expanded, from the perspective of the network layer is still a network, generally not called network interconnection.
  • Routing and Forwarding
  • Congestion control

IP packet

At the data link layer, there is a MTU. For example, the MTU of Ethernet is 1500B, and the MTU of many wide area networks is less than 576B. When the total length of IP packets is larger than the MTU, IP packets are fragmented or grouped.

IPv4 address

Each host or router connected to the Internet is assigned a 32-bit globally unique identifier. It is divided into five categories: A, B, C, D and E.

An IPv4 address consists of a network number and a host number, that is, IP address ={< network number >,< host number >}.

The IP addresses are as follows

IP addresses have the following important characteristics

  1. Each IP address is composed of network number and host number, which is a hierarchical address structure. Its advantage is: 1 ️IP address management organization only distributes network number when allocating addresses, while host number is distributed by units under the network, which facilitates IP address management; 2 ️ router only forwards packets according to the network number connected to the host, thus reducing the storage space occupied by routing table.
  2. An IP address identifies the interface between a host or router and a link. Routers have multiple IP addresses, one for each port
  3. The LAN connected to the switch is still the same network, so the network numbers of all the host IP addresses on the LAN are the same.

Network address translation NAT

Translates a private network address into a public network address, hiding the IP address managed internally. It makes the entire private network need only one global IP address to connect to the Internet, so that the PRIVATE network IP address can be reused, so NAT greatly saves the CONSUMPTION of IP addresses, and it hides the internal network structure, so as to reduce the risk of internal network attack.

Therefore, except for private IP addresses, private IP addresses cannot be directly used on the Internet. NAT is used to translate private IP addresses into public IP addresses and allow private IP addresses to be reused by the LAN, effectively solving the problem of insufficient IP addresses. Private IP addresses are also known as reusable addresses.

The private IP address segments are as follows: Class A: 1 Class A network segment 10.0.0.0 to 10.255.255.255 Class B: 16 Class B network segments 172.16.0.0 to 172.31.255.255 Class C: 256 class C network segments, 192.168.0.0 to 192.168.255.255 Are these network segments familiar? In a school computer room or lab.

A common router does not change its IP address when forwarding IP packets. However, a NAT router changes its IP address and involves a transport layer port number.

Subnets and subnet masks

The two-tier IP address space has low utilization and is not flexible. Subnet division is purely an internal matter of an organization. Subnet division is only a subdivision of the host number. The subnet mask consists of a series of 1s followed by a series of 0s.

IP address = {< network number >,< subnet number >,< host number >}

e.g.

To divide a network into six subnets, the following uses Class C addresses as an example

Subnet mask for 11111111.11111111.11111111.11100000 (255.255.255.224), 111 were divided into 8 subnets, only six of these subnets

CIDR (Classless Inter Domain Routing)

Classless interzone routing is a more efficient way to allocate IP addresses. Different from class A, B, and C networks and subnets, the classless two-level addressing of IP addresses is {< network prefix >,< host number >}. For example, if a unit needs 2000 addresses, it is allocated a block of 2048 addresses with 11 host numbers and 21 network prefixes. CIDR slash notation: 128.14.23.5/21

PS: There is no difference between subnet mask and subnet mask except the concept and writing method.

To sum up, the solutions to IPv4 address insufficiency are as follows

  1. NAT
  2. Subnet mask
  3. CIDR
  4. IPv6 (root of the problem)

Address Resolution Protocol (ARP)

No matter what protocol is used for the network layer, when sending data frames on the actual network link, finally must use hardware address (MAC address), so you need a way to complete the IP addresses to MAC address mapping, each host is equipped with a dynamic maintenance of ARP cache, each host, routers store LAN IP address to MAC address mapping. If the ARP cache does not exist, the device broadcasts an ARP request to obtain the destination MAC address.

There used to be a RARP protocol, but it is now obsolete.

Dynamic Host Configuration Protocol (DHCP)

A plug and play networking mechanism that allows a computer to join a new network and obtain an IP address without having to manually assign IP addresses to hosts.

DHCP principle: The host that requires an IP address broadcasts a packet to the DHCP server, and only the DHCP server responds to the packet. The DHCP server now looks for the computer’s configuration information in its database and returns it if it finds it, otherwise it takes an address from the server’s IP address pool and assigns it to the computer.

DHCP is an application-layer protocol based on UDP. The IP addresses assigned to DHCP are temporary and the lease period is determined by the DHCP server.

Internet Control Message Protocol (ICMP)

The network layer uses ICMP to make hosts or routers report errors and exceptions. It is divided into two types of message, error report message and inquiry message. Such as

  1. The destination is unreachable. Datagrams cannot be delivered
  2. Source point suppression. The router or host is congested and discarded datagrams
  3. Time out. After receiving the TTL=0 packet, the router discards the packet and sends a timeout packet to the source
  4. Parameter problem. The packet header is incorrect
  5. Change the routing

There are also ICMP query messages, such as two common commands

  1. Ping command, traceroute command

IPv6

The 32-bit version of Ipv4 increases to 128-bit, 16B. Solve the PROBLEM of IP address exhaustion fundamentally.

Routing protocol

Routing protocols fall into two categories

  1. Interior Gateway Protocol (IGP)
  2. External Gateway Protocol (EGP)

The internal gateway protocol is a routing protocol, such as RIP and OSPF, used in an autonomous system (an administrative unit, such as a company or a university).

The external gateway protocol is a routing protocol between autonomous systems, such as BGP-4

Routing Information Protocol (RIP)

The working principle is as follows: At first, each router only knows the route of the node connected to it. Every 30 seconds, two neighboring routers send their routing tables to each other. After the first RIP broadcast, each router knows its own routing table with a hop count of 1. For the second RIP broadcast, each router knows the route whose hop count is 2. And so on, eventually converging until all routers know the entire AUTONOMOUS system routing table.

Compared with the current routing table, the route A sent by the neighboring router has A hop count of +1. If it does not exist, the route is written to. If there is A route with A small hop count, the route in the routing table has the path with the smallest hop count, but it is not necessarily the path with the shortest time. RIP is an application-layer protocol that uses UDP to transmit data.

Open Shortest Path First (OSPF)

Open indicates that OSPF is not controlled by a vendor. SPF is the shortest path algorithm proposed by Dijkstra.

Characteristics and Mechanism

  • With whom? Each router uses the flooding method to send information to all routers in the AUTONOMOUS system
  • Send what? Link state refers to the metric/cost (distance, delay, etc.) of the neighboring routers and their links.
  • How long? The link status changes

Thus, after a series of packet switching, each router creates a synchronous link database for the whole network. Each router can use Dijkstra to construct a routing table based on the link database

Border Gateway Protocol (BGP)

  • With whom? The BGP spokesperson (the router that interacts with the external network) is exchanged with other neighboring ass
  • In exchange for what? Due to the large scale of the Internet, it is difficult to obtain the optimal route. Therefore, only the reachability information is exchanged, that is, the AS that a network must pass through to reach it
  • How long? Update the changing parts as they change

You can read it here

Multicast (multicast)

To send a packet to multiple destination hosts, the source host does not send a packet to each destination host, or the source host sends a packet to a multicast address, and the group sends a copy of the packet to each host in the group. Multicast is only applicable to UDP scenarios, such as video conferences and live broadcasts. In IPv4, multicast addresses are assigned in the Class D address space. To understand, details can be read.

Mobile IP

Designed to keep the connectivity of nodes in motion. Mobile nodes use fixed IP addresses to realize roaming across different network segments and ensure that the network permissions are not changed during roaming. To understand, details can be read.

Network layer device

A router is a computer with multiple input and output ports, whose task is to select routes and forward packets

Routing table based on routing algorithm, always use software to achieve. Includes the destination IP address, subnet mask, next-hop IP address, and router interface.

The forwarding table is derived from the routing table and can be implemented by software and hardware. The forwarding table contains the MAC address.

The transport layer of a computer network

TCP

TCP three-way handshakeA sends A connection request packet to B, B receives the request and knows that A can send data, B sends an acknowledgement packet to A, A receives the acknowledgement packet and knows that B can receive data and send data, and THEN sends an acknowledgement packet to B, B receives the acknowledgement packet and knows that A can receive data. Therefore, The three-way handshake confirms that A and B can both receive and send data

TCP waved four timesFinally, after the client sends the confirmation message, it takes 2 MSL (maximum packet segment life) to enter the closed state, because the client may lose the confirmation message segment. If the server does not receive the confirmation request, it will continue to send the connection release message segment to the client and cannot enter the closed state. Therefore, waiting for two MSLS can ensure that if the confirmation message is lost, the server can receive the request to release the connection again.

UDP

UDP adds only two basic services on top of IP datagram services: reuse and error detection

Multiplexing: All application processes can be transmitted through the transport layer to the network layer.

Reuse: The transport layer receives data from the network layer and delivers it to a specified application process.

Reuse/reuse is the basic function of the transport layer. The header format contains the port number to find the corresponding application process.

Application layer of computer network

DNS Resolution Process

It will be as followsIs given priority to with iterative query, namely query first local domain name server, local domain name server requests root name servers, root name servers will top-level domain name server address returns to the local domain name server, local domain name server request top-level domain the server again, top-level domain name server permissions to the domain name server address returns to the local domain name server, The local DNS server requests permission (authority) from the DNS server.

However, caching is widely used in domain name servers.

Keep Alive and not Keep Alive

Previous VERSIONS of HTTP use non-persistent connections by default. If you want to maintain persistent connections over older versions of HTTP, you need to specify keep-alive as the header field of connection. For each of these connections, the client and server allocate TCP buffers and variables (such as retransmission of failed segments and caching of sent segments).

Persistent connections are used by default in HTTP/1.1. When a TCP connection sends the last HTTP response, it holds keepalive_timeout seconds before closing the connection.

GET request length limit

It is the browser that limits the length of GET requests.

Internet explorer limits the URL to a maximum of 2000 characters, about 2KB.

FireFox limits the URL length to 65536 characters.

Chrome limits urls to a maximum length of 8182 characters.

Of course, the server also affects the maximum URL length limit

reference

[1] Xie Xiren, Computer Network

[2] Wang Dao Postgraduate Entrance Examination Review Guide

[3]LeetBook