Hey everyone and welcome back. So previously we had just walked through the basic configuration
for a DHCP server. Now I just talked about how we configured DHCP services for a particular
interface in our case it was ENP0S8 which happened to reside on the 10110-24 network. Now as it
transpires anyone within the same network segment that is someone who would be attached via a switch
they could ultimately make requests to this particular server all via a layer 2 connection if
you recall we talked about layer 2 in the LPIC1 certification. So anyone attached here can reach
this server therefore they can make the necessary broadcast requests and can ultimately receive IPs
from this address pool but again let's try to imagine a larger network so let's redraw this
once more. We have our server here this is our Ubuntu machine we'll just say Ubuntu DHCP and we have
our interface card here which is our original ENP0S3 and this has got an IP address of 192.1680.44
in my case and we also added this second one here which is 10113 so we can imagine that we are connected
to another client here okay so over here in fact let me change the color let's say that we have
another machine right here this could be another Ubuntu box for whatever we know let's call this an
Ubuntu client so this Ubuntu client here let's say they've got a network interface here and this
interface here has been manually configured or it did a DHCP discover message and received an IP
address whatever it may be the IP address is within this particular range 1100 so let's just say
the IP address here is 101121 let's say okay cool so we have this connection here now let's add
another server into the mix now let's say over here we have another machine once again and we'll
just call this Ubuntu 3 and it's got a network interface card right here as does this one here
this one also has another interface card and let's just imagine this one was configured I don't know
for let's say 172 16 1.15 let's say with a slash 24 mask so let's say that this device is suddenly
switched on and this device wants to get an IP address for this interface here so this device
sends out that DHCP discover message which we know is a broadcast message so it broadcasts that out to
anyone on the segment now you may recall from our lpik one studies that broadcasts are limited to
the same network they cannot traverse into another network meaning that this broadcast message here
it cannot make its way into this network to ultimately reach this interface here which means
that as it stands right now our poor Ubuntu machine cannot talk to the DHCP server therefore it cannot
be allocated an IP address which is really quite sad for that machine so we absolutely want to fix
this problem so how on earth could we fix this then well let's have a look in fact let me just
connect these together like it's an ethernet connection here is the deal what we want to do
is we want this device here as an intermediary between the potential client and the actual DHCP
server we need this intermediary here to play a role and that role is to really the request that
it will hear on this segment here in fact let me change my color this segment here and it wants to
take that and really that request to the DHCP server so here's what's going to happen then first on
our DHCP server we want to configure another pool so like I say we already had a pool for the 10
110 network and we're also now going to have a pool for this network up here which is going to be
172 16 1.0 slash 24 okay so those two pools will be configured that means we have to add an additional
subnet directive on the server right here that is only one step because like I say we still have
this issue of the broadcast from this device here being terminated right here so like I hinted at
this device here also has a role to play meaning that we want to install some particular software
that is going to transform this server into a DHCP really and then we're going to have a
configuration file on this server here and within that configuration file we can actually specify
where about we should really request to IE we would specify the IP address of this interface
which is the IP address of this server here so pretty much when anyone sends a DHCP request
we know we can relate to this device here or this interface on this device so now here is what is
going to happen this device here sends a broadcast message shouting to anyone on the segments hey I'm
looking for a DHCP server this reaches this interface here and this client recognizes this client goes
hey on my interface here which is configured on the 172 16 1.0 slash 24 network I am receiving
a broadcast message for DHCP services I am configured as a DHCP really so I know where to
send that request I send it to this IP address here so now that broadcast message is being transformed
into a unicast message directly to this IP address and it's received right here so now this particular
server has some interesting information it knows it's getting a DHCP request and the DHCP request
is coming from this IP address range this network here okay because it came in on this interface here
now the DHCP server checks its DHCP pools and it notices that it does actually have IP addresses
within this range remember the DHCP server is configured for this range which doesn't match
but the second range where it's configured for the second pool this one does indeed match so we can
now say hey by the way here you go let me pass this on this DHCP offer which is going to be relayed
once again through the relay server and back to this client all the way over here and this client
can just as you expect it can accept to decline this offer so it can send a request so the request
can be relayed and then everything can be acknowledged just as the way it was so even though this server
is ultimately isolated in a completely different network this intermediary right here is just allowing
us to relay that information to the server and as long as a server has that address pool it can
actually provide services to devices which are crying out for broadcasts within this network
segment right here so this can definitely be a little bit confusing when you first hear about
it but this is ultimately the process in action so what I want to show you is the general configurations
that we would go through to make this happen if we happen to be configuring this on a real live
network as opposed to a virtual simulation here so what I have to do of course is I have to go on
to my DHCP server I have to add in this additional pool which is not on my network segment here it
is a completely different pool to anything we are connected to and then on my client right here I'm
going to install my DHCP relay service and I think you will be surprised despite the perhaps complex
logic or theory in play here the actual configurations really are quite simple so with that said now
that we know what is happening under the hood let's see it in practice then shall we okay so let's go
back onto our server right now and I will do sudo nano I'll go into the xe directory my DHCP
directory and again I will go into DHCP dot conf so I'll type in my password so let's scroll on
down and let's add another network so let's say subnet so the network we're going to serve is 172
16 1.0 and the network mask is going to be for a slash 24 and the range let's just give it a range
from between 172 16 let's say 1.25 maybe all the way to 172 16 1.200 okay and we'll have our semicolon
and we'll say option Ritters we can add a default gateway let's just say the default gateway is going
to be 172 16 1.15 and we'll just do the same configurations default least time 2000 max least
time 5000 add the domain name and domain name servers this one can maybe be 8.8.8.8 add our
semicolon and same here and we'll close this off so now we have that configured let's just save
this right here meaning that if we happen to get a request sourced from anyone within this network
range we're going to actually pull from this address pull right here that will be our offer from
within these ranges with this additional information as we can see here okay so let's save you and what
I'm now going to do is I'm going to go on to another machine here so if I just minimize this I'll just
use another Zubuntu machine here which can act as my relay agent in this scenario okay so let's go to
the terminal emulator let's do an ip adder so I have my enp0 s3 with an automatically configured
ip address via virtual box let me just change this for now I will say sudo ip add and I will add
let's use those numbers in the description I did 10 11 21 slash 24 and make this on dev
enp0 s3 type in my password to an ip adder and let's remove the 192 168 0.70 so let's check this now
cool so we only have this ip address here let's configure the enp0 s8 interface so I'll say sudo
ip add and I'll add 172 I think I said 16 1.15 slash 24 and I'll make this on enp0 s8 to clear the
screen and I'll say ip adder so just so you can visualize so let's pretend this is our relay
server right here and here is our DHCP server pretending these are connected via ethernet
this interface here can be the enp0 s3 which is this one here that's on the 10 110 network and
this interface here is going to be this one here enp0 s8 and that's being configured for 172
16 1.15 which is on the 172 16 1.0 slash 24 network so we have these interfaces both configured
and we are imagining some type of new server happens to connect looking for an address it's
going to send out this message here a broadcast looking for DHCP servers now we want to install
the DHCP relay server so what we'll do here is I will say really quite simply sudo apt install
isc DHCP hyphen really if I hit enter and I say yes open I've just realized because I changed the
ip address configuration I actually can't reach the internet anymore so let me just quickly change
that back so let me just add this back once again there we go I'll just do the app update I can now
reach the internet once again apologies about that and now I'll try installing that once again
so I'll say yes and as we can see here it's going to ask us to enter the ip address of the DHCP
server that we should actually send these requests to so I believe the ip address we said in the example
was 10 113 let's say okay and the interfaces that should be listening that will be enp0 s8
and I will say okay and if we want to add additional options we can do so but for now I'll leave that
blank now that should be our configuration in play if we wanted to modify this configuration we could
go into the etsy directory and then into the default directory and then isc DHCP relay if I hit enter
type in my passwords we can see here which server we should actually send the relay to this will be
the ip address of my DHCP server on my original Ubuntu box and this is the interface on my machine
right here for where I am listening for those DHCP broadcast messages so if we wanted to change
these server addresses or these interfaces you could easily modify this within this configuration
file right here so now with that said if that client happened to send out a broadcast message it would
be heard on this interface and forwarded to this address on my server and here is my server right
here with this ip address and as we know within my DHCP configuration we would actually have a
suitable range for that request so I know that was a lot to deal with but it really is important to
understand the fundamentals of what is actually going on under the hood with respect to our DHCP
relays so if you find it a little bit confusing then definitely I would advise you to watch the video
one two three more times just to solidify the concepts within your head but for now that is
us for DHCP relays I hope this has been informative for you and I'd like to thank you for viewing