You're probably using it right now.
Don't deny it.
You're probably using DHCP.
If you're watching this video whether it's on a device like this notice using DHCP to connect to the
Internet or perhaps on a computer.
Modern networks rely very heavily on DHCP.
For example, if you go to Starbucks or a coffee shop or you go to the airport it's very unlikely that
you're gonna be walking around saying, what's the IP address that I should be using?
Which IP address should I configure my device as? Very unlikely that you're gonna be doing that.
And the reason for that is IP addresses are more often than not dynamically allocated especially to
client devices.
So here's an example of some client devices, client devices could be PCs, could be Internet or things
devices such as these could be phones. Servers typically have IP addresses configured statically because
you need to connect to that server.
So as an example, if you go to Facebook.com or some other website that domain name needs to be resolved
to an IP address and you need to connect to a specific IP address or range of IP addresses and they
are statically defined but more often than not client devices are automatically configured or dynamically
configured because it's too much work to manually configure these devices.
I mean when was the last time you manually configured your phone with an IP address.
Most of us probably have never done that or only in exceptional circumstances. With Internet or things
devices such as these lights or devices like cameras
it doesn't make sense to manually configure IP addresses. So as an example here's an IP camera
I'm probably not going to configure this device statically.
I'm gonna let it dynamically be configured. Now DHCP or Dynamic Host Configuration Protocol is once
again a fundamental building block in networks today.
Okay, but how does DHCP actually work?
Do you know the messages sent between what's called a client and a server?
Do you know how they work? In this video
I'm gonna show you practically how to configure and use DHCP.
I've got a network here.
I'm going to demonstrate DHCP using a router which I'll configure as a DHCP server.
This is a Cisco router but the same principles apply whether you configuring a home router or some
other kind of device as your DHCP server.
I've got a Windows PC and I've got a Linux PC that are going to get IP addresses from the router
and I'm gonna run Wireshark in this topology to show you how DHCP actually works.
So rather than just talking about it I'm going to demonstrate it.
Here's an example of someone just talking about what DHCP is rather than practically demonstrating
it.
Alexa, what is DHCP? In computer networking the Dynamic Host Configuration Protocol, DHCP,
the network application protocol used by devices, DHCP clients to obtain configuration information for
operation in an Internet protocol network. Okay,
not sure if you understood any of that but there you go.
There's a so-called definition of DHCP.
It's gonna make a lot more sense however if I show you this practically.
Now she did mention some terms there.
So let's look at some of those on this iPhone.
If I go to Settings go to my Wi-Fi network.
So in this example, it's ABC1Top 5 gigahertz
go and look at the information I can see firstly that the address has been allocated automatically rather
than manually boot P is the predecessor to DHCP.
We won't worry about that.
Two main ways to configure IP addresses dynamically or automatically if you prefer that term or statically
where you manually configure the IP address on the device. Notice we have an IP address.
In this example it's 192.165.1.11
we have a subnet mask 255.255.255.0.
We have a router 192.168.1.249 that is also known as the default gateway or the way to get to the
Internet.
So for a lot of people, they don't understand necessarily the technical terms here.
They just want Wi-Fi and Wi-Fi equates to Internet.
So that's obviously not the same thing.
Wi-Fi is the way that we connect to a network using wireless technologies.
The Internet is a totally different concept and I won't discuss that right now.
But basically, the router or the default gateway is the way that you get typically to the Internet. Notice
we've got this option renew lease DHCP IP addresses are typically only allocated for a period
of time. When you configure the DHCP server you as the administrator decide how long a lease is so you
can say it will last for three days or for a week.
You typically don't want to allocate IP addresses permanently even though you can in certain cases because
devices change. As an example, when you go to Starbucks you're not gonna be there permanently you're only
going there for a period of time a DHCP pool or scope typically only consists of a range of IP addresses.
So they may be only 250 IP addresses in the pool or in the scope as people come and go
we want to reuse those IP addresses so we only want to allocate them for a period of time. At Starbucks
or other places they may reduce that interval to a much smaller period of time.
So that addresses are reused more often.
Notice this option configure DNS automatic or manual.
In this example, the DNS server is the local router 192.168.1.249 that could be configured as 8.8
.8.8.
That's a Google DNS server quite a famous one that once again is configured by the DHCP administrator.
So that's an example of DHCP on a client a phone.
We have many devices that use DHCP, IoT, or Internet of Things devices such as these typically don't
get configured statically or manually it's too much work to configure it manually.
You're gonna want to do it dynamically.
This device as an example gives me an indication of the air quality in this room.
So my iPhone using IP is connecting to the information from that device so that I can see how good the
air quality is in the room.
I can talk to an Alexa, Alexa start CCNA quiz.
Welcome to David Bombals CCNA quiz.
I will ask you twenty-four questions try to get as many right as you can.
Just say the number of the answer.
Let's begin.
Question 1 which of the following directions does STP.
Okay, let's play again soon.
So that device has been allocated an IP address by DHCP that's connecting through Wi-Fi, no physical ethernet
cables here to the Internet.
So going to the default gateway.
Okay,
So without further ado, I'm gonna show you practically how to configure DHCP now and show you how it
actually works.
Okay so in this topology I've turned off the windows PC and the Linux host I want to configure the
router first and then once I've configured the router I want to run Wireshark on this link so that you
can see the DHCP message so you can see the entire thing happening. Okay, so here's the router show IP DHCP
let's look at some options binding at the moment there are no bindings we haven't configured an address
pool yet. An address pool in Cisco terminology is very similar to a script say on Windows or another
platform. I'm basically gonna create a pool of addresses and I'm gonna give it a name let's call it PC
this could be any name. I'm gonna specify the network that is gonna be allocated and the subnet mask.
Now don't worry if you aren't used to Cisco commands similar kind of principles apply no matter what
device you're working on.
Here I've got a home router
this is a BT home router.
I'm based in the UK so British Telecom is my service provider.
This is the device that connects me to the Internet.
If I go to advance settings here on this device make this a bit bigger and go to home network and go
to an IP addresses.
What you'll see here is this is the IP address of the router so that would typically be my default gateway
if I connect it to the wireless network or Wi-Fi network on this device.
There's the subnet mask, the DHCP server is enabled and I've manually configured a range of addresses
and I've specified the least time, so least time, in this case, is three days.
Typically a host will try and renew its IP address halfway through the least time.
So that's an example on a home router in this example a British Telecom router on Cisco right as you
typically gonna use the CLI or command-line interface to configure the devices. So the network
is once again this network that's similar in concept to specifying a range of addresses. The way Cisco
could do it is you specify the network and then you specify what's called an exclusion range of addresses
that you want to exclude.
So typically you're going to want to exclude the routers IP address from the pool and perhaps other
network devices that you've got.
Okay,
So default gateway or default router will be the local router.
That's the IP address of the local router.
I'll specify the DNS server as the local router as well.
Now I know that IP address because I've configured this router to use this IP address.
So I've basically configured show run shows me the configuration of the Cisco router I've configured
the Cisco router with a DHCP pool.
This is the network.
This is the default router or default gateway.
This is the DNS server very similar to this being the IP address of my BT router.
This is the subnet mask that's being used and these are the addresses that are being allocated.
Now I haven't specified a least time I could do that.
So IP DHCP pool PC many options are available here.
Many commands can be configured so I could specify lease and then specified number of days if I wanted
to or specify infinite.
Be careful with infinite because you could use up your pool of addresses.
So I'll just specify a lease time of one day I could specify a domain name as an example of let's say that.
So Davidbombal.com
if I go back one step I could say IP DHCP excluded addresses and let's exclude the router from the address
pool.
So on the router show IP DHCP pool I have configured a pool of addresses the pools name is PC
total addresses in the pool is this.
This is the addresses in the address pool.
No addresses have been the least at the moment show run once again shows us that IP addresses in this
range will be allocated but this one won't default router DNS server domain name.
Okay, so let's start Wireshark on the link between the switch and the router.
So Wireshark is running.
I can see various protocols here you can see as an example CDP spanning tree a bunch of protocols but
I'm gonna filter for DHCP because I only want to see DHCP messages.
Okay, what I'll do is start the windows host first.
So this Windows PC is actually running as a virtual machine in my topology.
I'm running on a Mac here.
GNS3 is a way for me to virtualize networks and I'm virtualizing a network of a Cisco router switch
a linux host and a Windows PC.
So PC has booted up, I'll log in. I'm going to start a CMD prompt
and I'll make this bigger so that it's easier to read. So IP config
and I'm thinking Linux there should be IP config not IF config. So IP config notice I can see domain
name, I can see IP address that was allocated. I can see subnet mask default gateway.
Now the reason this PC used that address and not 10.1.1.1 is because that address was allocated
previously and it's just trying to get the same IP address. So IP address has been allocated I can
use the command IP config slash all to see more information.
So scrolling up again there's the command this is the hostname.
Now notice it's called MSEDGEWIN10 that becomes important when we look at the Wireshark capture.
Here's domain name we can see the MAC address of the PC so this is the MAC address burnt into the network
interface card. I could see that as an example by going to control panel, network and Internet view
network status look at my network interface card.
Notice if I click on details I'll be able to see the physical IP address and IP address information
in a similar way to using IP config.
I can also see when I go to properties that I'm using DHCP obtain IP address automatically obtain DNS
server information automatically and using the IP config slash all command.
I can see IP address subnet mask.
Notice default gateway and DNS server information shown in the output here.