What DHCP is all About | Network Fundamentals Part 16

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] office networks often have many devices and with that comes many IP addresses we don't want to manually configure every single device with its own IP address though we also don't want to reconfigure every phone tablet and laptop as they roam through the building the solution then is to automate the process of handing out IP addresses this is what a DHCP server can do for us so we're going to see how it works and how its configured think of a computer that's turning on for the first time it won't have an IP address a DHCP server can help with this but our new computer doesn't know where to find it so it creates a special DHCP discover message it then broadcasts this message out to the network this message contains the computers MAC address regular devices will see the packet and ignore it DHCP servers on the other hand will be very interested the DHCP server contains a database or pool of IP addresses that are valid for the local network so when it receives the discover message it knows that the new computer needs help it looks in the address pool it finds an available IP and it temporarily reserves it it will then put this information in a DHCP offer message and send it back to the client sometimes this is sent as a broadcast and sometimes as a unicast message the reason why is be too complicated to go into now v4 interested in finding the answer yourself have a look at RFC 21 31 what happens in a case like the one we're showing here where there is more than one DHCP server while the client will get more than one offer so in our example a client has received two offers it will select one and formally ask permission to use it by broadcasting a DHCP request message the server finishes up the process by sending a DHCP acknowledgement message to the client this is where the server officially allocates the IP address the client is now free to use the IP and any other information that the server may have given it we'll cover the extra information soon requesting an IP from a DHCP server is a full message process if you want an interesting way to remember this process just think of Dora the Explorer we've been talking about a dynamic allocation of IP addresses we also have the option of a static allocation this is also called a reservation this is where the DHCP server is configured to give a specific IP address to a specific client the client is identified by its MAC address so when the discover message comes in this server sees the clients MAC address knows that it's meant to give this particular client a special IP and puts that IP into the offer message there are a few cases where you might want to use this but they're not too common see if you can think of a few cases where you might want to use this feature and put them in the comments when a DHCP server sends the offer message it will also send a lease time this is the time for which the IP address is valid Windows servers for example will offer a lease of eight days by default cisco dhcp servers on the other hand have a default of only one day of course we can set these values to whatever we need them to be by the way if you're interested in digging deeper into the DHCP message format I'll put a link in the description that you can have a look at if the lease were to expire the DHCP server will put the IP address back into the available pool the alternative is that the client may want to renew the lease it will attempt to do this halfway through the lease period so with a Windows Server for example the client will try to renew after four days the server will try to be nice to the client it will try to let it keep the IP it already has however there is no guarantee so the client may end up with a completely different address a client may choose to send a release message to the DHCP server saying that it's finished with using this IP this is not a requirement though so it's completely ok if the client doesn't give the IP back when it's done if you're working with Windows he is an issue to be ready for sometimes a Windows machine will have an IP address like this one starting with 169.254 this is called an apipa address and usually happens when this machine could not get an address from the DHCP server to force Windows to try again we can run IP config /u often we use the release and renew commands together this is useful for example if we have updated our DHCP server with some new information and we want the client to get a fresh IP but DHCP servers aren't just good for handing out IP addresses they can also hand out extra pieces of information called options there are many different options that can be configured but there are a few common ones we should discuss the router option gives the client the IP address of the default gateway the DNS server option tells the client about DNS servers on the network we're going to talk about DNS servers in the next video the domain name option tells the client which domain it's a part of for example Network Direction net this is quite important in Windows environments and finally the TFTP server option gives the client the IP address of a local TFTP server we won't get too deep into TFTP but this is a server that transfers small files for example we can backup our switch and our router config files to a TFTP server this is critical though when you have phones on the network when the phone starts up it gets an IP address and TFTP server addresses through DHCP and that's where it downloads as config files from well we've gone through quite a bit so far you can use these questions to see if you've understood what we're talking about we've seen that the DHCP process starts with a client broadcasting a discover message can you see the problem that we could face here broadcast messages are only useful on the local land segment this is because routers do not forward broadcast messages when a client broadcasts the discover message it will not reach the DHCP server so when we have several LAN segments in our network how can we provide DHCP services to them all well one option is that we can put a DHCP server in every LAN segment or maybe we could give our DHCP server a network card that connects to each LAN segment and we might do this in some parts of our network but that adds up has a lot for us to manage the simple alternative is called a DHCP relay where you can configure an interface on a router to act on the DHCP servers behalf when a client broadcasts a discover message the message reaches the router that is configured as a DHCP relay the router is configured with the IP address of the remote DHCP server so the relay will then send the message directly to that server the server responds to the message by sending the offer to the router the router then forwards this on to the client this is a very efficient method as we can have a server with all the DHCP configuration in one single place you will regularly find DHCP servers running on Windows so I'd like to give you a brief look and how its configured here here we have the DHCP console just after the DHCP role has been installed we're going to create a new IP v4 scope the scope is just the windows name for the DHCP pool naturally Windows has a wizard for this and we start by giving our scope a name next we configure the first and last addresses in the pool as well as a subnet mask usually we don't want to hand out all addresses in the range so now we can configure exclusions these are the IPS that we don't want handed out dynamically and now we can configure the least time by default this is eight days on Windows but just for fun we'll set this to four days we can now configure extra options that we can hand out to the clients so we might as well do that now first we configure the default gateway this is the router option now the domain name and DNS servers there's Adina server in here by default but we can add more if we want our DHCP server will try to contact the DNS server to confirm it's up it's not available from our lab environment but it still lets us add it if we want as this is a Windows Server we can add wins servers if we want to this is a relic of the old days and for most part we can completely ignore this now and finally we can choose to activate the scope now or later so why not now inside the scope we can see the address pool and in here we can see any leases this is any IPS which have been handed out to our clients our server hasn't handed any out yet we can also create a reservation if we want this as we discussed earlier is if we want to reserve a particular IP for a particular device for this we need a name an IP address and a MAC address and it doesn't look like Windows likes the format that I'm using so hang on a sec let's try a different format it doesn't like that either it looks like it just once letters and numbers which guess that's fine I suppose and finally we can see the scope options that we configured earlier now let's try and make this more interesting and we'll try to configure this on a few Cisco routers here we have a small topology with two networks two routers and two workstations our one is going to be our DHCP server and it will need to hand out an IP address to workstation one workstation 2 will also need an address but it's on a different subnet so we're going to have to configure our two as a DHCP relay so let's start by configuring our 1 the first thing to do is to define a pool with IP dhcp pool and then give it a name this is exactly the same as the scope we saw earlier on the windows server the next part is to configure the network this is the network address and subnet mask that makes up the addresses in the pool we can't configure a specific start and end address like we did in Windows the default router is the IP address of our default gateway so we'll choose 1 7 216 10.2 and next the lease will choose 4 days in our example the domain name is quite self-explanatory as is the DNS server the next server is a bit more interesting and its function may not be immediately obvious this is used to configure a TFTP server which we talked about earlier so this is the part where you need if we want to give phones their configuration files automatically and that's it for the pool itself but there is still something else we need to do and that is to tell the router which IPS would not be given out using the IP dhcp excluded address command we need to take care not to allocate an IP address for anything as static like our routers IP address if we don't think about this we face a potential IP conflict so if you have servers and Printers with static IPs make sure you exclude these IPS from the pool now we should test it out on workstation 1 usually a workstation like this would request an IP address while it's booting in this case though the workstation already booted before DHCP was configured so we'll use the d.edge client Linux command to request an IP address the - V gives us more information so we can see the entire process interestingly the request and offer are displayed in a different order here but we can still see that we're being given an IP address and we can see the server that gave it to us now are you ready for something really interesting back on the router we have a console message which says that there has been an IP conflict the router tried to give out 170 to 1610 - but this is already in use by r2 fortunately the router was able to detect this and give out a different IP address instead it's great than our one discover this automatically but we could be in trouble if for example r2 had an ACL that blocked lots of different traffic types if our one cannot detect that there's a conflict we would definitely be in trouble so we're best off adding this IP address to the excluded address range we need to configure a pool on our one and we need to configure the DHCP relay on our two we'll stick with a very simple pool in this case this shows that most of the configuration we used earlier is optional now to configure the relay on a Cisco router we use the IP helper address command and we use this on the interface that will be receiving the discover messages if we try the same command on workstation two we can see that this is also successful notice that the offer seems to be coming from our two and not our one that's because it is making the offer on our one's behalf there are three verification commands which are very useful especially if you have troubles getting DHCP working firstly is the show IP dhcp pool this shows Paul statistics including pool size and how many IPS have been allocated it is possible to run out of IPS so keep an eye on how many IPS are left next we have show IP dhcp binding this shows a list of each IP address that has been allocated let me just make this window a touch bigger so it all fits in a little better and here we can see the IP address that has been allocated the MAC address it lines up to and the date that the lease will expire and finally we have show IP dhcp server statistics this one is very useful for detailed troubleshooting we can even see the message types and how many have been sent and received and here are two more questions for you to test your understanding on of course you can have more complicated DHCP deployments so I don't recommend trying it out in lab if you can you'll see windows used as a DHCP server frequently so try to give that a go too in the next video we're going to discuss the domain name server also known as DNS I hope to see you there
Info
Channel: Network Direction
Views: 30,296
Rating: 4.9746299 out of 5
Keywords: Dhcp, Dynamic host control protocol, Network direction, DORA, Discover, Offer, Request, Acknowledge, Ip address, Mac address, Dyanmic, Automatic, Windows, Dhclient, Ip helper-address, Broadcast, rfc 2131, Pool, Scope, Static, Reservation, Lease, Renew, Apipa, 169.254, Ipconfig, Release, Options, Tftp, Next-server, Relay, Ip dhcp excluded-address
Id: zPFgFvDHbA4
Channel Id: undefined
Length: 16min 7sec (967 seconds)
Published: Tue Sep 03 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.