So carrying on with our demo, we are going to configure DHCPv4 on a Cisco router,
and I'm starting off on the Cisco router because A,
it's a lot simpler,
it's really just three or four commands to set up a very basic DHCP server,
but also, a lot of the concepts, all of the concepts really,
will carry over to the Windows DHCP server when we configure that.
So I have the most complex network topology ever built out in Cisco VIRL here,
I have a client that I will be using to request an IP
address initially from the Bridge,
but also once we set up the DHCP Relay Agent from the server over here.
Now I've already configured the server so we won't have
to go through the configuration twice,
but we're going to enter the commands here on the Bridge
and then we will swap the client over from a static IP
address to request a DHCP address,
and we'll look at some of the commands to monitor the DHCP state on the Bridge.
I built the network this way to break the broadcast that you're going to
get from the client to the server here at this router.
The broadcasts won't go across this router because
it's two separate routed interfaces.
So let's go ahead and jump right in.
I will Telnet to the Console port on the Bridge,
and go ahead and go into enable mode.
And the interface that we're going to configure for
DHCP is over here on the 192.
168.
10.
10 network, that is the network pointing at the client.
And right now, the client has the IP address 192.
168.
1.
1, or 10.
1 I should say.
Obviously,
if it's an actual real client we don't want to have
to have a static IP address on it, so let's go and configure the DHCP server.
Go into config mode, and we'll type ip dhcp pool,
and we have to give the pool a name, in this case we'll say that it is ClientIPs.
So now that we're in DHCP configuration mode,
if we hit?, we see all of the options that are available to us,
and not to be confused with DHCP options,
but we see all of the configuration options that are available
to us that are technically also DHCP options.
We have the domain-name and the dns-server,
the address lease time, so on and so forth.
In this case, we will do network, we're going to say 192.
168.
10.
0/24.
I think I have to have a space before that /24.
Yes, it'll also take a subnet mask, which is what most people enter,
but the later versions of the IOS and this viral
router happens to be running IOS 15.
4 I believe, will take a slash notated subnet mask.
We'll go ahead and set the default route to point to this router,
the bridge router,
because the bridge if you remember from the topology
knows every other network on there, it knows about the server and the client.
So we'll say 192.
168.
10.
Again, we'll commonly want to put in domain name, globomantics.
local, and we'll go ahead and set a lease time,
so we'll say lease, and we will say 0 days,
and 8 hours, and 0 minutes.
So now we've done the basic configuration.
We could set DNS servers and a bunch of other options.
Oh,
let's go ahead and talk about the option setting here in the Cisco DHCP server.
So if we type option and we put in the option code,
in this case we'll do option 150,
we're now prompted to give the DHCP server what the value of the option is.
We have the option for an ASCII string, a hex string,
specify the option instance which I've honestly never used,
but it's available to you, and the IP address.
Now again,
different options take different values and if it's a vendor-specific option,
it may take a specially coded value.
As an example,
Cisco wireless controllers have you set a special
option for your wireless access points.
That's a big long hex number that combines the number of access point
controllers along with all of the IP addresses of those controllers
converted to hex and made into one big long hex string.
It's a real pain in the backside to compute this and set it up.
Luckily option 150 happens to just be IP addresses,
so we'll just say ip, and we'll say the IP address of 192.
168.
200.
50 as an example.
And if there's more than one,
we can keep entering as many IP addresses as we want.
Obviously in a real call manager situation you'd
have a publisher and a subscriber, since this is just a demo,
we're going to leave option 150 as it is.
So now that we've set that up,
the next thing you always want to do is set up DHCP
exclusions because if you leave it as it is,
it will give out every IP address other than the interface IP address.
And in most subnets you'll have some reserved addresses for printers or again,
access points,
or some other network device and you don't necessarily want
to hand out every address on the subnet,
you want to reserve some of them in case you need them
for virtual IPs or what have you.
So in this case, we will do ip dhcp excluded,
and from here we put in the beginning IP address,
we'll say 192.
168.
10.
1, and we will say the high IP address 192.
168.
10.
100,
and so basically what that will do is force the DHCP server
to start handing out IP addresses at 192.
168.
10.
101 because we're excluding the first 100 IP
addresses from being handed out via DHCP.
So now that all that's done,
let's go over to our client and configure it to accept DHCP.
So we'll right-click the client here and say,
Telnet to the Console port, and on to Enable mode.
Check our interface just to make sure we're on the right interface,
GigabitEthernet0/1.
So we'll do config t, int g0/1, IP address, and I think you just say DHCP.
Yes, so ip address dhcp.
And if we wait for a second for it to lease an address, and there it is.
Assigned GigabitEthernet0/1, DHCP address 192.
168.
10.
101, as we expected, with the mask 255.
255.
0, and the hostname of Client, which is the host name of the device.
Again, if we do sh ip int br, we now see that it's been configured here,
and if we go back to the bridge, we can do s hip dhcp bindings,
and we see that 192.
168.
10.
101 is leased to this client, one of these is the MAC address,
and that the lease expires on January 24,
2017 at 2:07 pm.
So we'll round out our discussion by talking about the DHCP relay agent,
and quite simply it's an interface level command,
at least on a Cisco router,
and you say any packets received on this particular interface,
in this case it will be GigabitEthernet0/2 I believe,
look at IP interface briefs, yes GigabitEthernet0/2,
will be relayed to the helper address.
In this case, it will be the DHCP server that's on the other subnet.
So what I'll do is I'll pause the video and I'll undo all of my DHCP
configuration on the bridge and shut down the Ethernet interface on the
client so that we're kind of starting at ground zero.
And as promised, I have done exactly that,
removed the DHCP pool and shut down the interface on the client.
So now we're going to go over to the server and verify
that it's actually set up correctly.
So, let's check my work if you will,
so we'll Telnet to the Console Port on the DHCP server,
and we'll do sh run include, or actually we'll do sh run s dhcp.
So here we have the ip dhcp excluded address, 192.
168.
10.
1 to 10.
100 just like we did on the other.
There's the ip dhcp pool clients, it's got a different name.
Again, I could give it the same name,
but I just chose to be different because well,
I wanted to be different.
There's the network 192.
168.
10.
0 with the subnet mask 255.
255.
0.
There's the domain name and the default router for that particular subnet.
Now you'll notice if we do sh ip int br,
that's not actually a local subnet for us.
So if something were to actually make a DHCP request on this particular subnet,
this DHCP server would not service that request because it does not have
a network configuration that would allow it do so.
So now the missing piece in all of this,
if we go to the bridge and we go to the GigabitEthernet0/2 interface,
and the command we're looking for is IP helper-address,
and the destination address for the DHCP helper.
If it were on a different VRF we could specify that it's on a different VRF,
again this not a routing course so we're doing everything in the default VRF.
In this case, we will say that the address is,
and let's check my work before I put it in here,
192.
168.
200.
1.
So I'll just actually copy that out and paste it into the bridge.
IP helper-address 192.
168.
200.
1.
So now if I've configured everything correctly,
when I bring the interface up over here on the client,
it will lease an address from the server across that bridge.
So, cross our fingers, let's see how it works.
Int g0/1, no shut,
and now we wait just a second to see if we actually
lease the address as we expect to.
And we absolutely did, int g0/1 assigned DHCP address 192.
168.
10.
101 with that mask and that host name.
Just to verify, let's go over here to the bridge and do sh ip dhcp binding,
and there's no bindings here,
but if we go over to the server we see that the IP
address comes from the server, sh ip dhcp bin,
and there it is, just as we expect.
And, as a final test, we'll look back here on the client to sh ip ro,
and we see that we're even getting the correct,
well that's actually a static route.
Let's remove that static route and we should learn it through DHCP actually so,
include route.
You didn't think you'd be getting a route and switch exam,
but hey, we always try to give you more for your money here.
I'll just take out this static route,
I had it there to make things work in the absence of DHCP.
So, we'll say conf t, take out that static route like so,
and even though the routes learned via DHCP,
it still shows up as a static route because technically it's
not learned by any other routing protocol.
In theory, I should still be able to ping 192.
168.
200.
1 and I get replies back.
That is how you configure a DHCP server and a DHCP relay agent on a Cisco IOS router platform.