-: Now, at this point of the course, 2 2
we're about to jump into the area that most students dread 3 3
when it comes to networking. 4 4
And this is known as subnetting. 5 5
Now, don't worry, I'm going to get you through it. 6 6
But this is probably one 7 7
of the hardest concepts on the exam, 8 8
you may need to go through this section a couple of times 9 9
to make sure you grasp it. 10 10
Now, what we're going to do is I'm going to go through 11 11
and we're going to do the hard way first, 12 12
so you understand the theory and how it all works. 13 13
Then, I'm going to show you a shortcut 14 14
and how to get through it for the exam a lot easier. 15 15
But please don't skip the next couple of lessons 16 16
of going through the hard way first, 17 17
because if you don't understand the hard way, 18 18
the easy way will make zero sense to you. 19 19
So, as we go forward, we're going to stop and take this lesson 20 20
to talk about computer mathematics. 21 21
Now, this is important because computers do their numbering 22 22
and do math a little bit differently than we do. 23 23
Now, as a kid, you learn to count in what's known as Base-10. 24 24
This is a decimal number, right? 25 25
Decimal meaning 10. 26 26
And so, when I count, you would start at zero, 27 27
and it goes zero, one, two, three, four, five, six , seven, 28 28
eight, nine. 29 29
Now, what comes next? 30 30
Well, we go to the second column, we put a one there, 31 31
and we go back to zero. 32 32
So, now we go from nine to 10. 33 33
And then, we keep counting up, 34 34
and eventually, we get to 98, 99. 35 35
And then go, "Oh, I need another column," 36 36
put another one there and add two zeros. 37 37
That's 100. 38 38
So I go 98, 99, 100, right? 39 39
And that's the whole idea here 40 40
when we talk about decimal, right? 41 41
When we talk about decimal, 42 42
we only have 10 choices for the numbers. 43 43
Each decimal place can only be zero, one, two, three, four, 44 44
five, six, seven, eight, nine. 45 45
Those are 10 options. 46 46
Now, computers and networks 47 47
don't actually understand decimal natively. 48 48
So, even though we've been using decimal 49 49
when talking about IPv4 addresses, 50 50
that's not how computers see them. 51 51
Computers do everything in binary, 52 52
which is base-2 numbering. 53 53
That means, every single digit is either a one 54 54
or it's a zero, that's an on or it's an off. 55 55
That is how computers understand things. 56 56
And so, when they count, they go 011011100111 57 57
and they keep going like that. 58 58
The one zero is actually the number two for us. 59 59
But for them in binary, that is actually a one zero 60 60
and one zero equates to two, because it's the third thing, 61 61
we got to zero one two. 62 62
Now, that's the way this works with a computer. 63 63
And so, we have to understand 64 64
how things are written in decimal 65 65
and how things are written in binary, 66 66
and how to convert between the two. 67 67
And that's what we're going to talk 68 68
about in this particular lesson. 69 69
Now, when we convert from binary to decimal, 70 70
we're going to do this using a table 71 71
that I have here on the screen. 72 72
Each number is a factor of two. 73 73
And so, this way, we can start going 74 74
and putting them as placeholders of one 75 75
or zero as we go through each place. 76 76
So, if we start on the right, and we go left, we have one, 77 77
and then, we have a place of one, right? 78 78
Now, if I put a one zero in the second and first columns, 79 79
this is going to become two. 80 80
And we keep going through as we keep counting. 81 81
Now, if you're not getting it quite yet, 82 82
you will by the end of this lesson, I promise. 83 83
So, let's just keep going ahead 84 84
and we're going to do some examples together. 85 85
Let's say I give you the binary number of 10010110. 86 86
And I asked you to tell me 87 87
what is this if I put it into decimal? 88 88
Well, we're going to first by populating the table 89 89
starting from the right and going to the left. 90 90
And so, we're going to put the number there 91 91
that we have from right to left 92 92
and end up with what you see here on the screen, 93 93
it turns into 1001011, and zero. 94 94
Now, there's a place where there's a one, 95 95
and I'm going to add the number above it. 96 96
So, if I see something like 128, plus 16, plus four plus two, 97 97
and I add that all together, I'm going to get 150. 98 98
That is the number 10010110 in binary, 99 99
and it translates to 150 in decimal. 100 100
You see how easy that is if you have the little chart. 101 101
So, if you make this chart on your paper, 102 102
when you sit down for the exam, 103 103
it's going to make things a lot easier for you. 104 104
Again, going from right to left on the chart, 105 105
each position starts out with the number of one, two 106 106
four, eight, 16, 32, 64, 128, 107 107
we keep multiplying by two as we go from right to left. 108 108
And so, if I added up every single one 109 109
of those with one in it, 110 110
guess what the biggest number I could get is? 255. 111 111
Which, if you remember when I talked about IPv4, 112 112
all my numbers were either zero all the way up through 255. 113 113
That's my four octets. 114 114
Well, that's because I have eight digits 115 115
in each of those octets, right? 116 116
And each digit, each binary digit, 117 117
can only hold a one or a zero. 118 118
Now, what if I gave you a decimal number, 119 119
like from an IP address 120 120
and asked you to convert that to binary? 121 121
Could you do it? 122 122
Well, the answer is yes, 123 123
it's the exact same process we just did. 124 124
So, let's take a number from 167 125 125
and convert it backwards to binary. 126 126
That'd be one of the octets inside of an IP address, 127 127
for instance. 128 128
Well, instead of adding up, 129 129
we're going to to be subtracting. 130 130
So, when I do this, I'll take 167 131 131
and I'll start from the left. 132 132
Can I take 128 out of 167? 133 133
Yes, I can. 134 134
And I'll have 39 leftover. 135 135
Then, I go to the next column. 136 136
That's 64. 137 137
Can I take 64 from 39? 138 138
No, because there's not enough there. 139 139
So, I'll put a zero under the 64 column. 140 140
Then, I'll say, Can I take 32 out of 39? 141 141
Yes, I can. 142 142
And I'll have seven left over. 143 143
So, I'll put one in that column. 144 144
Then. I look, can I take 16 from seven? 145 145
No, so I put a zero. 146 146
How about eight from seven? 147 147
No, so I put a zero. 148 148
How about four from seven? 149 149
Yes, and that leaves me with three. 150 150
Can I go ahead and take two from three? 151 151
Yes, I'll put a one in that column. 152 152
And then, can I take one from one? 153 153
Yes, and I'll put a one down for that. 154 154
And this is how you convert from decimal back to binary, 155 155
you're going to subtract all the way down. 156 156
Just like what I went from binary to decimal, 157 157
I ended up going from decimal to binary, 158 158
I'm going to go ahead and subtract. 159 159
Now, either way, if you have this chart down, 160 160
these factors of two, 161 161
it makes these problems very, very easy. 162 162
So, now that we have that example underway, 163 163
and we see that 167 is actually 10100111. 164 164
How can I check my math and make sure I got it right? 165 165
Well, I can go the other way. 166 166
And I can add up the numbers and they all come back to 167. 167 167
That means, I did the problem correctly. 168 168
So, let's check our answer, 169 169
128 plus 32 plus four plus two plus one, that equals 167. 170 170
That means, we did our math problem correctly. 171 171
Now, in the next lesson, I'm going to give you some problems. 172 172
And we're going to try these together 173 173
and see if you understand these concepts 174 174
because it is really, really important 175 175
as we go into subnetting.