EdgeRouter – Configure DHCP server on EdgeRouter

Overview


Readers will learn how to set up and configure a DHCP server as well as clients on the EdgeRouter. 

Steps for DHCP server


To configure a DHCP server, three settings are required:

  • name
  • subnet
  • range

Here is an example of how to set up a DHCP server:

set service dhcp-server shared-network-name LABNET subnet 100.0.0.0/24 start 100.0.0.10 stop 100.0.0.100 set service dhcp-server shared-network-name LABNET subnet 100.0.0.0/24 default-router 100.0.0.1 set service dhcp-server shared-network-name LABNET subnet 100.0.0.0/24 dns-server 100.0.0.1 

This shows the DHCP server configuration:

dhcp-server {  shared-network-name LABNET {  subnet 100.0.0.0/24 {  default-router 100.0.0.1  dns-server 100.0.0.1  start 100.0.0.10 {  stop 100.0.0.100  }  }  } } 

Here are examples of show dhcp commands:

ubnt@ubnt:~$ show dhcp leases IP address Hardware Address Lease expiration Pool Client Name ---------- ---------------- ---------------- ---- ----------- 100.0.0.10 00:24:e8:f7:68:80 2011/12/02 14:41:32 ETH1 Test4-PC 
ubnt@ubnt:~$ show dhcp statistics pool pool size # leased # avail ---- --------- -------- ------- ETH1 91 1 90 

IP addresses can be removed with the clear commands. To clear a specific IP address:

ubnt@ubnt:~$ clear dhcp lease ip 172.16.0.10 

To clear all DHCP leases:

ubnt@ubnt:~$ clear dhcp leases

Steps for DHCP client


To configure a DHCP client, use the set interfaces ethernet eth_ address command (_ is the placeholder for the Ethernet port number):

set interfaces ethernet eth_ address dhcp 

Here is an example of the show dhcp client leases command:

ubnt@ubnt:~$ show dhcp client leases interface  : eth2 ip address : 192.168.0.27 [Active] subnet mask: 255.255.254.0 router  : 192.168.0.1 name server: 192.168.0.1 dhcp server: 192.168.0.1 lease time : 600 last update: Fri Dec 9 20:04:13 GMT 2011 expiry  : Fri Dec 09 20:14:10 GMT 2011 reason  : BOUND

 

Related Articles


Leave a Reply

Your email address will not be published. Required fields are marked *