Hey everyone and welcome back. Now previously throughout this skill we have been primarily
focused on DHCP from the point of view of assigning addresses from a particular range.
That is if someone happens to request an IP address they get it from that range but it
could be anyone from within that range. No one is guaranteed a particular IP address.
Now I did hint at the start of this skill with respect to things like servers on a network
or maybe things like printers. These external devices which are used by other clients within
the network very often we want to have some type of predictability about these IP addresses.
So in this case it does actually make sense that we do have some type of static configuration
such that when these devices come back online they just reach out with a broadcast address
and they can get the same IP address no problem at all. So let's dive in and see how we can
actually do this configuration directly within our DHCP.configuration file. So what we'll do
here is we will go directly back to that file and I will say sudo nano xa dhcp dhcpd.conf
and in we go. Okay so let's scroll on down then. So under our subnets what I'm going to do here is
not use the subnet keyword I'm going to use the host keyword so I'll say host and now I'm going to
give this host a particular name. So let's just imagine that my other Ubuntu machine was acting
as a web server as well okay. I'll just say web server and now what I will do is I will open my
curly brace and then what I'm going to say here is I'm going to say the word hardware and now I'm
going to specify the actual layer 2 MAC address for that particular device because you may recall
the layer 2 address is a physical address that is actually on the network interface card for that
device whereas an IP address is a logical address which is assigned and not particular to the machine.
So if we go back to this machine that we want to give a static IP address to so I can say IP link
to show all my layer 2 information. So let's say we wanted to give this interface here the same IP
address what we would do would take note of its MAC address which is this right here meaning that if
we get a broadcast from this interface the DHCP server will note the MAC address here
and it's going to give it the exact same IP address every single time. So let's try that out then.
So I'm going to say hardware ethernet and now what I'm going to do is to specify that MAC address
I just saw there so that will be 80 colon 00 colon 27 colon D0 colon FE colon E2. So what we're saying
here is if we get a request from an interface which has this particular MAC address we're going
to give that interface a fixed address okay so remember this keyword here and now we specify
what is the fixed IP address so we could just maybe say 172 16 1 dot I don't know 4 let's just
say whatever it may be and I will do my semicolon and then my curly brace so there we have it.
So that would mean if that computer went offline and it suddenly came back online and it sent a DHCP
discover request from that interface we would match on its MAC address and send this particular IP
address now we could shut the machine off we could restart it multiple multiple times every
single time that machine comes back online that interface is going to get this IP address so really
once we've done that we can just save our configuration and all we would have to do would be to restart
our server so those systems CTL restart isc DHCP server and to enter and those new configurations
would take place so now one final thing which I just want to briefly draw your attention to that
you should be aware of for the purposes of the examination is that with respect to our DHCP
configurations much of what is going on is going to be logged now we have to know the location of
where we can find our logging messages now this will vary depending on the system you happen to be on
if you happen to be on a red hat based system this is going to be found very likely within the var
directory and then within the log sub directory and then within here we should have a file called
messages inside here you should find all that type of you know that Dora discover offer request
acknowledge as well as a whole bunch of other DHCP related information however if you happen to be on
an Ubuntu based machine that would be in the var directory within the log directory and it should
actually be in something called daemon dot log for Ubuntu machines this should actually be where
you find those DHCP log messages and that really is all we have to do with respect to our static
host configuration via DHCP we take a note of the hardware address and then we specify that fixed
address that we want to bind to that hardware address and suddenly those DHCP offer from the
server are going to be very consistent offering out the same IP address to the same interface very
very handy like I say when dealing with servers and printers in particular okay doc so I hope
this has been informative for you and I'd like to thank you for viewing