DHCP (Dynamic Host Configuration Protocol) is a local area network (LAN) network protocol. The IP address range is controlled by the server. Clients can automatically obtain the IP address and subnet mask assigned by the server when they log in to the server
How do I send application layer data to the Ethernet network?
In each layer, a header is attached to the data sent, which contains the necessary information for the layer, such as the destination address sent and protocol-related information. Typically, the information provided for the protocol is the packet header, and the content to be sent is the data. From the perspective of the next layer, all packets received from the previous layer are considered to be data of this layer
IP header:
1) 4-bit version: The current protocol version number is 4.
(2) 4-bit header length: The number of 32bit words in the header, including any options, since it is a 4-bit field, the header is up to 60 bytes.
(3) 8-bit service type (TOS) : includes a 3-bit priority subfield, a 4-bit TOS subfield, and a 1-bit unused bit that must be set to 0. The TOS of the four bits indicates the minimum delay, maximum throughput, maximum reliability, and minimum cost. Only one of the four bits can be set to 1. If all 4 bits are 0, that means general service.
(4) 16-bit total length: refers to the length of the entire IP datagram, in bytes. Using the header length field and the total length field, you can know the starting position and length of the data content in the IP datagram. Because this field is 16 bits long, IP packets can be up to 65,535 bytes long, and the value of this field changes when the datagram is fragmented.
(5) 16-bit identification: Uniquely identifies each datagram sent by the host, and usually its value is increased by 1 for each message sent.
(6) 3-digit mark
(7) 13-bit film offset
(8) 8-bit lifetime: TTL sets the maximum number of routers that the datagram can pass through, which specifies the lifetime of the datagram. The initial value of the TTL is set by the source host (usually 32 or 64), and its value is subtracted by 1 once it passes through a router that processes it. When the value of this field is 0, the datagram is discarded and an ICMP packet is sent to notify the source host.
(9) 8-bit protocol: Identify which protocol is transmitting data to the IP.
(10) 16-bit header check and: check and code calculated according to the IP header. Without calculating the data after the header, ICMP, IGMP, UDP, and TCP all contain checks and codes that override both the header and the data in their respective headers. If the check and error occurs, the IP address discards the received datagram, but does not generate an error packet. The upper layer discovers the discarded datagram and retransmits it.
(11) 32-bit source IP address
(12) 32-bit destination IP address
(13) Options: Optional information of variable length, option fields are bounded by 32bit, and fill bytes with value bit 0 are inserted when necessary. This ensures that the IP header is always an integer multiple of 32 bits (as required by the header length field).
(14) Data