Fundamentals 13 min read

Understanding IP Configuration, DHCP, and PXE: From Manual Setup to Automated Boot

This guide explains how to manually configure IP addresses using ifconfig or ip commands, the role of DHCP in dynamic IP allocation, and how PXE leverages DHCP to automate OS installation, covering packet flow, ARP handling, lease renewal, and boot processes.

JavaEdge
JavaEdge
JavaEdge
Understanding IP Configuration, DHCP, and PXE: From Manual Setup to Automated Boot

1. Configuring an IP Address

To enable communication between machines, a network interface must have an IP address. You can assign it using ifconfig (net-tools) or ip addr (iproute2) and then bring the interface up:

$ sudo ifconfig eth1 10.0.0.1/24
$ sudo ifconfig eth1 up
$ sudo ip addr add 10.0.0.1/24 dev eth1
$ sudo ip link set up eth1

If the assigned address is not in the same subnet as neighboring devices (e.g., using 16.158.23.6 while others are 192.168.1.x), packets cannot be delivered because the MAC layer cannot resolve the destination MAC address.

Linux determines whether the destination IP is in the same subnet. If it is, it sends an ARP request to obtain the target MAC. If not, it forwards the packet to a configured gateway. Without a proper gateway, the packet is dropped.

2. DHCP – Dynamic Host Configuration Protocol

Static IP configuration is impractical for many client machines. DHCP automates address assignment: a DHCP server manages a pool of IPs, and clients request an address when they join the network.

3. How DHCP Works

The process consists of four main messages:

DHCP Discover: A new client broadcasts from 0.0.0.0 to 255.255.255.255 using UDP/BOOTP, announcing its MAC and requesting an IP.

DHCP Offer: The server replies with an available IP, subnet mask, gateway, lease time, etc.

DHCP Request: The client selects one offer (usually the first received) and broadcasts its acceptance.

DHCP ACK: The server confirms the lease, sending final configuration details.

If multiple DHCP servers respond, the client picks one and informs the others to release their offers.

4. Lease Renewal and Reclamation

Leases have a finite duration. When half the lease time has elapsed, the client sends a DHCP Request to extend the lease. The server replies with a new ACK containing updated parameters.

5. Pre‑boot Execution Environment (PXE)

In data centers, installing an OS on hundreds of machines manually is infeasible. PXE allows a machine to boot over the network before any OS is installed.

The PXE client obtains an IP address via DHCP. The DHCP server can also provide the PXE server’s address and the boot filename (e.g., pxelinux.0).

ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.1.0 netmask 255.255.255.0 {
    option routers 192.168.1.1;
    option subnet-mask 255.255.255.0;
    option time-offset -18000;
    default-lease-time 21600;
    max-lease-time 43200;
    range dynamic-bootp 192.168.1.240 192.168.1.250;
    filename "pxelinux.0";
    next-server 192.168.1.180;
}

After receiving the boot filename and PXE server address, the client uses TFTP to download the bootloader, kernel, and initramfs, then starts the Linux kernel.

6. PXE Boot Process

PXE client starts: Sends a DHCP request and receives IP, PXE server address, and boot file.

File download: Uses TFTP to fetch pxelinux.0 and configuration files.

Kernel execution: The bootloader loads the kernel and initramfs, handing control to the OS.

7. Summary

Manual IP configuration requires careful subnet planning and gateway setup. DHCP automates address allocation, lease management, and can also supply PXE boot information, enabling large‑scale, unattended OS installations—an essential technique in modern cloud and data‑center operations.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

PXEnetwork fundamentalsLinux networkingDHCPIP Configuration
JavaEdge
Written by

JavaEdge

First‑line development experience at multiple leading tech firms; now a software architect at a Shanghai state‑owned enterprise and founder of Programming Yanxuan. Nearly 300k followers online; expertise in distributed system design, AIGC application development, and quantitative finance investing.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.