Ech0 - 24 / 09 / 2020

DHCP Servers

The Dynamic Host Configuration Protocol (DHCP) is a network management protocol used on the IP networks whereby a DHCP server dynamically assigns an IP address and other network configuration parameters to each device on the network in order to allow them to communicate with other IP networks. A DHCP server enables computers to request IP addresses and networking parameters automatically via broadcast packets in order to reduce the need for a network administrator to manually assign IP addresses to all network devices.

Within local networks, the DHCP server assigns a local IP address to each device connected to the network.

Initial Setup

Let's consider the following setup:

now we just leave the computers unconfigured for now, we setup the router's gateway from CLI:


>en
#conf t
#int gig0/1
#ip address 10.10.10.1 255.255.255.0
#no shutdown
#exit
#exit
#copy run start
#exit 

Nothing new here, we've done this in previous tutorials, we get this result:

Then we add the server:

Now here is an important part, the PCs in the network will be assigned IPs dynamically, however we need to make sure the DHCP server has a static IP within the network:



Then we configure it, we simply allow the DHCP server to assign the 10.10.10.2-253 ip addresses. Also note that the DHCP server is going to give the PCs their respective gateways:

Take note here what our network configuration is:

  • 10.10.10.1 /24 Gateway (1 host)
  • 10.10.10.2-253 /24 Devices: (251 hosts)
  • 10.10.10.254 /24 DHCP Server (1 host)

We cannot use the .255 address as it is reserved for broadcast packets.

From there, we set the PCs to have a dynamic IP address (via dhcp of course)

And using the command ipconfig /renew, we can query the DHCP server to give us the new configuration. Normally it is done automatically, however if there is any problem with the computer, you can use this command to actually trigger a broadcast DHCP request from the computer.

We also see it can be done automatically on the other 2 computers, as soon as we enable DHCP mode:

Inter-Network DHCP Requests



Let's suppose we extend our network like so:

Obviously, here we need to enable the other interface of our router so that it can become our other network's gateway:


>en
#conf t
#int gig0/2
#ip address 10.10.20.1 255.255.255.0
#no shutdown
#exit
#exit
#copy run start
#exit 

Which gives us this result:

Now here we need to add another pool in the DHCP server so that it can take care of the 2nd network:

Now let's setup the dynamic configuration on both laptops:

However we have a problem here:

Our laptops are unable to get their configurations from the DHCP server. This is because the broadcast packets are actually stopped at the router's interface, they cannot reach the other side of the router So we need to make sure that these packets can reach the DHCP server from the Router's CLI:


>en
#conf t 
#ing gig0/2
#ip helper-address 10.10.10.254
#ex 
#ex 
#copy run start
#ex

Note that this "ip helper-address" command is available on Routers 2911 and NOT on Routers 2901, make sure you are using the correct router to use this feature. Once that's done, we try to get our laptops to get their configurations via DHCP requests once again:

And we're done ! we have been able to give the DHCP configuration to Devices on both local networks on either side of the router.

3



My Bunker

Some Address 67120,
Duttlenheim, France.

About Ech0

This cute theme was created to showcase your work in a simple way. Use it wisely.