Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

This chapter is from the book

DHCP

Most people who use the Internet regularly probably use DHCP on a daily basis—even if they don't know it.

In a classic office network that does not use DHCP, each PC needs to be configured with a static IP address and all of the appropriate network settings: name servers, default routes, and so on. Once configured, the device reads its own local network settings when it boots and never forgets it. A DHCP-connected device, on the other hand, asks a central DHCP server for all that information each time it boots and leases an IP address from the server. From the perspective of the user, the PC automatically configures itself. That's what happens at home when you dial in to your ISP and are assigned an address.

Setting Up DHCP

For starters, you need to install the DHCP package on your system. Be aware that many distributions break up the DHCP package into a dhcp-server and a dhcp-client, though the names can vary. Debian's DHCP server package is called just dhcp, for example.

The server gets its information from the /etc/dhcpd.conf configuration file. Take a look at this very basic configuration file that I created on my test server, being sure to note the semicolons at the end of each entry:

#
# My DHCP configuration file
#

ddns-update-style            none;

default-lease-time           21600;
max-lease-time               21600;

option subnet-mask           255.255.255.0;
option broadcast-address     192.168.22.255;
option routers               192.168.22.10;
option domain-name-servers   192.168.22.10, 192.168.22.11;
option domain-name           "mydomain.dom";
option root-path             "192.168.22.6:/opt/ltsp/i386";
filename                     "/lts/vmlinuz-2.4.24-ltsp-1";

subnet 192.168.22.0 netmask 255.255.255.0 {
    range dynamic-bootp 192.168.22.70 192.168.22.90;
}

When I start a thin client or even a regular PC with this configuration file in place, the unit is assigned an IP address between 192.168.22.70 and 192.168.22.90—that's the meaning behind the range dynamic-bootp parameter near the bottom. Take a look at the rest of these settings in turn, starting from the top:

  • ddns-update-style: DHCP version 3, which many of you will be using, requires this entry, regardless of whether you are using dynamic DNS updates on your system. This is a setting in transition with interim being the only functional setting. For now, you can set it to none as in my configuration example.

  • default-lease-time: Each host (MAC address) that obtains an address from the server leases that address for a specific time, measured in seconds. If the machine reboots inside of that time, it can be assured of getting the same IP address.

  • max-lease-time: When connecting, the client can actually request a specific lease time, also measured in seconds. You might choose to make both default and maximum lease times to be the same or you might allow a client to request a longer lease. This is your choice.

  • option subnet-mask: This is the subnet mask assigned to clients.

  • option broadcast-address: Next, we have the broadcast address. Unless you are subnetting, this is pretty basic.

  • option routers: This is essentially your default route to the Internet.

  • option domain-name-servers: You are free to list one to three name servers on this line. Separate each one with a comma.

  • option domain-name: Another self-explanatory parameter, this is the domain name for your network.

  • option root-path: As the name implies, this is the path to the server where the thin client will find the new root directory and all of the associated files to run. It may seem obvious, but take note of the fact that the LTSP server does not have to be the same machine as the default route or the name server.

  • filename: This is the filename of the kernel that the thin-client workstation will download once it connects. The kernel is downloaded via TFTP, which I'll cover shortly.

All that brings us back around to the paragraph that started it all.

subnet 192.168.22.0 netmask 255.255.255.0 {
    range dynamic-bootp 192.168.22.70 192.168.22.90;
    range dynamic-bootp 192.168.22.120 192.168.22.150;
}

Here, we are essentially defining a dynamic network and specifying the addresses available for DHCP clients just logging on. Before moving on, I should tell you that the range I've defined above is a little different than the one I showed you just a couple of paragraphs back. In this example, there are actually two ranges of IP addresses up for grabs, and you could include more, depending on how you, as the systems administrator, decided to partition out IPs.

One of the reasons I've separated this out is that everything above the subnet paragraph is considered global. There can be many different subnet paragraphs (as in a Class A or B private network). That said, some of the globals start with the word “option”. All of these options you see can be applied to the subnet you defined (a different default DNS address perhaps). Unless you include a different parameter, the global parameters apply.

The Webmin Approach

Configuring DHCP from the command line is actually fairly easy. Should you prefer a more graphical approach, Webmin provides a module with everything you need to configure and maintain your DHCP server. You can find DHCP configuration under Servers in Webmin, or you can just jump to it by entering the URL in your browser's location bar:

http://your_server:10000/dhcpd/

Assigning Fixed DHCP Addresses

As a longtime systems administrator, I always have had a love/hate relationship with DHCP. These feelings come from trying to work on a site where every PC in the entire organization is assigned an IP dynamically. When troubleshooting problems on the network, I also had the additional burden of trying to figure out which workstation belonged to a particular IP address.

Luckily, DHCP does allow for host-specific IP addresses. To me, if a workstation is always sitting in a fixed location—on someone's desk, for example—then a fixed IP is more than desirable. Configuring fixed DHCP addresses does require an additional step, but it's not that complicated. Have a look at the following additional paragraph in my DHCP configuration file:

host thinclient1 {
    hardware ethernet       00:50:41:01:82:35;
    fixed-address           192.168.22.51;
    filename                "/lts/vmlinuz-2.4.24-ltsp-1";
}

Because this requires more work than assigning a range of addresses, why would you want to do this? Well, for one, this is more secure, because any host authenticating through your DHCP server is going to assign addresses only to those cards it knows about. For another, you know which workstation has which address, so support is easier, because you always know which unit you are talking about.

The host parameter represents the host name (thinclient1, in this case) for this client and should have an equivalent either configured on your name server or in your /etc/hosts file. Next, the hardware ethernet address is the unique hardware address (or MAC address) that I've mentioned in the past. You can get this information in a variety of ways. Dedicated thin-client units probably have it stamped on their backs. Ethernet cards have small labels identifying their MAC addresses. You can also see the MAC address by using the ifconfig command. The hardware ethernet address is the HWaddr information that you see on the second line below.

$ /sbin/ifconfig eth0
eth0      Link encap:Ethernet HWaddr 00:04:5A:5A:A8:2B
          inet addr:192.168.22.100 Bcast:192.168.22.255
Mask:255.255.255.0

Let's get back to the dhcpd.conf file segment we were looking at and continue with the fixed-address parameter. This is, quite simply, the IP address that you want to assign to that client. Finally, the last line (the filename parameter) is the TFTP download path to the kernel that the thin client loads when it boots from the network. And that, my friends, is the perfect segue to a discussion of TFTP.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020