EdgeRouter - Configure DHCP Server on EdgeRouter


Overview


Readers will learn how to create a DHCP server on EdgeRouter.

NOTES & REQUIREMENTS:
Applicable to the latest EdgeOS firmware on all EdgeRouter models. Knowledge of the Command Line Interface (CLI) and basic networking knowledge is required. Please see the Related Articles below for more information.
 
Devices used in this article:

Table of Contents


  1. Introduction
  2. Network Diagram
  3. Steps: How to
  4. Testing & Verification
  5. Related Articles

Introduction


Back to Top

When running one of the built-in setup wizards, a DHCP server will automatically be created for the LAN subnet entered in the wizard. These instructions allow for creating a DHCP server for a new scope manually.


Steps: How to Manually Create a DHCP Server


Back to Top

CLI: Access the command line interface (CLI). You can do this using the CLI button in the GUI or by using a program such as PuTTY.
set service dhcp-server shared-network-name LABNET subnet 192.168.20.0/24 start 192.168.20.10 stop 192.168.20.240
set service dhcp-server shared-network-name LABNET subnet 192.168.20.0/24 default-router 192.168.20.1
set service dhcp-server shared-network-name LABNET subnet 192.168.20.0/24 dns-server 192.168.20.1
GUI: Access the Graphical User Interface (GUI).

1. Go to Services > DHCP Server > Add DHCP Server and fill out the information as is applicable to your specific deployment. Hover over the tooltips to the right for more information. Click save.

createDHCPserver.png

2. Once the DHCP Server is created, it will appear in the EdgeMAX GUI, under Services > DHCP Server. Select View Details from the right hand Actions dropdown to configure its details as shown in the screenshot below. Fill in the form fields with your deployment's specific information.

Screen_Shot_2018-06-28_at_2.33.25_PM.png


Common DHCP Server Options 


Back to Top

These are some DHCP server options that might be useful in your deployment. They are optional. Scroll sideways to view complete commands in the Example column.

 Option Description Example
authoritative enable This helps clients switching networks to obtain a DHCP lease faster.
set service dhcp-server shared-network-name LABNET authoritative enable
 
lease This sets the lease time for the subnet. Once this lease time is up, the DHCP process will renew for the client.
set service dhcp-server shared-network-name LABNET subnet 192.168.20.0/24 lease 86400
static-mapping This allows the DHCP server to assign a specified IP address to a client based on a MAC Address.  
set service dhcp-server shared-network-name LABNET subnet 192.168.20.0/24 static-mapping UAP-AC-HD mac-address 00:00:00:EE:EE:EE
set service dhcp-server shared-network-name LABNET subnet 192.168.20.0/24 static-mapping UAP-AC-HD ip-address 192.168.20.11 

Testing & Verification


Back to Top

This would be a sample configuration:

admin@er4# show service dhcp-server 
 shared-network-name LABNET {
     authoritative enable
     subnet 192.168.20.0/24 {
         default-router 192.168.20.1
         dns-server 192.168.20.1
         lease 86400
         start 192.168.20.10 {
             stop 192.168.20.240
         }
         static-mapping UAP-AC-HD {
             ip-address 192.168.20.11
             mac-address 00:00:00:EE:EE:EE
         }
     }
 }

If you wish to see the current leases, run this command:

admin@er4:~$ show dhcp leases
IP address Hardware Address Lease expiration Pool Client Name
---------- ---------------- ---------------- ---- -----------
192.168.20.12 00:24:e8:f7:68:80 2018/6/28 14:41:32 ETH1 Test-PC

To show DHCP Pool Statistics, run the following:

admin@er4:~$ show dhcp statistics 
pool                           pool size  # leased   # avail
----                           ---------  --------   -------
LABNET                               231         1       230

IP addresses can be removed with the clear commands. 

To clear a specific IP address:

admin@er4:~$ clear dhcp lease ip 192.168.20.11

To clear all DHCP leases:

admin@er4:~$ clear dhcp leases

Related Articles


Back to Top

Intro to Networking - How to Establish a Connection Using SSH

EdgeRouter - Using dnsmasq for DHCP Server