Install ISC DHCP Server on Ubuntu 16.04

Install ISC DHCP Server on Ubuntu 16.04.

The Internet Systems Consortium (ISC) Dynamic Host Configuration Protocol (DHCP) server is free, open-source, and easy to install. Both enterprises and small networks have used ISC DHCP in production for many years.

Jason Coltrin

Jason Coltrin has been working in IT for more than 17 years. He holds an MCSE 2003 Security+ plus various Palo Alto and SonicWall firewall certifications. He also is an avid Linux Administrator and currently works in higher education.

Latest posts by Jason Coltrin (see all)

ISC DHCP can issue both IPv4 and IPv6 addresses and support address reservation, boot-p, DDNS, VOIP configurations, and failover. ISC DHCP has been around since 1999 and is available free for download but runs only on BSD, Solaris, and Linux.

I won't go into all of the benefits of different DHCP platforms such as Windows Server, Cisco routers, or firewalls, as choosing a platform usually comes down to personal preference. Most implementations of DHCP provide the same functions, but I've become fond of the way ISC DHCP provides rock-solid service as well as flexibility.

If you have a Cisco router issuing IP addresses to 12 different VLANs, you might want to consider a dedicated DHCP server to free up resources. Another benefit of ISC DHCP is that you won't have to manually set static IP addresses on your servers; you only need to pre-populate the dhcpd.config file with a client's MAC address once. Being proficient with editors such as vim or Nano helps in this regard. Tasks like commenting out old hardware addresses, providing a server a new static address, or managing your IP scopes are a breeze with only an SSH session.

In this guide, I'll demonstrate how to locate your current DHCP server and then install and set up an ISC DHCP server. We'll then move on to gaining control of your new DHCP server, best practices, monitoring the logs, and setting up static address reservations.

Find existing DHCP servers ^

Networks can get large, and sometimes it's not readily apparent which DHCP server is running on your network. Before you install a new DHCP server, you have to make sure that no other DHCP server is running to avoid conflicts.

If you suspect rogue DHCP servers, I recommend reading Michael's instructions, or you can download and run the Microsoft Rogue DHCP Server Detection tool. Either of these tools will also identify the authoritative DHCP server on your network.

On Windows 10, to find your DHCP server, right-click on the Start Button and click Network Connections. Next, right-click on the primary Ethernet adapter and click Status, then the Details button. Here you will find the IPv4 DHCP Server address.

Find the DHCP server on Windows 10

Find the DHCP server on Windows 10

If you want to find the IP address of a DHCP server used for configuring a particular interface on Ubuntu/Linux, there are two ways of doing this:

The easy way is to simply view the DHCP lease information from the following file, where 'ens34' is the adapter's identity:

You'll have something similar to the following returned:

Ubuntu DHCP lease file data

Ubuntu DHCP lease file data

I like this method because I can see my lease-time, renew, rebind, and expire dates. We can tell that our dhcp-server-identifier is 10.0.10.151.

Another way is to examine the log files in /var/log/ by typing the following:

Here's what this returns:

Ubuntu grep DHCP leases

Ubuntu grep DHCP leases

Here you may notice that two NICs have received IP addresses (.54 and .55) from 10.0.10.151.

Install and configure ISC DHCP ^

The installation of an ISC DHCP server is pretty straightforward on Ubuntu and can be accomplished with this command:

Once the service has been installed, we'll first want to tell the server which interface to use for serving requests. Do this by entering the interface's names between quotes at the bottom of the file /etc/default/isc-dhcp-server. For example:

You could also include the wlan0 interface. For example:

Define the DHCP service interface

Define the DHCP service interface

Now we need to edit our dhcpd.conf file, but for practice, let's first make a copy of the default file in the same directory with the command cp:

Now open the config file with your file editor of choice and take a look at the different default settings.

The default dhcpd.config provides comments and examples for all possible functions. However, I've provided a simplified dhcpd.conf file here to add a little clarity about lease times.

In the example dhcpd.conf file, the option log-facility local7; sets the default log file location according to how you define logging in /etc/rsyslog.d/. In my case, I created the file /etc/rsyslog.d/10-dhcpd.conf and added the following line:

Now records of all DHCP requests and leases are added to the dhcpd.log. We'll go further into logging later.

The rest of the options should look familiar: we set our global options and then move on to our primary subnet and pool. We can include any number of VLANs or networks in this file, as defined by subnet, each with their own address pools. You can tell that the primary AD domain controller is 10.0.10.107, my pfSense is 10.0.10.254, and the address pool is 10.0.10.50 through 10.0.10.250. We'll go over how to pre-define and set static addresses according to MAC addresses shortly.

Set up reservations with MAC addresses ^

In order to set up a host with a static address, under the subnet section in which you want the device to be defined, just add the following few lines to dhcpd.conf:

Now when the device with the MAC address 00:KK:HD:66:55:9B powers on, because it's set to DHCP, the printer will only be issued the IP address 10.0.10.58. This is a very useful tool when provisioning new equipment, switches, and printers.

In a similar fashion, you can add if statements to the configuration file for hooking VOIP phones or hardware addresses with a particular pattern to your controllers, set additional options, and define VLANs for those devices.

Get status/start/stop/restart ISC DHCP ^

There are four commands I use regularly to control the ISC DHCP server:

The status command provides troubleshooting information in the event you have misconfigured the dhcpd.conf file; otherwise you should see your service is running with output similar to the following:

ISC DHCP server status

ISC DHCP server status

Monitor server and logs with ccze ^

When adding devices to your network, especially IoT devices, network cameras, or other headless devices, it's nice to see what hits your DHCP server and when. Also, looking at log files in the standard green font can be monotonous. To make things a little easier and more colorful, I like to use my favorite utility, ccze. Ccze is great for colorizing logs, ruby, and Apache as well as of course DHCP logs. Install ccze on Ubuntu with this command:

Now use the tail -f command to watch the logs as they run with something like the following command:

You can also add the –A flag and pipe the output to other commands such as grep. In the following example, I will get only results where the last four digits of the MAC address, 02:1c:29:3a:85:ca (85:ca), are output to the screen.

Using grep and ccze to find an address

Using grep and ccze to find an address

Conclusion ^

ISC DHCP server has been around for a long time, and many different enterprises use it because of its flexibility. If you haven't tried DHCP on Linux, you should know that the set up is not that difficult, and you may become inspired to take ISC DHCP server even further than what I have demonstrated here.

Video Install ISC DHCP Server on Ubuntu 16.04

Install ISC DHCP Server on Ubuntu 16.04


Source: www.bing.com
Images credit ed to www.bing.com and img55.it168.com


Related Posts To Install ISC DHCP Server on Ubuntu 16.04


Install ISC DHCP Server on Ubuntu 16.04 Rating: 4.5 Posted by: Brot Trune

Search Here

Popular Posts

Total Pageviews

Recent Posts