Assign an IP address to a computer using DHCP

wifi symbol

How to configure DHCP on a Cisco router or layer 3 switch

Posted on 29 August 2017 by Beaming Support

DHCP (dynamic host configuration protocol) allows a server to assign an IP address to a computer from a preselected range of numbers configured for a particular network.

You can configure DHCP on a Cisco router or layer 3 Switch using the following commands.

In this example we will assume a router is used.

The first thing to do is exclude any important addresses like servers, access points and the router itself. Below we specify a beginning address and an end address to exclude a range of IPs.

Router#conf t

Router#(config)ip dhcp excluded-address 192.168.1.1 192.168.1.20

Router#(config)ip dhcp excluded-address 192.168.1.200 192.168.1.254

 

Next we will set up the DHCP pool and a number of variables.

Router#(config)ip dhcp pool MyDHCP

Router#(dhcp-config)network 192.168.1.0 255.255.255.0

Router#(dhcp-config)dns-server 192.168.1.253

Router#(dhcp-config)default-router 192.168.1.254

Here we have specified the IP address range (192.168.1.0/24), the DNS server and the default gateway given out to clients. Providing the router setup is correct, this will allow clients to access the Internet.

 

There are further options that can be specified below:

Domain Name

Router(dhcp-config)# domain-name MyNetwork 

Lease Time 7 days

Router(dhcp-config)# lease 7

Lease Time 12 hours

Router(dhcp-config)# lease  0 12

 

To see DHCP leases that have been assigned, issue the following command.

Router#show ip dhcp binding

Bindings from all pools not associated with VRF:

IP address                           Client-id/hardware address        Lease expiration               Type

User name

192.168.1.21                       0010.f752.e77d.10                           Aug 20 2019 00:01AM     Automatic

192.168.1.22                       0010.f752.e7ab.10                           Aug 20 2019 00:09AM     Automatic

192.168.1.23                       0010.f752.e7a4.10                            Aug 20 2019 00:51AM     Automatic

Are you a networking expert?

Beaming is a growing internet service provider and we’re always on the look out for new talent to join our team.

Be more productive

Each month we email out our latest how-to guides to increase effiiciency and productivity in the workplace, alongside up-to-the-minute cyber security tips that anyone can follow and news on how businesses harness the power of tech.

  • This field is for validation purposes and should be left unchanged.

Subscribe & get our Five Years in Cyber Security Guide

A free guide to simple strategies that boost cyber resilience for businesses of all sizes

When you download it, we’ll pop up in your inbox once a month with:

  • Cyber security guidance for users of all ability levels
  • FAQs from our technical support desk
  • Quick tips that boost efficiency & productivity

 

  • This field is for validation purposes and should be left unchanged.

Five Years in Cyber Security Ebook