Instructor: In this lesson, we're going to talk about IPv4,
or internet protocol version four.
IPv4 is extremely popular and is the most common type
of IP addressing that's used on our networks.
In fact, if you're like most people,
you've already seen an IPv4 address before.
When you look at them,
they're written as a series of four decimal numbers
separated by dots.
Some examples of this are IPv4 addresses like 10.1.2.3
or 172.21.243.67.
As you can see, each IPv4 address is made up
of four parts to form that address.
This is known as a dotted-decimal notation.
When you're referring to each
of those four individual parts, we call these an octet
because they each have a decimal number
that's used to represent an eight-bit number.
Because these decimal numbers
represent an eight-bit or eight binary digits,
this means that they can only represent a value
from 0 to 255 in each of those four positions.
Now, when all four octets are combined,
we have four octets that contain eight bits each,
for a total of 32 bits of total addressable space
when using an IPv4 address.
Now, for example, if I have the IPv4 address of 192.168.1.4,
this is written in dotted-decimal notation
to make it easier for us as humans to read it.
But in reality, it's actually
11000000.
10101000.
00000001.
00000100
if I put it its true binary form.
As you can see, being able to use dotted-decimal notation
is a lot easier for us to read and to type.
And therefore it's less prone to us making mistakes
because as humans entering these numbers
into our network devices using binary
would just be a big issue for us.
We just don't think that way.
Now when we see an IP address like 192.168.1.4,
it's actually being broken down into two portions
by using a second 32-bit number known as a subnet mask.
Now one part of the IPv4 address
is used to identify the network portion
and the other part is going to be used
to identify the host portion.
When you look at a subnet mask,
it's going to look a lot like an IPv4 address,
but if you convert it to binary,
you're going to see that it has a continuous strings
of ones or zeros to identify the network
and host portions of that address
being used by the client or device.
So if I have a subnet mask like 255.255.255.0,
this is known as a default class C subnet mask.
Now don't worry about classes just yet,
we are going to cover them more in just a moment.
For now I just want you to see
what a subnet mask looks like.
Now if I converted this into binary,
each of those octet that are 255
are going to be written as 11111111.
So I'm going to get 11111111.
11111111.
and then 00000000.
This is because in binary, eight ones is going to equal 255
when I read it in decimal.
And if I have eight zeros in binary
that is going to equal zero in decimal.
Now, when you look at this number,
if you see a one in the binary of that subnet mask,
this means it's part of the network portion
of the IP address.
If I see a zero in the binary portion of the subnet mask,
this means it's part of the host portion
of the IPv4 address.
So let's put this together by showing both an IPv4 address
and a subnet mask together.
First we have our IPv4 address of 192.168.1.4.
Next we have our subnet mask underneath it
with 255.255.255.0.
Now everywhere I see that 255,
this is going to represent a one in binary.
So this becomes part of the network portion
of that IPv4 address.
If I use this example, 192.168.1.4,
the 198.168.1, that is part of the network.
Now I can do anything that starts with 192.168.1.something
and that would all be addressable by the same local network
because they all share the same network portion.
Now, when I get to the second part,
anytime I see those zeros,
this represents all zeroes in binary.
So that's going to be the host portion of that IPv4 address.
In this case, that is the .4 portion of this address,
which is going to represent the host.
That host could be a server, a desktop, a laptop,
a tablet, a smartphone, or any other network device.
It really doesn't matter.
But when we talk about this .4 device,
that is a single host.
When I talk about the 192.168.1,
that is the network that can contain up to 254 devices.
So if I have a device like 192.168.1.50
with a subnet of 255.255.255.0,
that device is also on the same network
as our 192.168.1.4 device
and they can communicate with each other using a switch
and they wouldn't have to use a router
because they both share the same network portion, 192.168.1.
Now on the other hand,
let's assume I have a device like 192.168.0.100
with a subnet of 255.255.255.0,
that device is on a different network.
Specifically, it's on the 192.168.0.something network.
So we cannot communicate that
from our original device at 192.168.1.4
without leaving our network
and routing our traffic over to this new network,
this 192.168.0.something network.
This is why we need to have a router.
Now, if this doesn't quite make sense yet,
don't worry too much.
Right now we have barely just scratched the surface
in the examples we talked about.
And I just wanted to get you the idea
and introduce you to this concept.
Now, the next concept that we need to talk about
is that of IPv4 addresses
and how they're broken up into classes or groupings
of ranges that can be used for different purposes.
Now, each class has its own default subnet mask as well.
When we talk about classes, we identify these by a letter.
These letters are A, B, C, D, and E.
Now to identify the class for a given IP address,
you just need to look at the first octet.
If that first octet begins with a number between 1 and 127,
it's going to be considered a class A address
and it has a default subnet mask of 255.0.0.0.
This means the network portion of that address
is just the first octet.
And the second, third and fourth octet
are going to make up the host portion.
This means that with a class A network,
we can have 256 times 256 times 256 hosts
on a single network,
which means there are 16.7 million
possible host IP addresses
available for a single network address portion
assigned in a class A.
Now our second class we have occurs
when we have that first octet beginning with a number
between 128 and 191.
This would be considered a class B address,
and we'll have a default mask of 255.255.0.0.
This means that the network portion of this address
is going to be the first and second octet.
And the third and fourth octet
are going to make up the host portion.
This means that for a class B network,
we can have up to 256 times 256 hosts on a single network.
And that means we get 65,536 possible host IP addresses
available for a single network address portion
assigned within a class B.
Now the third class we have occurs when the first octet
begins with a number between 192 and 223.
This is considered a class C address,
and it has a default subnet mask of 255.255.255.0.
This means that the network portion of the address
is going to be the first, second and third octet
and we save that fourth octet for the host portion.
This means that for a class C network,
you could only have 256 hosts on a single network.
And this means there are only 256 possible host IP addresses
available for a single network address portion
that's being assigned.
Now the fourth class we have occurs when the first octet
begins with a number between 224 and 239.
This is considered a class D address.
Now a class D address does not have
any subnet mask assigned to it.
This is because class D addresses are special
and they're reserved for multicasting or multicast routing.
Now a multicast address is a logical identifier
for a group of hosts in a computer network
that are already going to be available
to process datagrams or frames intended to be multicast
for a designated network service.
So the actual multicast address
doesn't have to align with a single host,
but instead it aligns with a group of hosts.
When you think about a multicast address,
I want you to think about it like a group chat on Facebook.
You might have a group chat name,
in our case, a multicast address.
And when you send a message to your group chat's name,
all the members of that group
are going to get a copy of that message.
Well, the same thing is going to happen in multicast
where we're using IPv4.
This is the idea of what you need
to understand with multicasting.
I send it from one person and it goes to multiple people
all at the same time.
Now the fifth class we have occurs when the first octet
begins with a number between 240 and 255.
This is called a class E address
and it also has no default subnet mask.
This is because class E addresses are also special.
In this case, they're reserved for experimental purposes
for research and development or study only.
This experimental range contains about 268 million addresses
that are reserved for future use.
Over the years, there have been a few proposals
to reallocate these class E addresses for general use
because public IPv4 addresses were becoming
more and more scarce in the class A, class B
and class C ranges as more and more devices
started getting connected to the internet.
That said, so far to date, these class C addresses
still remain allocated for experimental use only,
and most IP implementations within our networks
will consider any IP in this range from 240.0.0.0,
all the way up to 255.255.255.255
to be invalid as a source or destination within a datagram.
And therefore, the datagram would be rejected
by the destination system.
So if you try to send something
to a window server or a workstation,
it's going to refuse to communicate with that device
if you claim to be from a class E address.
All right.
So now that we've covered the five different classes
of IPv4 addresses,
let's talk a little more about subnet masks.
Let's pretend that we have an IP address
of 192.168.1.4 again
with a subnet mask of 255.255.255.0.
This subnet mask is the default subnet mask
for a class C network.
And since our IP address begins with a 192,
it is also a class C address.
This means we have a class C address
using a class C default subnet mask.
So we consider this to be classful.
We call this a classful mask.
Now a classful subnet mask is just the default
for a given class of IP address.
This doesn't mean though that it's the best one
for us to always use.
For example, if we're using a class A address,
you may recall that as default subnet mask is 255.0.0.0.
This means we have a possibility
of having 16.7 million hosts on a single network.
Now, I don't know about you,
but I don't often come across networks that are that large
and require that many hosts.
In fact, I used to work
on one of the world's largest intranets
and we had a little over 1 million hosts
spread across six continents around the globe.
That was a really, really big network.
And we still didn't come close
to using all 16.7 million IP addresses
in a classful class A subnet.
So we often instead want to breakdown these large networks
into smaller networks.
To do this, we're going to use a process known as subnetting.
Now we're not going to cover subnetting
in detail in this course.
For now, I just want you to remember
that we don't have to stick with a classful subnet mask.
Instead, we can use a classless subnet mask if we want to.
This is a process known as Classless Inner-Domain Routing.
This will let us borrow some of those host bits,
those zeros that I showed you in the subnet mask,
and then reassign them to the network portion.
So this lets me cut down the size of my networks
into much smaller portions with less hosts
and this is more efficient.
This will give me the same time,
a lot more networks that I can possibly use.
Because again, if you think about like a pie,
you can cut it many different ways,
but it's still one pie and it's a fixed amount of IPs
that we have in total.
So I can cut the pie in half
and we'd have two halfs of the pie,
or I can cut it in quarters
and we can have four pieces of pie,
but each of those pieces are smaller,
the same thing with our networks.
So for example,
let's say I have a classful class C subnet mask,
and I would have 255.255.255.0 as that subnet mask.
This allowed me to have 256 hosts, right?
Well, in my home network, I don't really need 256 hosts.
So maybe I want to break this down into four smaller networks.
If I take 256 and I divided by four,
I get 64 hosts for each of those four networks.
To do this, I would change the subnet mask
from 255.255.255.0
to 255.255.255.192.
How did I do this?
Well, I borrowed two bits from the host
and I gave it to the network portion of the address.
And this is how I make four different subnetworks or subnets
out of this by using my subnet mask.
For now, I just want you to remember
that subnetting allows you to use a classless subnet mask
to create smaller networks with fewer hosts
in each of those networks
than you could if you had a classful subnet mask by itself.
This process is known as the Classless Inner-Domain Routing
or C-I-D-R and we are going to abbreviate our IP addresses
using this C-I-D-R or CIDR notation.
Now, when we do this,
we don't have to write out the subnet mask.
Instead, we just write the IP address, a slash and a number.
This is known as our CIDR notation.
So if I have an IP address of 192.168.1.4
with a subnet mask of 255.255.255.0.
I can abbreviate this using CIDR notation
as 192.168.1.4/24.
Oftentimes you'll hear this called CIDR or slash notation.
Now, if I had an IP address of 192.168.1.4,
but my subnet mask was 255.255.255.192,
I can abbreviate that as 192.168.1.4/26,
because remember, I borrowed two bits from the host portion
so I went from 24 as my default subnet mask /24 into a /26
by borrowing two bits and making my network portion
that much larger, bringing it from 24 up to 26.
Now for the classful subnet masks,
our CIDR annotation is going to be rather simple.
If you have a class A classful subnet mask,
you're going to have a /8 after the IP address.
This means that the subnet mask is 255.0.0.0,
or it has eight bits of ones,
which is the /8 and then 24 bits of zeros
inside the subnet mask.
Now, if you have a class B classful subnet mask,
you're going to use a /16 after your IP address.
This means the subnet mask is 255.255.0.0.
Also, it means that it has 16 bits of ones
and 16 bits of zeros in that subnet mask.
Now, if you have a class C classful subnet mask,
you're going to use a /24 after the IP address.
This means that the subnet mask is going to be 255.255.255.0,
or that it has 24 bits of ones and then eight bits of zeros
in that subnet mask.
Next, we need to talk about two different types
of IPv4 for addresses.
These are called public and private IPs,
and you may also hear them called
routable and non-routable IPs.
When an IP is considered a public or routable IP,
this IP address can be directly accessed
over the internet and assigned to your network
by your internet service provider.
Routable IPs are publicly routable
across the entire internet,
and therefore they're globally managed
by the internet corporation for assigned names and numbers.
So if you want a public IP address,
like for running a web server for your company
or a Minecraft server for your kids,
you can buy that IP address
through your local internet service provider.
Now, on the other hand, there are also non-routable IPs
known as private IPs
because, well, they're not public.
Private IPs can be used by anyone at any time,
but only within their own local area networks.
This is why these IPs are considered not routable
because no one is controlling who's using them
and in which networks.
In fact, if you look at your IP address
of your computer right now,
I bet you're using an IP address
that starts with either a 10, a 172 or a 192
as it's first octet.
Don't believe me? Go ahead, pause this video and check.
If you don't know how to check,
I'm going to tell you how to do it right now.
If you're on a Windows computer,
I want you to hold down the Windows key
and press the R key at the same time,
then type cmd and hit Enter.
This stands for command.
Next, you have this black window on your screen,
type in ipconfig for IP configuration,
and then hit Enter and look at your IP address.
Does it start with a 10, a 172 or a 192?
I bet it does.
Now if you're on a Mac, don't worry.
I'm not leaving you out.
You can go ahead and look at this as well.
If you're watching this video
over a wireless network connection,
go ahead and hold down your Option key
and then click on the Wi-Fi icon
in the top right of your menu bar.
Look down under your wireless network's name,
and you're going to see your IP address.
Again, I bet it starts with either a 10, a 172 or a 192
as part of that IP.
Now, am I a magician being able to tell you
what your IP address is?
Well, not really.
You see those three values are part of what we call
the private IP ranges.
This includes something like 10.0.0.something,
or 172.16.1.something,
or 192.168.1.something
and a bunch of other IPs as well.
So if you're using one of these private IPs
and I said they're not routable,
how are you actually getting out to the internet
to watch this video?
Well, when you go out to the internet,
your router actually conducts a little trick
notice network address translation,
and it changes your private IP into a public IP.
All right.
For the exam and your life
as a real world network technician,
it's going to be really important for you to understand
the ranges for private IP addresses.
If you're looking at class A addresses,
anything that starts with a 10 in the first octet
is going to be considered a private IP.
So you can have anything from 10.0.0.0
all the way up to 10.255.255.255 as your address
and it's going to be a private IP.
This gives you a total of 16.7 million IP addresses
that anyone can use.
Now, in addition to that,
we also have some class B addresses,
and this one's a little bit harder to memorize.
For class B addresses anything that starts with a 172.16,
all the way up to 172.31 is going to be part
of a private IP range.
This includes over 1 million IP addresses
because we have 16 times 256 times 256.
Now, if you're looking at a class C address,
anything that starts with a 192.168
is considered a private IP.
This includes the range of 192.168.0.0
all the way up to 192.168.255.255.
This gives you 65,536 IP addresses
that are there for you to use if you want them.
Now, I want you to commit these ranges to memory.
Remember, class A is really easy.
Anything that starts with a 10.something.something.something
is a private IP in the class A range.
Now class C is also pretty easy
because anything that is 192.168.something.something
is also considered a private address,
in this case, a class C private address.
But class B is where most people are going to struggle
because it's a little bit different.
It's going to contain any addresses
that start with 172.16.something.something
all the way up to 172.31.something.something.
This is essentially 16 classes of class B addresses
that are all next to each other.
You could choose any of them as a private IP.
Now on test day CompTIA may try to trick you
and say something like which of these addresses
is not a private IP.
And then they're going to give you something
like 172.12.something.something.
Now this starts with a 172, so it looks like a private IP,
but because it's 172.12,
it's not between 172.16 and 172.31.
So 172.12.something.something
is actually a public IP
because it's outside of my private range.
You have to be especially careful
when you see an address that starts with 172,
because it has to be between 172.16 to 172.31
to be a private IP.
All of the other 172.something addresses will be public.
Now, the next thing we need to talk about
is some specialized IPs,
and there are two big categories that we need to cover.
The Loopback address and APIPA addresses.
Now the first special IP is the Loopback address.
This is assigned as 127.0.0.1.
Now, when this was created all the way back
in the early days of the internet,
the designers weren't too worried about wasting IPs
because they never envisioned that we were going to use
a lot of IP addresses in the entire world.
So they simply dedicate an entire range that's 127.0.0.0/8
or 16.7 million IP addresses
to be used as internet host Loopback addresses.
Now this allows any higher level protocol
to send data to the host itself
without actually going out to a switch or a router.
Essentially, this creates a Loopback to the host
and it tests your networking protocols.
So it's often used in troubleshooting
and testing network protocols on a given system
to make sure your drivers are working properly.
Now because of the way the standard was developed,
anything you see that starts
with 127.something.something.something
is considered a Loopback address.
Although most people just use 127.0.0.1
as our Loopback addressed by default.
This means the other 16.7 million IPs are pretty much wasted
because we're using this range
to be the entire Loopback range
even though most of us only use this one IP address.
Now you may have heard the old joke
that some network technicians like to use.
There's no place like 127.0.0.1,
which means there's no place like here home, right?
That's 127.0.0.1. It's the local host.
Now, when it comes to the IP address of 127.0.0.1,
you're going to hear it called either the Loopback,
or you might hear people call it the local host
like I did earlier.
Now the word local host will always resolve to 127.0.0.1
on every computer as part of its local DNS settings.
So if you ping 127.0.0.1, or you ping local host,
you're going to get the same result.
It's going to result to the IP address of that Loopback IP,
127.0.0.1.
Now the second special IP addresses we have
is known as APIPA, A-P-I-P-A.
This is also known as the Automatic Private IP Addresses.
These addresses are dynamically assigned
by your operating system
whenever your DHCP server is unavailable
and an IP address has not already been statically assigned.
APIPA addresses are always going to start
with 169.254.something.something.
So you're going to find them in the address range
of 169.254.0.0,
all the way up to 169.254.255.255.
So if you ever see an IP address in this range
when you look at the IP of a network device,
it means that there is something wrong with the DHCP process
and the device isn't getting a normal private IP
from one of our class A, class B or class C ranges.
Now, as your workstation boots up,
it's going attempt to get its own IP address
using dynamic IPs, using the DHCP protocol.
This goes through a four step process known as DORA
This is discover, offer, request and acknowledge.
If something goes wrong
with this DORA negotiation process with DHCP,
the system simply can't get an address
and your computer would eventually just crash
because it wouldn't know what to do
and it would keep trying over and over again.
So what the brilliant engineers
of the internet taskforce did was create this APIPA range.
Now, basically what it says is that if a workstation
can't get a DHCP assignment for a dynamic IP address
within some amount of time,
the workstation is simply going to pick its own address
from this special APIPA range.
Basically any IP at once,
as long as it starts with 169.254.something.something.
So if you find a computer
that cannot connect to the internet,
the first thing you should do is check its IP address.
Now, if you see an IP address
of 169.254.something.something,
you know you have a DHCP problem,
and you need to check your DHCP server
to ensure it's working properly
and then it's handing out private IP addresses
from class A, class B or class C assigned ranges.
Now that's as deep as we need to go into DHCP right now,
but I promise we are going to go back to DHCP later on,
and we'll talk about all of these things
and how it provides these IP addresses
and how those are going to be used inside your networks.
All right.
I know that was a ton of information in this long video.
So if I went too fast for you,
please, watch this lesson a second time.
There is a lot of important information
about IPv4 addressing that you just have to know.
It is critical that you understand the different classes
of IP addresses, the public and private IPs
and when each of these are used,
as well as the different special IP addresses that we have,
such as the Loopback, APIPA, and others.