Computer Network Chapter 4 Chapter 5 Network Layer Knowledge Summary Review

Table of contents

Two services provided in the network layer

intermediate device

IP address

IP address representation method

Classification of IP addresses 

 Longest Network Prefix Matching Principle

IPV6 protocol

Interior Gateway Protocol RIP 

 network address translation

internet connection requirement

How NAT Routers Work 

Determine the next hop based on the routing table

IP Routing Protocol

How is the RIP routing table updated?

Judging classes A, B, C, and D based on IP addresses, and subnetting the addresses of classes A, B, C, and D

subnetting

For example: You are given a class B address, which is required to be divided into four identical subnets. Take the class B address 172.19.0.0/16 as an example.

NAT principle

NAT hides the role of internal network topology

When our internal host accesses Web services through NAT, how do the source and destination addresses of IP packets change between the internal network and the external network?

Determine the maximum address and minimum address in CIDR address

Chapter 5 Transport Layer

What is the main difference between flow control and congestion control? Does the send window size depend on flow control or congestion control?

TCP connection establishment process

 The difference between TCP/UDP

Four characteristics of the network layer interface

three exchange methods

The difference between the three exchange methods

data link layer

Ethernet switching table generation

ARP protocol

The data link layer solves three problems

HTTP non-persistent and persistent features

FTP two connections

 The principle of ping

Common Network Devices 

PPP protocol: zero bit stuffing method

 domain name, network address, IP address


Two services provided in the network layer

Datagram service and virtual circuit service.

The difference and comparison between the two services

Contrast virtual circuit service datagram service
train of thought Reliable communication should be guaranteed by the network Reliable communication should be guaranteed by the user host
connection establishment must have unnecessary
end address Used only during the connection establishment phase, each packet uses a short virtual circuit signal Each packet has the full address of the end point, which is the IP address
packet forwarding Packets belonging to the same virtual circuit are forwarded according to the same route Each group looks up the forwarding table independently for forwarding
when a node fails All virtual circuits that pass the fault are inoperable A failed node may lose packets and some routes may change
order of grouping Always reach the end in the order sent Reaching the destination is not necessarily in the order of sending
End-to-end error handling and flow control The postgraduate entrance examination is in charge of the network, and it can also be in charge of the user host by the user host

intermediate device

Four Intermediate Devices
Forwarder Intermediate devices used by the physical layer
bridge or bridge, switch Intermediate devices used by the data link layer
router The network layer uses the device
gateway Devices used above the network layer

IP address

IP address representation method

32-bit identifier, using the dotted decimal method can improve readability. The IP address is composed of two ends. The first segment is the network number, which marks the network connected to this interface. The second field is the host number , which identifies the host.

An IP address identifies a host connected to a network.

Classification of IP addresses 

Class A (n=8), Class B (n=16), and Class C (n=32) addresses are all unicast addresses (one-to-one communication), and class D is a multicast address , (one-to-many communication)

Type A: 8 digits for the network ID and 24 digits for the host ID. The host number occupies 3 bytes, and the hosts with all 0 and all 1 are not assigned. The IP address is the single network address to which "this host" is connected , for example (the host IP address is 5.6.7.8, then the network number of the host is 5, and the network address is 5.0.0.0) all 1 means that on the network All hosts. The maximum number of hosts on each class A network: 2 to the 24th power-2, or 16777214, the network number that can be assigned to class A: 2 to the 7th power-2, or 126

Type B: 16-bit network ID and 16-bit host ID. The network number field is 2 bytes. Number of available networks: 2 to the 14th power, or 16384. The maximum number of hosts on each network of a class B address: 2 to the 16th power-2, that is, 65534

Type C: 24 digits for the network ID and 8 digits for the host ID. The network number field occupies 3 bytes. The total number of assignable networks of Class C is 2 to the 21st power, that is, 2097152. The maximum number of hosts for each class C address is 2 to the 8th power-2, that is, 254 hosts.

The following summary can be seen  

IP datagram_Mr. Liang ✘'s blog-CSDN blog_ip datagram

 Longest Network Prefix Matching Principle

When CIDR addressing is used, if a packet can find multiple matching prefixes in the forwarding table, the one with the longest prefix is ​​selected as the matching prefix. (This principle is that the longest must be the best match, which is easy to understand)

IPV6 protocol

In order to solve the exhaustion of IP addresses, a new version of IP with a larger address space is adopted

see details

IPv6-Internet Protocol Version Six_Mr. Liang ✘'s Blog-CSDN Blog

Interior Gateway Protocol RIP 

RIP is the first widely used protocol in IGP.

see in detail

RIP protocol - summary of Internet routing protocol knowledge

 network address translation

internet connection requirement

Install NAT software on the router that connects the private network to the Internet. At least one valid external global IP address.

When all hosts using local addresses communicate with the outside world, the basic address must be converted into a global IP address on the NAT router in order to connect to the Internet.

How NAT Routers Work 

The NAT router receives the IP datagram sent from host A inside the private network to host B on the Internet ①: source address S = 192.168.0.3, and destination address D = 213.18.2.4. The NAT router converts the IP address 192.168.0.3 of the private network into the global IP address 172.38.1.5 through the internal NAT conversion table, rewrites it into the header of the datagram as the new source address, and then forwards the new datagram② go out. After host B receives the IP datagram ②, it sends back a response ③, the source address of the IP datagram sent by B is its own address: S = 13.18.2.4, and the destination address is the source address of the datagram just received, so now D = 172.38.1.5. Note that B does not know A's private address 192.168.0.3. In fact, even if you know it, you can't use it, because routers on the Internet cannot forward IP datagrams whose destination address is any private address. When the NAT router receives the IP datagram ③ from B, it needs to convert the IP address once. Through the NAT conversion table, the destination address D = 172.38.1.5 used by the received IP datagram is converted to the destination address D=192.168.0.3 inside the private network (that is, the real local IP address of host A), and it becomes a datagram ④, and then sent to A. 

 remember

        Communication through a NAT router must be initiated by a host within the private network

        The host inside the private network cannot directly act as a server

Determine the next hop based on the routing table

two types

The first type: destination address, subnet mask, next hop

Second middle: network prefix, next hop

When the first method is used to find the next hop, the destination address and the subnet mask are "ANDed" to get the matching next hop.

In the second method, when finding the next hop, all of them are converted into binary, and the next hop is judged according to the longest matching criterion of the network prefix .

IP Routing Protocol

How is the RIP routing table updated?

Example: Suppose there is a routing table B with known routing information: destination network, distance, next hop.

destination network distance Next hop
N1 7 A
N2 2 C
N6 8 F
N8 4 E
N9 4 F

Now receive the routing information from C

destination network distance

N2

4
N3 8
N6 4
N8 3

N9

5

Calculation steps: Add 1 to the distance in the routing protocol received by B (sent from C, the next hop in the routing information is of course C), compare and update with the routing information in B.

updated routing table

destination network distance Next hop Change situation
N1 7 A no information, unchanged
N2 5 C Same next hop, updated distance
N3 9 C Newly added routing information
N6 5 F Different next hop, shorter distance, updated distance
N8 4 E Different next hops, same distance, no update
N9 4 F Different next hop, larger distance, no update

Judging classes A, B, C, and D based on IP addresses, and subnetting the addresses of classes A, B, C, and D

Categories In the summary above, categories address

Class A address: 1.0.0.0~126.255.255.255

Class B address: 128.0.0.0~191.255.255.255

Class C address: 192.0.0.0~223.255.255.255

Class D address: 224.0.0.0~239.255.255.255

subnetting

Subnet mask of class A address: 255.0.0.0

Subnet mask of class B address: 255.255.0.0

Subnet mask of class C address: 255.255.255.0

Subnet mask of class D address: multicast address

For example: You are given a class B address, which is required to be divided into four identical subnets. Take the class B address 172.19.0.0/16 as an example.

To divide the network into 4 subnets, first apply the subnet calculation formula: the number of subnets=2 to the nth power, that is, 4=2 to the nth power, and n is 2.

n is 2, that is, it is necessary to borrow 2 bits from the host bit to divide the subnet, and there are 6+8=14 bits left in the host bit.

The machine position can know that the number of bits of the network mask is 32-14=18 bits, that is, the subnet mask is 255.255.192.0

每个子网的地址块为256-192=64

所以,每个子网的的地址分别为172.19.0.0/18,172.19.64.0/18,172.19.128.0/18,172.19.192.0/18

等分子网数=2的N次方,其中N是需要划分的子网位位数。

4=2的2次方,所以需要划分为2位子网位。

B类网络16位网络位、16位主机位,划分2位子网位后的子网18位网络位、14位主机位。
四个子网地址分别是前16位不变,第17和18位分别为:00,01,10,11的四个子网。

简单明了。

NAT原理

当私有网主机和公共网主机通信的IP包经过NAT网关时,将IP包中的源IP或目的IP在私有IP和NAT的公共IP之间进行转换。

NAT是解决IP地址不足的关键技术

NAT隐藏内部网络拓扑结构作用

在防火墙上实现NAT后,可以 隐藏受保护网络的内部拓扑结构 ,在一定程度上提高网络的安全性。 

当我们内部主机通过NAT访问Web服务,IP分组源地址和目的地址在内网和外网之间如何变化?

源地址:一个私网的源地址转换为一个公网的地址。

主要还是看那个NAT原理图

判断CIDR地址中最大地址和最小地址

例如:192.168.0.1/24

IP地址192.168.0.1的二进制表示法是:
11000000 10101000 00000000 00000001

前24位是网络前缀,后8位是主机地址,令主机地址分别为全0和全1就可以得到一个CIDR地址块的最小地址和最大地址。

即:
最小地址:11000000 10101000 00000000 00000000 = 192.168.0.0
最大地址:11000000 10101000 00000000 11111111 = 192.168.0.255
令网络前缀全1,主机地址全0,就可以得到子网掩码:
子网掩码:11111111 11111111 11111111 00000000 = 255.255.255.0

第五章运输层

拥塞控制和流量控制

拥塞控制:是作用于网络的,它是防止过多的数据注入到网络中,避免出现网络负载过大的情况常用的方法就是:( 1 )慢开始、拥塞避免( 2 )快重传、快恢复。

流量控制:流量控制是作用于接收者的,它是控制发送者的发送速度从而使接收者来得及接收,防止分组丢失的。

流量控制和拥塞控制的主要区别是什么?发送窗口的大小取决于流量控制还是拥塞控制?

拥塞控制作用于网络,它是防止过多的数据注入网络中,避免出现负载过大的情况。

流量控制作用于接收者,控制发送者的发送速度从而使接收者来得及接收,防止组丢失。

区别:1、流量控制解决的是发送方和接收方速率不匹配的问题;控制解决的是避免网络资源被耗尽的问题。 2、流量控制是通过滑动窗口来实现的;控制是通过拥塞窗口来实现的

发送窗口的上限值是 Min [rwnd, cwnd],接收窗口的大小体现了接收端对发送端施加的流量控制,而拥塞窗口的大小则是整个互联网的负载情况对发送端施加的拥塞控制。因此,当接收窗口小于拥塞窗口时,发送窗口的大小取决于流量控制,即取决于接收端的接收能力。但当拥塞窗口小于接收窗口时,则发送窗口的大小取决于拥塞控制,即取决于整个网络的拥塞状况。

TCP连接建立过程

连接建立过程叫做握手。.

三报文握手建立TCP连接过程:

1、服务器进程先创建传输控制块TCB,并处于监听状态;2、客户端创建传输控制块TCB,并向服务器发出连接请求报文段;3、客户端进程收到服务器的确认报文段后,立即回复确认报文段;4、进入已建立连接状态。

 TCP/UDP的区别

在连接上:1、TCP提供的是面向连接的、可靠的数据流传输;UDP提供的是非面向连接的、不可靠的数据流传输。 2、TCP提供可靠的服务,通过TCP连接传送的数据,无差错、不丢失、不重复,按序到达;UDP尽最大努力交付,即不保证可靠交付。

 在结构程序方面:TCP的结构较为复杂,而UDP结构较为简单。

在通信上:每一条TCP连接只能是点到点的;UDP支持一对一,一对多,多对一和多对多的交互通信

网络层接口四个特性

机械特性: 指明接口所用接线器的形状和尺寸、引脚数目和排列、固定和锁定装置等。
电气特性: 指明在接口电缆的各条线上出现的电压范围。
功能特性: 指明某条线上出现某一电平的电压意义。
过程特性: 指明对于不同功能的各种可能事件的出现顺序。

三种交换方式

电路交换:整个报文的比特流连续地从源点直达终点,好像在一个管道中传送。

报文交换:整个报文先传送到相邻节点,全部存储下来后查找转发表,转发到下一个结点。

分组交换:单个分组(这只是报文的一部分)传送到相邻结点,存储下来后查找转发表,转发到下一结点。

三种交换方式区别

 电路交换直接一次传输全部数据,报文交换以报文作为传送单元,分组交换以更小的分组作为传送单元。

数据链路层

CRC循环冗余校验

根据多项式判断传输过程是否出错

 任意一个由二进制位串组成的代码都可以和一个系数仅为‘0’和‘1’取值的多项式一一对应。例如:代码1010111对应的多项式为x6+x4+x2+x+1,而多项式为x5+x3+x2+x+1对应的代码101111。

下面是一个根据一个给定的生成多项式求CRC码的例子

假设使用的生成多项式是G(X)=X3+X+1。4位的原始报文为1010,求编码后的报文。
解:
1、将生成多项式G(X)=X3+X+1转换成对应的二进制除数1011。
2、此题生成多项式有4位(R+1)(注意:4位的生成多项式计算所得的校验码为3位,R为校验码位数),要把原始报文C(X)左移3(R)位变成1010 000
3、用生成多项式对应的二进制数对左移3位后的原始报文进行模2除(高位对齐),相当于按位异或 得到的余位011,所以最终编码为:1010 011

 

以太网交换表生成

动作 交换表的状态 向哪些接口转发帧 说明
A发送帧给D 写入(A, 1) 所有接口 发送之前为空表,发送之后存入A接口在1
D发送帧给A 写入(D, 4) A接口 之前有A的信息,发送之后存入D接口在4
E发送帧给A 写入(E, 5) A接口 之前有A的信息,发送之后存入E接口在5
A发送帧给E 不变 E接口 之前有E的信息和A的信息

ARP协议

地址解析协议,

数据链路层解决三个问题

 封装成帧、透明传输、差错检测

⑴封装成帧就是在一段数据前后分别添加首部和尾部。接收端以便从收到的比特流中识别帧的开始与结束,帧定界是分组交换的必然要求;

⑵ 透明传输避免消息符号与帧定界符号相混淆;

⑶差错检测防止差错的无效数据帧,浪费网络资源。

HTTP非持续和持续特点

非持续连接 :限制每次连接只处理一个请求,服务器处理完客户的请求,并收到客户的应答后,即断开连接

持续连接 :不必为每个web对象创建一个新的连接,一个连接可以传送多个对象,采用这种方式可以节省传输时间。

FTP两个连接

1. 控制连接

客户端希望与FTP服务器建立上传下载的数据传输时,它首先向服务器的TCP 21端口发起一个建立连接的请求,FTP服务器接受来自客户端的请求,完成连接的建立过程,这样的连接就称为FTP控制连接。

2. 数据连接

FTP控制连接建立之后,即可开始传输文件,传输文件的连接称为FTP数据连接。FTP数据连接就是FTP传输数据的过程,它有两种传输模式

FTP两个连接作用是:上传和下载。

客户端首先连接到FTP服务器的21端口,进行用户的认证,认证成功后,当我们要传输文件时,服务器会开一个端口为20来进行传输数据文件。

FTP允许用户以文件操作的方式(如文件的增、删、改、查、传送等)与另一主机相互通信。

然而, 用户并不真正登录到自己想要存取的计算机上面而成为完全用户, 可用FTP程序访问远程资源, 实现用户往返传输文件、目录管理以及访问电子邮件等等, 即使双方计算机可能配有不同的操作系统和文件存储方式。

 ping的原理

ping 程序是用来探测主机到主机之间是否可通信,如果不能ping到某台主机,表明不能和这台主机建立连接。

 Ping  uses the ICMP protocol, which sends an icmp echo request message to the destination host. The ICMP protocol stipulates that the destination host must return an ICMP Echo Reply message to the source host. If the source host receives a reply within a certain period of time, the host is considered reachable.  

Common Network Devices 

Physical layer: repeaters, hubs

Repeater: The main function is to reshape and amplify the signal and then forward it to eliminate the distortion and attenuation caused by noise or other reasons after the signal passes through a long section of cable, so that the waveform and strength of the signal meet the required requirements. And then expand the distance of network transmission.

Hub: Hub (Hub) is essentially a multi-port repeater

Data Link Layer: Bridge

Bridge: A bridge is a bridge that establishes a connection between a local area network and another local area network.

Network Layer: Router

Router: A router is a special-purpose computer with multiple input/output ports , and its task is to connect different networks ( connect heterogeneous networks ) and complete routing and forwarding. A router must be used when multiple logical networks (that is, multiple broadcast domains ) are interconnected.

PPP protocol: zero bit stuffing method

Colon hexadecimal notation can allow zero compression, that is, a series of consecutive zeros can be replaced by a pair of colons. In addition, in order to ensure that zero compression has an unambiguous interpretation, it is stipulated that zero compression can only be used once in any address.

0:0:0:0:0:0:128.10.2.1

Zero compression:

::128.10.2.1

 domain name, network address, IP address

The IP address is your host's address on the network

A network address (it is more accurate to call it a network segment address, but it is generally called a network address) is a collection of IP

Domain Name: The name of the website

Guess you like

Origin blog.csdn.net/qq_61897141/article/details/128674454