Configure DHCP Services

Dynamic Host Configuration Protocol (or DHCP for short) is a network management service that is used to automatically assign IP addresses to devices attached to the network.

The goal of this tutorial is to:

Explain what DHCP is and why we use it
Create a bridge interface (bridge1)
Assign ports 2-8 of the device (ether2 - ether8) to the bridge
Configure an IP address for the bridge interface
Assign DHCP to the bridge interface
Connect a device to any port on the bridge interface, and we should get an IP address assigned to us from the DHCP server.

Why do we use DHCP?

Every device that attaches to our network is going to need an IP address. There are two ways that we can go about assigning an IP address to a device. We can either assign them on the client-end, which means that we have to have the device in our possession, or we can tell our network to assign an address to a client once they join the network. If we assign an IP address to the device from the network side, we can either assign a device a specific IP address to use, or we can configure our network to assign the device the first available address from a pool, or group of addresses we designate.

Sometimes, configuring IP addresses from the client side is impractical. Think of, a college campus, for example where you might have hundreds or even thousands of devices attaching and detaching from a network. Imagine the headache and the logistics of having to physically touch every single device or having to devise some way of instructing the end-user how to configure the device and what if they happen to misconfigure the device? Or imaging having to keep track of assigned IP addresses and knowing which ones are used and which ones are available and making sure that you don't assign the same IP address to multiple devices or if someone misconfigures their end device and uses an IP address that belongs to another device. These two scenarios highlight issues that are mitigated with using DHCP services.

What is DHCP?

DHCP is a service that you establish on your router, that when a device attaches to the network, that device is auto-assigned an IP address from a pool of available address that have been made available. The client only needs to join the network to get the device – there is no configuration on the client side that is needed for this to work. Everything is handled from the network side and assuming the DHCP services have been setup correctly, results in much less work from the network administrators and no work needed from the client.

There are two types of DHCP IP assignments possible. If you assign a device the same IP address no matter how or when the device connects, this is called static IP address assignment, given that the address doesn't change. However, if you simply wish for a client to be assigned an address from a pool of addresses without regard to which specific address, and you do not care if that devices gets the same address every time the device connects, that is called dynamic IP address assignment.

When would you use static vs dynamic IP address assignment. When you have a device that needs to be reachable at the same IP address, you would want to assign that device a static IP address. For example, say you have a printer on the network with an IP address of 192.168.1.10. You would want to make sure that whenever data is sent to that IP address, that the printer is the the device on the receiving end that is responding. You wouldn't want another device on the network to accidentally grab this address, because then jobs sent to the printer might no longer be able to find the printer on the network because its address may have changed. A good rule of thumb is that if you have a device on the network that provides a service and needs to be reachable by other devices, assign it a static IP address. If the device does not need to be reachable by other devices, then a dynamic IP address should suffice.

We are going to configure our router to provide DHCP addresses to clients. Let's start with our previous example.

?
Before we start configuring DHCP services, we are going to expand the number of ethernet ports available on our virtual device. If you are using a physical device to follow this tutorial, you can safely ignore this comment and the next step. By default, when you add a router to your project, that device will come initialized with 2 ethernet ports, ether1 and ether2. We are going to expand the device to 8 ports.