All right, so in the last lecture, we talked about the network layer, the data like layer, you learned
about Mac addresses and the importance of the different jobs that are necessary in order to deliver
frame or even a packet end to end.
Now we're going to dig into something.
And, you know, something really freaks a lot of people out because there's a lot of perhaps it's a
lot of steps and it doesn't really seem relevant.
Like who said.
That's right.
You just go online and type in an IP address and get the subnets that are inside of that particular
address as an ethical hacker, a penetration test or whatever, you absolutely need to know how to subnet
because you need to know which network you're on.
You need to know if you're in scope.
And also it'll help you determine to help you sort of diagnose why a particular connection is failing.
Maybe you're trying to pivot to another system in the target users environment.
And it's felt like for some reason that could be because they're on another network or VLAN or even
a private plan which has different controls and technical restrictions in place, which is preventing
lateral movement.
So let's just get right into this.
And I think the easiest way to get into subletting is just to look at an IP address.
OK, so we open a command prompt.
I just typed IP config and you can immediately see this beautiful trifecta.
Right.
So for Ethernet zero, which is my current Ethernet adapter, here's my IP address.
Ten three zero thirty four is my subnet mask.
In his malleefowl gateway, OK, we're going to get into what this means in detail, but Ticino just
off the top, this mask is really, really important because it tells the computer when it's time to
send a packet to the default gateway.
It tells the computer basically which network a particular asset resides on, you know, if you try
to ping a host that is in a different network, then it's going to have to go to the default gateway.
So the default gateway getting a look at its routing table and try to figure out which interface it
put forward that frame out of in order to get it to the next top.
So I know that sounds a little bit confusing.
A mysterious let's just get right into this and how is all this stuff works.
So let's just draw this IP out.
Got 10.
Dot three, dot zero, dot thirty four.
OK, and this is how we see it, right?
These are how this is how humans see IP addresses as a human.
We see this number.
Right.
And that's not exactly how the computer sees it.
The computer doesn't see a decimal number like this.
The computer sees a binary number.
And so you need to understand what these numbers are like in binary.
But before you can do that, you need to know the place value.
So an IP address consists of a bit, which is either on or off.
And there are eight bits in a bite.
This is one bite.
Is another bite.
Four bites.
Tasty.
All right.
So it's actually a bite.
B, why t eat a bite?
That's the correct way to refer to it.
Then you really need to know here is that this bite is represented in binary with various place values.
So what you have actually is you have a one place, you have a tooth place, a four eight.
I'm just doubling it.
16, 32, 64.
One eight, OK, and these are the place values.
That all the bits will fit into.
Make a little table here.
So what we can do is we look at each one, let's start with zero, because it is the easiest to understand
zero in binary, it's just zero zero zero zero zero zero zero zero.
Right.
I mean, there should be no surprises there.
That's why I actually started there.
Now, what about the number 34?
What would that be?
Number three for us?
A little bit different.
So we need to do is we need to convert this number to binary to see it's 34 right there.
No, 128 and 34.
There are no 64 and 34.
There's 132.
So now that means there's just two left, there's no sixteen's and two there's no eight and two there's
no four and two and there's one two into this number is 34 and binary, OK?
And that's what the computer sees with its last octet.
And of course, you have the number three, but you can see these last two bits, some to make three
to one plus two or three.
So that's number three.
And very and then lastly, you have the number 10.
And you can just add eight plus two to make ten.
And I feel the rest of my Xeros.
So now that we figured all this out, we can actually trace this all and show you what it looks like,
a Pinery.
Right.
So we figured out, Tim.
We figured out three.
We could have zero.
And finally, 34.
And by the way, while I'm doing this, I'm counting in my head, I'm saying 128, no.
64, no.
32, yes, 16 no.
You know, when I say 32, that means only two.
Left, right.
So I'm saying how many sixteen's are in it to none?
How many eights are in it to none?
How many forces are in it to none?
How many twos aren't it to one?
Nothing less.
So that should be this number in binary.
And what we can do is check it just to open up the calculator.
Right.
So I can go down here.
What I'll do is I'll change this into.
And Billy Programer does it, yeah, there we go.
So we can now type 10 and you can see ten in binary is one zero one zero leading zeros don't count.
Of course, we can go back here is a three.
Zero zero one one zero, obviously, will be all zeros.
And finally, we clicked decimal to make your own decimal.
We hit thirty four.
And you can see.
Everything matches up.
OK, so now what do we do with this?
Well, you may recall that in this case, we had a 24 mask, a 24 bed mask, right.
And here was the mask.
I'll give you the mask again.
255, 255, 35, that zero, also known as a slash 24 y, because the first 24 bits are all ones, so
a mask basically has to have contiguous bits, right?
So by contiguous, I mean that the bits are next to each other.
There's no breaks, there's no change in the digits.
They're all ones consecutively.
So this mask.
255 represents one, two, three, four, five, six, seven, eight, all the bits are on in this byte.
One, two, three, four, five, six, seven, eight, all the bits are on in the second octet, third
octet, one, two, three, four, five, six, seven, eight, and then finally the last octet.
Has nothing enabled, right?
So what this is from the computer's perspective, and this is key, guys, this is key.
All those ones from the computer's perspective, this represents the network.
OK.
And then the Xeros.
Represent the host.
So this is a network.
This represents the host, OK?
And the way it works is that the computer actually takes these two values and ends them together, and
by that I mean it will take this one in this one.
And if as long as both values are one, it will show up as a one.
If these numbers are different or they're both zero and it's a zero, but if they're both one into one,
so what the computer does is it takes the mask and the I.P. address ends it together and it says one
in zero.
OK.
That's a zero.
One in zero zero one in zero zero one one one one zero zero one and one one zero one one.
Right.
And this just goes down the entire list.
And what you'll end up discovering when you do this is something really interesting.
These are all zeroes, obviously, because zero 011 one.
Two, three, four, five, six, seven, eight.
This over here is obviously going to be zero zero zero because one in zero zero and these are all zeroes
one zero zero zero.
So what you end up getting are values.
See these green values they match.
This number here, 10 three zero.
Why?
Because the mask is telling you that's the network.
This is the street that the host 34 lives on.
These are hospitals.
Remember, these are the hospital over here, these are the hospitals over here, and this is saying
that this host at 34 lives on a 10 three zero network or street.
OK, so far so good, I hope.
Hopefully that's not too tricky.
It can be tricky, but hopefully it's not too tricky.
So what you can do from this is you can figure out how many hosts, you know live on this particular
subnet.
How do you do that?
Let's clear off the screen so I can show you in the next lecture.
So in the next lecture, we are going to dig into this a little deeper and I'm going to show you how
you can see what the broadcast addresses know.
What are the network ranges?
How many networks do we have?
And what IPS live on this particular network.
OK, so this is really important, especially if you're doing port scans.
We're trying to enumerate the network internally.
You want to know what your boundaries are when you're crossing into a separate building and typically
villans are aligned to networks and we'll see all this a little bit later.
OK, so in the next lecture, we will get into this a little bit deeper.
I will see you in the next lecture by.