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.

 

We're networking experts

When it comes to private wide area networks and business continuity services, a “set it and leave it” approach just doesn’t cut the mustard.

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

Asset 16

We answer real questions asked by businesses

From simple cyber security solutions to O365 migrations and everything in between. Take a look at our knowledge base and benefit from our expertise.

Avoid internet downtime

IT professionals in UK businesses dealt with 82M hours of internet outages last year.

Sign up for Beaming's monthly email updates & receive news on the latest tech to keep you online, simple shareable advice to help colleagues avoid cyber threats & how-to guides from our experienced tech team.
  • This field is for validation purposes and should be left unchanged.

Get the best of Beaming straight to your inbox

Our monthly email bulletin updates you on the best tech dedicated to keeping you online, how to make the most of your current connectivity and business tips to free up more of your time.

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