DHCP

Der ISC-DHCP-Server ist sehr einfach zu konfigurieren und kennt zwei Arten von Konfigurationsanweisungen. Die erste Gruppe von Direktiven beginnt mit dem Wort „option“. Sie definieren Antworten auf eine DHCPDISCOVER-Anfrage. Direktiven ohne das Schlüsselwort „option“ steuern den Rest rund um den Server, wie z. B. Lease-Zeiten, wie viele Leases den Clients zugewiesen werden sollen usw. Die Konfigurationsdatei liegt in der Regel in /etc/dhcpd.conf oder /usr/local/etc.

Installation

yum install dhcp
/etc/dhcp/dhcpd.conf
# Make the server authoritative for the network segments that
# are configured, and tell it to send DHCPNAKs to bogus requests
authoritative;

ddns-update-style interim;
ignore client-updates;
log-facility local0;


# PXE settings
# ------------
allow booting;
allow bootp;

# Server to request the bootfile from
next-server 192.0.2.58;
filename "pxelinux.0";


# Internal subnet
# ---------------
subnet 192.0.2.0 netmask 255.255.255.0 {
    range 192.0.2.128 192.0.2.254;
    option domain-name "example.com";
    option domain-name-servers 192.0.2.50;
    option routers 192.0.2.1;
    option broadcast-address 192.0.2.255;
    default-lease-time 28800;
    max-lease-time 86400;
}

# Define a host named test, and statically
# assign an IP address to it
host test {
    hardware ethernet 00:11:22:33:07:f6;
    fixed-address 192.0.2.111;
}
systemctl enable dhcpd
systemctl start dhcpd

Test des DHCP-Servers von einem Client aus, ohne die angebotene IP-Adresse anzunehmen:

dhclient -n -v

Die Log-Datei findet sich unter:

tail -f /var/log/messages | grep dhcpd

Built on 2024-07-16