Computer network: network layer (virtual circuit service, datagram service, interconnection network and virtual interconnection network, IP protocol, the role of subnet mask)

Two services provided by the network layer

The network layer is concerned with how to deliver packets from the source to the destination along the network path.
In the field of computer networks, what kind of service the network layer should provide to the transport layer ("connection-oriented" or "connectionless") has caused long-term problems. debate.
The essence of the dispute is: Who is responsible for reliable delivery in computer communication? Whether it is the network or the end system (now the end system) is
just like the current express service. If it is a direct transaction between two people, it can ensure the correct exchange of items, but if it is like express delivery, the customer and the merchant only deliver goods. And receiving the goods, what about the problems that occur during the transmission of the goods? If the network provides reliable delivery, then every express delivery site must check whether there is no problem with the express. This is undoubtedly very inefficient. Therefore, the end system provides reliable delivery. The default transmission of the express station is no problem. After the customer, let the customer see if there are any problems, and if there is any problem, let the merchant re-send it and express it again

Two kinds of services: what kind of service the network layer should provide to the transport layer

Virtual circuit service

The virtual circuit means that this is only a logical connection, and packets are transmitted along this logical connection in accordance with the datagram operation mode, instead of actually establishing a physical connection.
Note that circuit-switched telephone communication first establishes a real connection. Therefore, the virtual connection of packet switching and the connection of circuit switching are just similar, but not exactly the same.
Insert picture description here
All the packets sent by H1 to H2 are transmitted along the same virtual circuit. If this line is disconnected, then H1 and H2 will be blocked.

Datagram service

The network layer only provides simple, flexible, connectionless, and best-effort datagram services. The
network does not need to establish a connection first when sending packets. Each packet (ie IP datagram) is sent independently, regardless of the packets before and after it (no numbering).
The network layer does not provide a promise of quality of service. That is, the transmitted packets may be wrong, lost, repeated, and out of sequence (reaching the end point out of order), and of course, the time limit for packet transmission is not guaranteed.

Best efforts to deliver the benefits:
"Because the transmission network does not provide end-to-end reliable transmission services, this allows the routers in the network to be simpler and cheaper (compared to the switches of the telecommunication network).
If the host (ie The communication between the processes in the end system needs to be reliable, then the transport layer in the host of the network is responsible (including error handling, flow control, etc.).
The advantage of adopting this design idea is: the cost of the network is greatly reduced , The operation mode is flexible and can adapt to a variety of applications. The
Internet can develop to today’s scale, which fully proves the correctness of this design idea.
Insert picture description here
The packets sent by H1 to H2 may be transmitted along different paths, even if there is one The route is disconnected, then the data packet will be transmitted through other routes, and the two hosts will not be unable to connect
Insert picture description here

Internet Protocol IP

Virtual internet

Network interconnected equipment

The intermediate device is also called an intermediate system or a relay system.
Physical layer relay system: repeater.
Data link layer relay system: network bridge or bridge.
Network layer relay system: router (router).
Relay system above the network layer: gateway.

Network interconnection equipment: routers
When the relay system is a repeater or a network bridge, it is generally not called network interconnection, because this is only an expansion of a network, and this is still a network.
The gateway is relatively complex and is currently used less. The Internet refers to a network interconnected by routers.
Due to historical reasons, many documents on TCP/IP refer to routers used in the network layer as gateways
Insert picture description here

Interconnection network and virtual interconnection network

Insert picture description here
The meaning of the virtual interconnection network The
so-called virtual interconnection network is also the logical interconnection network. It means that the heterogeneity of the various physical networks interconnected is inherently objective, but we can use the IP protocol to make these properties Different networks look like a unified network from users. The virtual interconnection network using the IP protocol can be referred to as the IP network for short.
The advantage of using a virtual interconnection network is that when the hosts on the Internet communicate, it is as if they are communicating on a network, and the heterogeneous details of the interconnected networks are invisible.

Introduction to IP protocol

Internet Protocol IP is one of the two most important protocols in the TCP/IP system.
There are four other protocols used in conjunction with the IP protocol:
Address Resolution Protocol (ARP)
, Reverse Address Resolution Protocol (RARP)
, Internet Control Message Protocol (ICMP),
Internet Group Management Protocol, IGMP ( Internet Group Management Protocol)
Insert picture description here

IP hierarchy

Hierarchical IP address

Insert picture description here
For example, the address received by the router on the right is preceded by the destination address starting with 192.168.1, then it will ignore what is behind and send it directly to the left. The network segment of 192.168.1
cannot be all 0 on the left. , It can’t be all 1s. The
host number. All 0s represent the network itself. This identifies a network. The
host number. All 1s represent direct broadcast to this network segment.

website address

The network address (also called the network number) uniquely specifies each network. Every computer on the same network shares the same network address and uses it as part of its own IP address.
Insert picture description here
The IP address is 32 bits. A type IP address uses 8 bits for the network address, and 24 bits for the host address. In
this way, there can be 256 256 256 machines in the same network segment.

Class B addresses are 16-bit network addresses and host addresses.
Class C addresses are 24-bit network addresses and 8-bit host addresses. A network segment can have 256 machines.
Insert picture description here
According to the characteristics of the conversion between binary and decimal, the network designer may I want to use the first 8 bits to distinguish ABCD addresses

Starting with 0 means class A address, means starting from 0-127
and starting with 10 means class B address, means starting
from 128-191
and starting with 110 means class C address, means starting from 192-223 and starting with 1110 means D Class address, which represents
the maximum assignable network number from 224-239 in the figure below.
A. Because the first bit must be 0, it cannot be all 0s and all 1, so it is 2^7-2
B because 10, two missing , And 128.0 means loopback, which means itself, usually not assigned, so subtract 1
Insert picture description here

Several special IP addresses

127.0.0.1 The local loopback address
169.254.0.0 When the computer cannot obtain an IP address from the network, it generates a temporary address by itself.
Reserved private network address
10.0.0.0
172.16.0.0----172.31.0.0
192.168.0.0 ----192.168.255.0

(1)  广播地址
    TCP/IP协议规定,主机号全为“1”的IP地址用于广播之用,称为直接广播地址。用以标识网络上所有的主机,例如,192.168.1.10是一个C类地址,广播地址是192.168.1.255。当某台主机需要发送广播时,就可以使用直接广播地址向该网络上的所有主机发送报文。
(2)有限广播地址
    有时需要在本网内广播,但又不知道本网的网络号,于是TCP/IP协议规定,32比特全为“1” 时的IP地址用于本网广播。因此,该地址称为“有限广播地址”,即255.255.255.255(3)0”地址
TCP/IP协议规定,主机号全为“0”时,表示为“本地网络”。例如,“128.20.0.0”表示“128.20”这个B类网络,“192.168.1.0”表示“192.168.1”这个C类网络。
(4) 回送地址
    以127开始的IP地址作为一个保留地址,例如127.0.0.1,用于网络软件测试以及本地主机进程间通信,该地址被称为“回送地址”。

The role of subnet mask

Subnet mask (subnet mask) is also called network mask and address mask. It is a bit mask used to indicate which bits of an IP address identify the subnet where the host is located and which bits identify the host . The subnet mask cannot exist alone, it must be used in conjunction with the IP address. The subnet mask has only one function, which is to divide an IP address into two parts, the network address and the host address.
If the IP address of a computer is configured as 172.16.122.204, the subnet mask is 255.255.0.0. Write its IP address and subnet mask in binary, and perform the AND operation, that is, the AND operation of 1 and 1 is 1, and the AND operation of 0 and 1 or 1 and 0 will both be 0. In this way, after the AND operation of the IP address and the subnet mask, the host bit will return to zero no matter what the value is, and the value of the network bit will remain unchanged, so that the network segment where the computer is located is 172.16.0.0.
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43416157/article/details/106320082
Recommended