1
00:00:00,000 --> 00:00:18,080
Hey everyone and welcome back. Now in the previous nugget we had discussed the very basics around

2
00:00:18,080 --> 00:00:25,440
the dynamic host configuration protocol. Now we learned that we would have to invoke a DHCP server

3
00:00:25,440 --> 00:00:32,160
in order to hand out the IP addressing to our client network. Now in this nugget right here

4
00:00:32,160 --> 00:00:37,679
that is exactly what we're going to be focusing on. We're going to be focusing on the DHCP server

5
00:00:37,679 --> 00:00:44,799
component of this interaction. So with that said how about we dive in and begin the configuration

6
00:00:44,799 --> 00:00:51,680
then. Now the very first thing that we want to do is we want to install a DHCP server. So what I'm

7
00:00:51,679 --> 00:01:02,399
going to see here is sudo apt and I'm going to say isc-dhcp and then hyphen server. If I hit enter

8
00:01:02,399 --> 00:01:09,120
in fact I should actually say apt install getting ahead of myself as per usual so that looks a

9
00:01:09,120 --> 00:01:15,280
little bit better let's hit enter I'll type in my password okay perfect I'll say why hit enter

10
00:01:15,280 --> 00:01:19,840
and the installation should complete. Great so what I will do is I'll clear the screen.

11
00:01:19,840 --> 00:01:26,960
Now the first thing to note is that when we install this server package there is going to be a DHCP

12
00:01:26,960 --> 00:01:33,280
configuration file. Now depending on the distribution that you have this may be in a different location

13
00:01:33,280 --> 00:01:41,120
you may find it in the etsy directory and directly within that you may have a file called DHCP-d

14
00:01:41,120 --> 00:01:48,400
for the DHCP daemon and this will be .conf. Conversely you might actually have within the

15
00:01:48,400 --> 00:01:57,680
etsy directory another directory called DHCP and then within that directory have a DHCP-d .conf.

16
00:01:57,680 --> 00:02:04,240
So really depending on the distribution you may or may not have this sub directory here. Now

17
00:02:04,240 --> 00:02:09,680
another important configuration file we want to know is going to be within the etsy directory

18
00:02:09,680 --> 00:02:16,400
and then within here the default directory and within that directory we should have a file called

19
00:02:16,480 --> 00:02:26,400
isc dhcp-server. Both of these configuration files are going to be important for us so let's go and

20
00:02:26,400 --> 00:02:32,560
check these out then the first one we will check out is going to be the dhcpd .conf file so let's

21
00:02:32,560 --> 00:02:38,879
go there then. Now on my distribution I happen to be in the configuration file resides within

22
00:02:39,439 --> 00:02:47,439
and within the sub directory DHCP within here as we can see we have this dhcpd .conf if I happen

23
00:02:47,439 --> 00:02:53,840
to open this one up and I hit enter now you will recall that when we discussed DHCP in the very

24
00:02:53,840 --> 00:03:01,039
first nugget we learned that DHCP can also handle DNS based information so this is what we're going

25
00:03:01,039 --> 00:03:07,280
to be able to specify right here so we can see here the option domain name in this case we have

26
00:03:07,360 --> 00:03:14,960
example.org I can maybe change this to let's just say the domain name was CBTNuggets example.com

27
00:03:14,960 --> 00:03:21,199
whatever it may be and then I can specify the option domain name servers in this case here I

28
00:03:21,199 --> 00:03:29,439
could just hand out let's maybe say google's public DNS which would be 8.8.8.8 and then we can specify

29
00:03:29,439 --> 00:03:37,280
a default lease time now we can see here that this is 600 that is 600 seconds this ultimately

30
00:03:37,280 --> 00:03:46,719
translates to 10 minutes now we also have a max lease time this is 7200 seconds i.e. two hours

31
00:03:46,719 --> 00:03:54,879
and if I scroll on down we have this option here ddns update style so with respect to DHCP we have

32
00:03:54,879 --> 00:04:02,719
the option for our DHCP servers to participate in updating our DNS zone file records in the case

33
00:04:02,719 --> 00:04:09,519
here this option is specifying the value none i.e. we do not want to attempt to do any type of

34
00:04:09,519 --> 00:04:17,040
updating for our DNS servers now if we scroll on down once again we come here to our subnet

35
00:04:17,040 --> 00:04:22,560
directive we see this right here now this happens to be all commented out so it's not actually taking

36
00:04:22,560 --> 00:04:29,680
effect but we can create our own range that will take effect so what I will do here is I will use

37
00:04:29,680 --> 00:04:35,519
keyword subnet and then I will specify a particular subnet so let's maybe say that we're going to have

38
00:04:35,519 --> 00:04:44,319
a DHCP server that is going to hand out IP addresses within the 10.1.1.0 range and we'll have the subnet

39
00:04:44,319 --> 00:04:52,639
mask of slash 24 which is 255 255 255 0 and then we can do our curly brace so what we're specifying

40
00:04:52,639 --> 00:05:00,000
here is the network which is going to be 10.1.1.0 slash 24 and then within here we want to specify

41
00:05:00,000 --> 00:05:06,159
the actual range of a loud host that we can give out so I could say 10.1.1 and then let's maybe start

42
00:05:06,160 --> 00:05:14,480
from IP address 20 and we will go to 10.1.1 let's maybe say 100 so that is all we're going to be

43
00:05:14,480 --> 00:05:20,960
giving out the very first client that requests an IP address they will get 10.1.1.20 the next one

44
00:05:20,960 --> 00:05:28,560
will get 21 the next 22 all the way up to 100 in which case after that our IP address range will be

45
00:05:28,560 --> 00:05:34,240
exhausted so what we want to do here is to have a semi colon and now what I'm going to say here is

46
00:05:34,240 --> 00:05:41,040
option or routers and what this is going to do it's going to allow us to specify a default gateway

47
00:05:41,040 --> 00:05:46,079
so let's imagine that the default gateway happened to be the very first address within this range

48
00:05:46,079 --> 00:05:53,040
so that would be 10.1.1.1 and then I can do my semi colon and then my curly brace and what we've

49
00:05:53,040 --> 00:06:01,759
done here is create a simple DHCP pool like I say this is the network we are targeting anyone

50
00:06:01,759 --> 00:06:07,920
who wants an address can get the IP addresses from 20 all the way up to 100 and when they make

51
00:06:07,920 --> 00:06:12,319
that request they will also be given their default gateway information of the very first

52
00:06:12,319 --> 00:06:18,879
address within that network 10.1.1.1 now you can actually specify more information right here we

53
00:06:18,879 --> 00:06:24,719
could maybe say you know the default lease time we could have a very specific lease time for this

54
00:06:24,720 --> 00:06:31,520
particular range so we could maybe say 2000 seconds and the max lease time could be maybe say 5000

55
00:06:31,520 --> 00:06:38,560
seconds and if we wanted to have different domain name configurations for this particular pool we

56
00:06:38,560 --> 00:06:45,440
could say option domain name and let's just say the domain here for this one was ipv0.org in fact

57
00:06:45,440 --> 00:06:51,440
I'm forgetting my semi colon here just notice that and in this case here we will say option

58
00:06:51,439 --> 00:06:59,839
domain name hyphen servers and we will give this a different ip address of 8.8.4.4 and

59
00:06:59,839 --> 00:07:05,360
semi colon now there definitely are more configurations that we can change and configure

60
00:07:05,360 --> 00:07:11,040
within this particular file we can do things like static host configuration but for now

61
00:07:11,040 --> 00:07:17,360
that is all we're going to focus on and in fact before I actually even do anything I've just noticed

62
00:07:17,360 --> 00:07:24,960
a very big error on my part before we actually specify the range of ip addresses i.e. this range

63
00:07:24,960 --> 00:07:30,000
right here I actually need to prepend this with the keyword range so this is very very important

64
00:07:30,000 --> 00:07:34,720
just as well I caught that there just remember to do that don't make the same mistake as me

65
00:07:34,720 --> 00:07:40,480
otherwise the configuration will absolutely not work so with that said this should be a valid

66
00:07:40,480 --> 00:07:46,000
subnet configuration and so what I'm going to do is I'll save this and I will exit out we can see we

67
00:07:46,000 --> 00:07:52,000
already have an interface here with an ip address in this case so I have added another ethernet

68
00:07:52,000 --> 00:08:00,319
interface to my device enp0 s8 if I wanted to listen on this interface for devices requesting

69
00:08:00,319 --> 00:08:06,800
dhcp information I could actually specify that I want to listen on this interface and I would do

70
00:08:06,800 --> 00:08:15,360
so within the etsy in fact the better say sudo nano the etsy directory default isc dhcp server

71
00:08:15,360 --> 00:08:21,280
now within here down at our interfaces I would just specify the name of the interface in which I

72
00:08:21,280 --> 00:08:29,040
want to listen so that would be enp0 s8 and conversely if I wanted to have a dhcp version 6

73
00:08:29,040 --> 00:08:35,519
server that is handing out ipv6 addressing then I could also specify that too but in this case here

74
00:08:35,519 --> 00:08:42,159
I will just leave it at v4 so if I save this so if I just happen to open the file once more for

75
00:08:42,159 --> 00:08:49,519
our main configuration there we go remember our subnet range is in the 10110 network so what I could

76
00:08:49,519 --> 00:08:57,679
do is I could say sudo ip adder and I could add the network of 1011 and give my interface an address

77
00:08:57,679 --> 00:09:07,759
of maybe say 3 slash 24 and I'll put this on dev enp0 s8 and if I do an ip adder we can see this

78
00:09:07,759 --> 00:09:13,679
interface here has an ip address within this particular range so what could now happen is if

79
00:09:13,679 --> 00:09:20,000
I draw my little server here this is my ubuntu machine which is now a dhcp server I have my

80
00:09:20,000 --> 00:09:27,840
interface here which is enp0 s3 this ultimately connects to the internet and I now have another

81
00:09:27,920 --> 00:09:37,680
interface here which is enp0 s8 and this has got the ip address of 10113 so now if anyone

82
00:09:37,680 --> 00:09:43,280
happened to be connected on the same network here let's imagine we had a switch and a whole

83
00:09:43,280 --> 00:09:48,879
bunch of different client computers all connected if on that same network segment someone sends out

84
00:09:48,879 --> 00:09:55,519
that broadcast address trying to discover a server we could then reply with an offer within our

85
00:09:55,519 --> 00:10:01,519
particular pool and that client could either accept or refuse that offer and that really is

86
00:10:01,519 --> 00:10:07,519
the basics of what we want to understand for the purposes of our dhcp configurations we have that

87
00:10:07,519 --> 00:10:14,000
main configuration file whereby we can specify our leases we can specify our dns server configuration

88
00:10:14,000 --> 00:10:19,759
we want to hand out the default gateway configuration as well as the network we are serving and the

89
00:10:19,759 --> 00:10:25,519
valid range of addresses we want to serve out and we also have that additional configuration file

90
00:10:25,519 --> 00:10:32,240
which specifies which interface we want to be listening on for incoming dhcp requests in this

91
00:10:32,240 --> 00:10:39,679
case here we're specifying enp0 s8 but notice here that this is all revolving around devices

92
00:10:39,679 --> 00:10:45,120
within the same network here so all these devices here are connected on the same network segment

93
00:10:46,080 --> 00:10:53,120
what would happen then if we happen to have a server on a completely separate segments from

94
00:10:53,120 --> 00:10:59,120
a potential client that would want to use its dhcp services well the reality is we do have a solution

95
00:10:59,120 --> 00:11:03,600
for that that's called a dhcp really and that is what we're going to be talking about in the very

96
00:11:03,600 --> 00:11:14,960
next nuggets i hope this has been informative for you and i'd like to thank you for viewing

