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

DHCP 、 UDP

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

Share

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

How the computer uses the IP address:

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

How to configure the source IPv4:

Manual configuration: add the IPv4 address that we consider to be valid directly to the configuration file of the network card

Features:

Precise address assignment

The administrator has a lot of repetitive work.

It is easy to make a manual error so that the host is unable to access the network.

Automatic configuration: computers without IP addresses communicate with other computers that can provide IP addresses through specific protocols and obtain IPv4 addresses

Agreement:

BOOTP:

Initiating protocol

The need to obtain an IP address from a network-wide broadcast using the RARP protocol; the BOOTP server selects an IPv4 address from its address pool and belongs permanently to this host

DHCP:

Dynamic Host Configuration Protocol, dynamic host configuration protocol

Address lease planning

Each address has its corresponding lease term.

Rules for renewal of lease:

When 50% of the lease period is over, the client contacts the server to renew the lease; if the renewal is not successful, the client will try three times in a row.

When the lease term expires 87.5%, the client will give up the IP address; rebroadcast whether there are other servers that can continue to use the previous IP address

Wait until the lease expires and the client IP address is completely released; the client will try to obtain another IP address from another server to connect to the network

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

1. Client broadcasts send DHCP Discover messages to determine whether there is a DHCP server in the network that can provide IP addresses for the local machine

two。 When the server receives the DHCP Discover message, it checks its own address pool. If it still has an available IP address, it selects an IP address from it and sends the DHCP Offer message to the client broadcast.

3. The client takes the IP address in the first DHCP Offer message received as the optional IP address, broadcasts the DHCP Request message to the network, notifies the server, and selects this IP address as the IP address for this communication.

4. After receiving the DHCP Request message, the server providing the IP address temporarily binds the IP address to the physical address of the corresponding host, and starts the lease timing; sends a DHCP ACK message to the client

The server that did not provide the IP address received the DHCP Request, put the IP address just provided back into the address pool, and sent a DHCP NAK message to the client

How to give the destination IP address:

Specify manually:

Manually write the IP address of the destination host directly in the address bar

Automatic resolution:

DNS protocol: Domain Name System

On the DNS server, the mapping relationship between the specific domain name and IP address is saved, and the task of address resolution can be completed.

Address resolution:

Forward address resolution:

The process of obtaining its corresponding IP address through a domain name

Reverse address resolution:

The process of deconstructing its domain name through an IP address

Www.baidu.com: fully qualified domain name (FQDN)

Peanut shell-DNS cache server

202.99.166.4

202.99.160.68

222.222.222.222

222.222.202.202

Hierarchical structure of TCP/IP protocol stack:

Application layer

Transport layer

Internet layer

Network access layer (physical layer, data link layer)

Transport layer:

Layer 4 of OSI: end-to-end connectivity

Layer 3 of TCP/IP:

TCP:Transfer Control Protocol, transmission control protocol

UDP:User Datagram Protocol, user Datagram protocol

The header format of the UDP protocol:

Port: also known as logical port, or protocol port; it is the communication interface between the application layer and the transport layer

Port is a digital ID made up of 16bits binary; its range is 0-65535

Where:

0: indicates all port numbers and cannot be used alone

1-1023: reserved port number

1024-64511: dynamically assign ports

64512-65535: registered port

Ssh:TCP/22

Http:TCP/80

Https:TCP/443

SMTP:TCP/25

POP3:TCP/110

IMAP:TCP/143

Telnet:TCP/22

Ftp:TCP/21

DHCP:UDP/67 (Server) UDP/68 (Client)

DNS:UDP/53 TCP/53

In Windows system: C:\ Windows\ System32\ drivers\ etc\ services

In Linux system: / etc/services

In this kind of file, the default communication interface mapping between application layer protocol and transport layer protocol is saved.

Source port: 16bits, the port number chosen by the sender when encapsulating data; generally speaking, the source port number of the data sent by the client is a randomly selected free port

Destination port: 16bits, the port number that the receiver of this data communication must use when transferring data from the transport layer to the application layer; generally speaking, the destination port number of the data is fixed

Note:

1. Generally speaking, during a round-trip communication, the port numbers of the two groups of data will be exchanged.

two。 When using the port, pay more attention to the accuracy of the target port; if the receiver cannot use the correct application to process the data because the target port is not clear, the data will be directly discarded by the transport layer protocol

Data length: 16bits, the length of the entire UDP Datagram, including the header

Data checksum: 16bits, the checksum of the entire UDP Datagram, ensuring data integrity to a certain extent

Review:

Use the IP address:

Source address:

Destination address:

UDP protocol:

Features:

First part:

Transport layer protocol

TCP protocol:

TCP features:

Transport layer of TCP/IP protocol stack

The network layer accessed by the application

Connection-oriented protocol

Full duplex mode operation

Error check

Packet serialization

Receive confirmation

Data recovery function

The first part of TCP protocol:

Source port number: 16bits

Destination port number: 16bits

Serial number: 32bits, serial number range: 1 ~ 2 ^ 32-2

The sequence number of the first segment is randomly selected

Sequence number of the second segment: sequence number of the previous segment + size of the data portion of the previous segment + 1

...

Confirmation number: 32bits, the range of confirmation number: 2 ~ 2 ^ 32-1

The receiver acknowledges the data that has been received and requires the sender to continue to transmit the identification of subsequent data segments.

Generally speaking, the confirmation number is the sequence number of the next segment to be sent by the sender

Header length: 4 bits, 24 bytes to 60 bytes.

Keep the flag bit: 3bits, not used for the time being

Authenticated encryption flag bit: 3bits

TCP property flag bit:

URG: emergency pointer flag bit; if the flag position 1, the forwarding priority of the data will be raised so that such data is forwarded first; if the URG flag bit of multiple data is set to 1 at the same time, the larger the emergency pointer of the next 16 bits, the higher the priority

ACK: the confirmation flag bit related to connection management; used to respond to the party initiating the connection establishment request or dismantling request

PSH: advance bit, if the flag position 1, the receiver can not add the data to the cache queue, directly to the application process for processing

RST: reset the connection flag bit; rebuild the TCP connection flag bit when the TCP connection runs out or fails

SYN: synchronization flag bit. During the process of establishing a TCP connection, the user initiates the connection by the party that initiates the connection establishment request.

FIN: end connection flag bit. If the flag position 1, the other party will know that the TCP connection will be dismantled. Just confirm it.

Window size: 16bits, mainly to achieve traffic negotiation and control, can prevent network congestion

Slide the window:

Congestion window:

Emergency window:

The size of the window means the number of segments we can transmit at a time

Data segment checksum: 16bits, checksum information that ensures the integrity of the data

Emergency pointer: 16bits, used to distinguish the priority of URG flag bits when they are all set to 1

Option: timestamp of segment segmentation

Connection-oriented features of the TCP protocol:

1. Connection establishment: three-way handshake

1) the sender generates a TCP header data, in which the source and destination ports are given by the application layer protocol; the serial number is randomly selected, the confirmation number is 0, and the flag bit SYN is set to 1.

2) after receiving the SYN request data sent by the sender, the receiver judges whether it can complete the data communication required by the other party; if so, it returns a TCP header data generated by it; the source and destination ports are opposite to the previous data; the sequence number is random, the confirmation number is the sequence number of the next data of the other party, and the two flag bits of SYN and ACK are set 1 at the same time.

3) after receiving the response data from the other party, the sender checks whether the ACK flag bit is set to 1; if it is 1, check whether the SYN flag bit is set to 1, and confirm it if it is also 1; then generate the second TCP header data; the sequence number is the sequence number of the previous data + 1, and the confirmation number is the sequence number of the receiver's next data; ACK flag position 1

two。 Remove the connection: wave four times

1) when all data transmission is finished, one party actively sends a FIN header data of TCP flag position 1 to the other party.

2) after receiving the data of such FIN flag position 1, the other party responds to the confirmation data of an ACK flag position 1

3) the other party initiatively sends out the TCP header data of FIN flag position 1, requesting to remove the connection.

4) the active Terminator confirms and sends the TCP header data of the ACK flag position 1.

Flow control characteristics of TCP protocol:

Passive flow control: congestion window

Due to the network congestion caused by unbalanced or unequal network resources between the sender and the sender, the data buffer of the receiver overflows and a large amount of data is lost. The receiver sends an acknowledgement segment with a window size of 0 to the sender to suspend the sender's data transmission.

Active flow control: sliding window

Every time the two parties communicate with each other, they will negotiate the window size, taking the minimum window as the standard, and the sender installs such a window size to send data.

Confirmation features of the TCP protocol:

1. No further data will occur until the sender receives the confirmation message from the receiver.

two。 If the sender does not receive the confirmation message from the receiver within a certain timeout period, the sender will retransmit the previously occurred data.

By confirming the characteristics, the reliable transmission of data can be guaranteed.

Description of data communication process-- dual-computer interconnection

1. If the user does not specify a destination IP address in the application, the application automatically issues a query request to the DNS server to obtain the IP address of the corresponding target host

two。 Which protocol of the transport layer does the current application need to use? TCP is selected for further packaging.

3. The transport layer does not immediately send data for the application layer. Instead, the TCP protocol generates the segment header and establishes the TCP connection through a three-way handshake.

The 4.IP protocol will complete the data encapsulation according to the correct address and corresponding format, but the network access layer needs to transfer the data through the MAC address, so it is necessary to query whether there is a record of the MAC address corresponding to the IP address in the ARP cache.

5. If the record is not found, the TCP three-way handshake request will be temporarily stored in memory; the ARP protocol generates the ARP request packet and sends it out by broadcast; after the destination host receives it, it will first cache the MAC address of the source host, then encapsulate its own IP address and MAC as data and unicast it back to the source host

6. The source host caches the MAC address of the destination host, and then encapsulates and sends the request for the TCP three-way handshake

7. When the TCP connection is established correctly, you can send data for the application to the destination host

8. For each batch of TCP messages, the destination host must confirm

9. When all the data messages have been sent, remove the TCP connection with four waves

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