Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Computer Network (1)-- Internet layer

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

A computer network, as its name implies, is made up of several links, which can be computers, hubs, switches, routers, etc.; networks and networks can be interconnected through routers, which is the origin of the Internet, and the Internet is the largest Internet; the existence of the network connects many computers, while the existence of the Internet connects many networks together. The main function of the network is to enable different hosts to communicate with each other and to share a wide range of resources, and the data communication between computers is realized through interfaces.

The components of the Internet are divided into the edge part and the core part; the edge part is composed of each host in the network, and the core part is made up of routers connected to these networks to provide services to the hosts in the edge part.

The communication between computer networks is a very complex problem. In order to realize the communication between computers, people have put forward the basic reference model of open system interconnection that all kinds of computers can communicate in all areas of the world. OSI/RM; can communicate anywhere in the world as long as the computer obeys OSI's law. The seven-layer protocol of OSI consists of physical layer, data link layer, network layer, transport layer, session layer, presentation layer, and application layer from bottom to top, in which the transport layer is to coordinate the relationship between the upper three layers and the lower three layers, the upper layer is the resource subnet, which realizes the function of resource sharing, and the lower layer is the communication subnet, which realizes the function of data communication. The hierarchical structure realizes that the protocol of the next layer provides services for the upper layer, and in order to implement the protocol of this layer, we also need the services provided by the protocol of the next layer; the implementation of the OSI protocol is too complex, the operation efficiency is too low, the hierarchical division is not reasonable, and some functions appear in multiple levels, which are the reasons for the failure of the OSI protocol; but this does not prevent us from learning about the old communication protocol OSI.

OSI protocol:

Physical layer: its function is to shield the differences between transmission media and communication means as much as possible, so that the upper data link layer does not feel these differences; the physical layer can also save system resources by using channel multiplexing technologies, such as frequency division multiplexing, time division multiplexing, and statistical time division multiplexing.

Data link layer: it mainly uses point-to-point communication and broadcast communication. First, a piece of data is encapsulated into a frame, transparently transmitted, and error detected. If there are no errors, the data is sent from the data link layer to the network layer.

Network layer: mainly to provide communication services for different hosts on the network, and to select appropriate routes, so that the data transmitted from the transport layer can find the destination host through the appropriate route.

Transport layer: shielding the details of the upper three layers and the lower three layers, the upper three layers do not need to pay attention to how the lower three layers are implemented, and vice versa; they act as a link; in the transport layer, the data is divided into smaller data segments to achieve a more reliable data transmission mechanism to prevent resource droppings; virtual circuit mechanism, flow control and other functions can be carried out.

Session layer: the session layer defines how to start and end a session

Presentation layer: encoding and decoding, encryption and decryption, compression and decompression; presentation layer is to unify the data format; to ensure that the information sent by the application layer of a system can be understood correctly

Application layer: the application layer is an application that communicates with other computers, and it is the communication service of the corresponding application.

The concept of OSI's seven-layer protocol is clear but not practical; on the contrary, TCP/IP protocol is a four-layer architecture, which includes application layer, transport layer, network layer and network interface layer.

First of all, let's talk about the main functions of the network layer; the network layer is responsible for transmitting information for different hosts. In the TCP/IP protocol, the network layer encapsulates the data in the form of IP datagrams for transmission; in the network layer, the ARP,RARP,ICMP,IGMP;IP protocol depends on the services provided by the ARP and RARP protocols, while the implementation of the ICMP,IGMP protocol depends on the IP protocol

ARP protocol is an address resolution protocol, which converts a logical address of a description range into a physical address of a specific description.

RARP protocol, in contrast to ARP protocol, translates a specific physical address into a logical address that describes the scope.

IGMP: protocol for Internet Multicast Communication

ICMP: used to pass control messages between IP hosts and routers

IP:

The IP address is 32-bit binary, which is composed of two parts, the network bit part and the host bit part. The assignment between the network number and the host number varies according to different types of IP addresses.

Class An IP address: the first binary bit must be 0, the network bit has eight bits, and the host bit has 24 bits.

Class B IP address: the first two binary bits must be 10, the network bit must be 16 bits, and the host bit must be 16 bits

Class C IP address: the first three bits must be 110bits, the network bits must be 24 bits, and the host bits must be 8 bits

Class D IP address: the first four bits must be 1110 binary bits, and the network bits must be 32 bits. It is usually used for multicast communication, not for hosts.

Class E IP address: the first four binary bits must be 1111, reserved for scientific research

IP address

Class A

00000000 00000000 00000000-01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111

0.0.0.0-127.255.255.255

The first octet is all zero and is invalid IP because it represents the entire IP address stack

The first 8-bit group, all 1 except the first bit, is called a loopback address; neither is a valid address

So there are 2 ^ 7-2 network bits that can be assigned to class An addresses and 2 ^ 24-2 host bits that can be assigned.

Category B: 128.0.0.05191.255.255.255

10000000.00000000.00000000.00000000

10111111.11111111.11111111.11111111

Class C: 192.0.0.00223.255.255.255

11000000.00000000.00000000.00000000

11011111.11111111.11111111.11111111

Category D: 224.0.0.00239.255.255.255

11100000.00000000.00000000.00000000

11101111.11111111.11111111.11111111

Category E: 240.0.0.00255.255.255.255

11110000.00000000.00000000.0000000

11111111.11111111.11111111.1111111

IP addresses apply to dotted decimal notation:

1. The 32-bit IP address bits are divided into 4 groups with 8 bits.

two。 Use "." between each group. Symbols are separated

3. Convert each 8-bit group to a decimal representation

Such as: 10000000 00001011 00000011 00011111

128 11 3 31

IP address 2:

Reserved address: you cannot select the IP address to be used for other host configurations

0.0.0.0-0.255.255.255

127.0.0.0-127.255.255.255

Automatically assign address fields:

169.254.0.0-169.254.255.255

Network address: an address with all zero host bits

1.0.0.0: represents the name of a range

Broadcast address: an address with all 1 host bits

1.255.255.255: represents all IP addresses in the entire network segment as the destination address

Directed broadcast address: send data to this address, which can be received by all hosts

255.255.255.255

Total number of addresses of IPv4: 2 ^ 32 = 4.2 billion 94 million

Removed IP address:

Category D and E: 500 million

Address of network segments 0 and 127: 35 million

Network segment address of 169254: 65536

Network address: 126 "16384 + 2.09 million

Broadcast address: 126 "16384 + 2.09 million

The IP address that can be assigned to the host is 3.6 billion

In order to solve the problem of IP address exhaustion, people use the translation between private address and public address to improve the utilization of IP address and reduce the consumption of IP address.

Private address: can be used in different Internet

Public address: can be used on the Internet, but the address must be unique

NAT: address translation

SNAT: source address translation; public IP address is used instead of private IP address, but users can access it by converting private IP address to public IP address when they need to access another network. For public addresses that are accessed in multiple networks, if you want to access a network, you need to replace the shell of the public address with a private address before you can use it.

DNAT: destination address translation, replacing the public IP address in the packet with a private IP address

IP Datagram:

The format of the IP Datagram can describe the functions of the IP protocol. A Datagram consists of a header and data. The fixed length of the header is 20 bytes. The meaning of each field is described below.

(1) version: 4 bits, which refers to the version of IP protocol. The IP protocol used by both sides of the communication must be the same.

(2) the length of the head: 4 digits, indicating the length of the head, with a minimum length of 20 words and a maximum of 60 words

(3) DiffServ: 8 bits, used to get better service

(4) Total length: 16 bits, indicating the length of the entire Datagram including the header

(5) Identification: 16 bits to identify the source of the data and which data fragments are obtained.

(6) Mark: 3 bits, the lowest bit is marked as whether there are fragments after the MF flag, and the middle bit DF indicates whether the data segment cannot be sliced. The last bit is meaningless.

(7) slice offset: 13 bits, the relative position of a piece in a group by dividing into multiple slices.

(8) Survival time: 8 digits, indicating the life of the Datagram in the network

(9) Protocol: 8 bits. The protocol field indicates which protocol is used in this data segment.

(10) head check sum: 16 bits, this field only checks the head part, not the data part; every time you pass a router, you have to re-check the first check sum, because the first part may change.

(11) Source address: 32 bits, sender address

(12) destination address: 32 bits, receiver address

Use the IP address:

To use IP address for data communication, the most basic thing is to know the source address and destination address of the two hosts communicating. Here we talk about how to obtain the source address and destination address of both sides of the communication.

Source IPv4 address, the IP address configured on the host that sent the data

How to configure the source IPv4:

Manual configuration:

Manual configuration must have a good understanding of each IP address to avoid incorrect IP address selection. Although the IP address defined in this way is accurate to the bit, it is also prone to manual error, which is not allowed in some special environments, so it is not recommended.

Automatic configuration:

BOOTP: startup protocol under which the period of the IP address assigned is permanent, that is, the IP address assigned by the host is used permanently and will not be changed

But the drawback of this situation is also obvious, that is, a waste of IP resources, in view of the current lack of IP addresses in the world, this waste of resources is not desirable.

DHCP: dynamic host configuration protocol; the IP address assigned under this protocol is not permanently assigned to a host, but there is a "lease" agreement, that is, when an IP address is assigned, the server gives a lease time, and when the lease expires, it depends on whether to renew the lease or not to use the IP address. When 50% of the lease is reached, the host will issue a renewal request to the server assigned this IP address, and give up when it is sent three times without a response. When it reaches 87.5% of the lease, broadcast the channel to see if there is a server that can provide the same IP address as the one currently used. If so, establish a contact. If not, give up this IP address and adopt another IP address when the IP address lease expires.

The leasing process of DHCP protocol client address-- four-line session

The ① client sends DHCP Discover messages to search whether the server in the current network has a suitable IP address for the host to use.

② receives the server of DHCP Discover to check whether there is a suitable IP address in its address pool, and if so, encapsulate the message of the IP address into DHCP Offer and send it to the client.

The first DHCP Offer message received by the ③ client is the first choice of the IP address, because the first to arrive, his server is more efficient and easier to renew; after receiving it, the client sends a DHCP request message to the server, indicating that the IP address can be used

After receiving the DHCPRequest message, the server with the IP address provided by ④ temporarily binds the IP address with the physical address of the corresponding host; and starts the lease timing; a DHCP ACK confirmation message occurs; the server that does not provide the IP address receives the DHCPRequest, puts the IP address back into the address pool, and sends a DHCP NAK message, a non-confirmation message, to the client

Configure the destination IP address:

Manual parsing: specify the destination IP address directly in the address bar, but in this form, it is OK to remember several commonly used IP addresses. If there are a large number of IP addresses, it is obviously not applicable.

Automatic resolution:

DNS protocol: use the domain name instead of the IP address, resolve the domain name to obtain its IP address and jump to it; save the mapping relationship between the specific domain name and IP address on the DNS server; can complete the task of address resolution

Forward resolution protocol: resolves domain names to IP addresses for redirection

Reverse resolution protocol: resolve IP addresses to domain names for redirection

The result of DNS parsing will still be stored in the local server, which needs to be enabled in our Nic configuration before it can be used.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report