0% found this document useful (0 votes)
188 views2 pages

Linux Tutorial - DHCP Server Configuration

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views2 pages

Linux Tutorial - DHCP Server Configuration

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

!

"#$

YoLinux Tutorial - DHCP Server Configuration


This tutorial covers the configuration and set-up of a Linux DHCP server. It is a prerequisite that the network interface be configured. the server also be configured.

For Linux DHCP client configuration and general Linux network configuration, see the YoLinux Networking Tutorial

Related YoLinux DHCP Server Configuration:


Tutorials:

°Linux Networking Dynamic Host Configuration Protocol (DHCP) automatically assigns IP addresses and other network configuration information (subnetmask,
broadcast address, etc) to computers on a network. A client configured for DHCP will send out a broadcast request to the DHCP server
°Linux Sys Admin requesting an address. The DHCP server will then issue a "lease" and assign it to that client. The time period of a valid lease can be specified on
the server. DHCP reduces the ammount of time required to configure clients and allows one to move a computer to various networks and be
°Internet Gateway configured with the appropriate IP address, gateway and subnet mask. For ISP's it conserves the limited number of IP addresses it may use.
DHCP servers may assign a "static" IP address to specified hardware. Microsoft NetBios information is often included in the network information
°YoLinux Tutorials Index
sent by the DHCP server.
Ads by Goooooogle
DHCP assignment:
Industrialize
IP/DNS/DHCP 1. Lease Request: Client broadcasts request to DHCP server with a source address of [Link] and a destination address of [Link].
Want to centralize the The request includes the MAC address which is used to direct the reply.
management of your IP
resources ? 2. IP lease offer: DHCP server replies with an IP address, subnet mask, network gateway, name of the domain, name servers, duration of the
[Link] lease and the IP address of the DHCP server.
3. Lease Selection: Client recieves offer and broadcasts to al DHCP servers that will accept given offer so that other DHCP server need not
Telecom IP DNS/DHCP make an offer.
IRRD 4. The DHCP server then sends an ack to the client. The client is configured to use TCP/IP.
Telecom/Enterprise IP 5. Lease Renewal: When half of the lease time has expired, the client will issue a new request to the DHCP server.
Address mgmt TCAM -
Built for complex networks
[Link] Starting DHCP server: service dhcpd start
(or /etc/rc.d/init.d/dhcpd start)
DNS Manager control
panel Sample DHCP server config file: (DHCP v3.0.1) /etc/[Link]
Provide DNS hosting and (See /usr/share/doc/dhcp-3.X/[Link])
DNS centralization
services. ddns-update-style interim; # Required for dhcp 3.0+ / Red Hat 8.0+
[Link] ignore client-updates;

subnet [Link] netmask [Link] {


Dhcp Management
IT Product Reviews, range [Link] [Link]; # Range of IP addresses to be issued to DHCP clients
Research, Vendors & option subnet-mask [Link]; # Default subnet mask to be used by DHCP clients
News. Learn More Now! option broadcast-address [Link]; # Default broadcastaddress to be used by DHCP clients
[Link]/mobiletopics option routers [Link]; # Default gateway to be used by DHCP clients
option domain-name "[Link]";
option domain-name-servers [Link], [Link]; # Default DNS to be used by DHCP clients
option netbios-name-servers [Link]; # Specify a WINS server for MS/Windows clients.
Ip Address Management # (Optional. Specify if used on your network)
Free info on Ip Address
Management Start your # DHCP requests are not forwarded. Applies when there is more than one ethernet device and forwarding is configured.
info search right here! # option ipforwarding off;
[Link]

default-lease-time 21600; # Amount of time in seconds that a client may keep the IP address
Advertise on this site max-lease-time 43200;

option time-offset -18000; # Eastern Standard Time


# option ntp-servers [Link]; # Default NTP server to be used by DHCP clients
Ads by Google # option netbios-name-servers [Link];
# --- Selects point-to-point node (default is hybrid). Don't change this unless you understand Netbios very well
# option netbios-node-type 2;

# We want the nameserver "ns2" to appear at a fixed address.


# Name server with this specified MAC address will recieve this IP.

host ns2 {
next-server [Link];
hardware ethernet [Link];
fixed-address [Link];
}

# Laser printer obtains IP address via DHCP. This assures that the
# printer with this MAC address will get this IP address every time.

host laser-printer-lex1 {
hardware ethernet [Link];
fixed-address [Link];
}
}
Test configuration file for errors with the following command: /etc/rc.d/init.d/dhcpd configtest
(Other distributions may use: /usr/sbin/dhcpd -f)

Note: The MAC addresses for the static address name server ([Link]),
can be obtained with the command /sbin/ifconfig:

eth0 Link encap:Ethernet HWaddr [Link]


inet addr:[Link] Bcast:[Link] Mask:[Link]
inet6 addr: fe80::202:b3ff:fef0:e484/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4070 errors:0 dropped:0 overruns:0 frame:0
TX packets:3878 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3406445 (3.2 MiB) TX bytes:439612 (429.3 KiB)

When dhcpd is running it will generate entries in the file: /var/lib/dhcp/[Link]

lease [Link] {
starts 2 2004/12/01 [Link];
ends 3 2004/12/02 [Link];
hardware ethernet [Link];
uid [Link];
client-hostname "Node1";
}

%& ' '( %' '))* )+ ',


!"#$

LANs separated by routers: In order to have your DHCP broadcast pass through a router on the the next network, one must configure the
router to allow DHCP relay. (Cisco: ip-helper address, Juniper: dhcp-relay) The local lan subnet{ } configuration must come before the
configuration directives of the remote LANs.

See dhcp-options man page below.

DHCP man pages:


dhcpcd: DHCP client daemon
/etc/dhcpc:
/etc/dhcpc/dhcpcd-<interface>.info: dhcpcd stores host information in this file. (interface=eth0 or eth1,...)
/etc/dhcpc/dhcpcd-<interface>.cache: Cache file containing the previously assigned IP address.
dhcpd: Dynamic Host Configuration Protocol Server daemon
[Link]: dhcpd configuration file
[Link]: dhcpd DHCP client lease database
dhcp-options: dhcpd Dynamic Host Configuration Protocol options
pump: configure network interface via BOOTP or DHCP protocol
DHCP RFC's: RFC2131, RFC1541 (obsolete), RFC2132

Note: DHCP client will overwrite your /etc/[Link] file with new information recieved from the DHCP server.

Books:

"Red Hat Linux Fedora Unleashed"


by Bill Ball, Hoyt Duff
Sams, ISBN# 0672326299

"Red Hat Linux Fedora 3 Unleashed"


by Bill Ball, Hoyt Duff
Sams, ISBN# 0672327082

Return to [Link] for more Linux links, information and tutorials


Return to YoLinux Tutorial Index
Feedback Form

Copyright © 2005 by Greg Ippolito

'& ' '( %' '))* )+ ',

You might also like