network layer service
The two services provided by the network layer are: virtual circuit service and datagram service
aspect |
virtual circuit service |
datagram service |
ideas |
Communication is ensured through the network |
Communication is guaranteed through the user host |
establish connection |
must have |
unnecessary |
destination address |
During the connection establishment phase, each packet uses a short virtual signal |
Each packet has a complete destination address |
packet forwarding |
Packets on the same virtual circuit are forwarded according to the same route |
Each packet can be independently routed for forwarding |
Node failure |
Virtual circuits using this node cannot be used |
Packets using this node may be lost, other |
grouping order |
Arrive at the end in order |
The time to reach the end point is not necessarily in the order of sending |
1. Virtual circuit service
The virtual circuit service can be understood by using the train. The head of the train needs to know the destination, but the cars do not need to know, and the cars are arranged in a certain order. The route that the train travels can be regarded as a virtual circuit that has been established. Each node car needs to go through the same node (route), and finally when the train arrives at the terminal station, each car still arrives in sequence. In this process, if a node fails, the virtual circuit using the node will not work properly.
2. Datagram service
The datagram service can be understood as a fleet of several transport vehicles. Each vehicle knows the final destination, but each vehicle can choose a different driving route, so the order in which each vehicle arrives at the destination is also uncertain. In this process, if a node (route) on a certain line fails, the transport vehicle using the line will not be able to reach the end point, resulting in packet loss and node change.
2. Internet Protocol IP
There is no single network that can meet the needs of all users. We can use the IP protocol to allow networks with different performances to form a virtual interconnected network. In fact, the Internet can be composed of a variety of heterogeneous networks interconnected.
1. Classification of IP addresses
IP address::={<network number>, <host number>}
IPV4 divides IP addresses into five categories:
which is:
A: 0.0.0.0-127.255.255, where segments 0 and 127 are unavailable
B: 128.0.0.0-191.255.255.255
C: 192.0.0.0-223.255.255.255
D: 224.0.0.0-239.255.255.255
E: 240.0.0.0-255.255.255.255, where segment 255 is unavailable
There are also some special IPs such as: special source addresses, loopback addresses, broadcast addresses and some private IPs.
2. IP address and hardware address
IP地址就是分配给每个连接在Internet上分配的一个32bit地址,使用二进制来表示。IP协议就是使用这个地址咋主机之间传递信息。而IP地址需要针对不同网络进行不同的设置,需要IP地址,子网掩码,默认网关
硬件地址即为MAC地址(物理地址),是数据链路层和物理层所使用的。是由网络设备制造商生产时写在硬件的内部,所以这个地址与网络无关。