In this lesson we're going to discuss
IPv4 address types.
Now in IPv4, there are several different ways
to classify our addresses,
including by whether they're public or private addresses,
whether they're loopback or localhost addresses,
and whether they're an APIPA address.
Let's take a look at each of these.
First, we need to talk about the difference
between a public and a private IPv4 address.
A public IPv4 address,
also known as a routable IP address,
is a unique IP address
assigned to each device on the internet
that allows it to communicate with other devices globally
using IPv4.
The IPv4 system uses a 32-bit address scheme
that allows for a total of about 4.3 billion IP addresses.
These addresses are typically written
in a dotted decimal notation,
and they're divided into four octets
that are separated by those dots or periods.
For example, 66.51.24.12 is a public IPv4 address.
Now, these public or routable IP addresses
must be leased or purchased
from your internet service provider
because they're globally managed by ICANN, which is
the Internet Corporation for Assigned Names and Numbers.
So if you want a public IP address assigned to your network
so that you can host a web server
for your company or a Minecraft server for your kids,
you're going to have to lease or purchase that IP address.
Now, because ICANN is responsible
for all of the IP addresses across the globe,
this is a lot to deal with.
So they created five regional internet registries,
or RIRs to be able to assist them,
and these are the folks who are going to be responsible
for managing the public IP addresses
for different regions of the world.
If you're in North America,
you're going to be using a A-R-I-N or ARIN.
If you're in Latin America.
you're going to be using L-A-C-N-I-C or LACNIC.
If you're in Africa,
you're going to be using A-F-N-I-C or AFNIC.
If you're in the Asia Pacific region,
you're going to be using A-P-N-I-C or APNIC.
And if you're in Europe, you're going to be using R-I-P-E,
also known as RIPE.
Now since my company is located here in the United States,
when we want a public IP address,
we will ask our internet service provider for one
and they'll assign one to us
and then insure us properly registered with ARIN
because ARIN is responsible
for all the publicly routable IP addresses
inside the North American region.
Now, most of the IP addresses you're going to use
inside your own networks,
you're not going to need one of these
publicly routable IP addresses
because each of these public IP addresses
actually costs money each month for you to lease.
And so instead, you may choose to use a private IP instead
for your internal network devices.
A private IPv4 address is a non-internet routable
IP address used within a local network
that allows for the communication
between devices within that network
without using a public IP address.
Now, since these private IP addresses are not accessible
over the internet, they can be used by anyone, at any time,
but only within their own local area networks.
This is why these IPs are not routable
because there is no central authority like ICANN
who's controlling who's using them
and in which networks they're being used.
In fact, if you look at the IP address
of your computer right this minute,
I bet that you're using an IP address that starts
with either a 10, a 172, or 192 as its first octet.
You don't believe me?
Go ahead and pause the video and you can check.
If you don't know how to check,
I'll tell you how to do it right now.
If you're on Windows 11,
I want you to hold down your Windows key and press S,
then type in CMD, and press Enter.
Next, type in ipconfig and hit Enter.
Now look on your screen and see your IP address.
Does it start with a 10, a 172, or a 192?
I bet you it does.
Now, if you're on a Mac
and you're watching this video over a wireless network,
you can do this even easier to check your IP address.
Simply go ahead and press down the Option Key
on your keyboard and then click on that wifi icon
in the top right corner of your menu bar.
Look down under your wireless network name
and you're going to see your IP address, again,
I bet you your starts with a 10, a 172, or a 192.
Now, am I a magician that I can guess your IP address
magically over the internet?
Well, not really.
You see, those three values
are part of what we call the private IP ranges.
This includes something like 10 dot something,
dot something, dot something.
or 172.16 dot something, dot something
or 192.168.1 dot something.
If you're using a private IP
and I said they are not routable or usable on the internet,
how are you actually connecting to my servers
to watch this video right now
because you have a private IP?
Now, that's a great question
and I'm really glad that you asked it.
Now, the way this works is by using something
known as network address translation.
Network address translation, or NAT,
is a method used in networking
that allows a single device, like a router,
to act as an agent between the internet,
or the public network,
and a local or private network
to remap your private IP addresses
into a single public IP address
and then back again to facilitate
the communication between those two devices
and to conserve the global IP address space.
Essentially, whenever your computer wants to access
a resource on the internet, like our website
at diontraining.com,
your computer's going to reach out to your network's router
using its internal private IP address.
This router will then conduct a network address translation
to change your private IP address into a public IP address
on the other side of the router and an associated port.
Then it will make the request to the web server
on your behalf,
when the data comes back from that web server,
your router's going to receive it
and translate it from that public IP address and port
back into your local private IP address
and forward that traffic back to your system.
Now, there's a lot more to understand
with network address translation, also known as NAT,
but we're going to save that for a separate lesson
to fully cover everything you need to know
about network address translation.
But for now, I just want you to realize
that it converts or translates a private IP into a public IP
and then back again on behalf of your system.
Now for the exam
and your real life role as a network technician,
it's going to be really important to memorize
the ranges for the private IP addresses.
These ranges are defined in the request for comments
1918.
Now a request for comments, or RFC,
is a formal publication
from the Internet Engineering Task Force known as the IETF.
These RFCs are authored by individuals
or groups of computer scientists
who want to document new technologies or standards
that they're proposing.
In the case of RFC 1918,
it was used to document how organizations
could conduct address allocation for private intranet,
which we now call intranets
by using private or non-routable IP addresses.
In RFC 1918, there are specific ranges of private IPs
described for class A, class B, and class C networks.
If you're working with a class A address,
anything that starts with a 10 in the first octet
is going to be considered a private IP.
This includes the entire range of IPs from 10.0.0.0
all the way up to 10.255.255.255,
for a total of 16.7 million IP addresses,
that are private and available for use
at any time you want inside of your networks.
If you're working with a class B address,
anytime you see something that starts
with a 172.16, dot something, dot something,
going all the way up to 172.31,
dot something, dot something,
this is considered to be in the private IP range as well.
Now this includes just over 1 million IP addresses
or 16 times 256 times 256.
Now, these class B private IP ranges
are actually the hardest ones for you to memorize,
and for this reason,
the exam writers love to ask you questions about them,
so keep those in mind.
Now, if you're looking at class C addresses,
anything that starts with a 192.168 dot something,
dot something, is going to be a private IP.
This includes the entire range of 192.168.0.0,
all the way up to 192.168.255.255,
which gives us 65,536 private IP addresses for us to use.
Now, I want you to commit these ranges to memory,
write them down in your notes.
Remember, class A is pretty easy.
Anything with a 10 in the front
is going to be a private IP in the class A range.
Class C is also pretty easy.
Anything that starts with 192.168
is going to be a private class C address.
But class B, that's where most of my students struggle
because it's a little bit odd.
It contains anything that starts
with 172.16 dot something, dot something,
all the way up to 172.31 dot something, dot something,
which is essentially 16 class B ranges,
all sitting next to each other,
but they kind of start out in this weird place
in the middle of the 172 range by doing 172.16
up to 172.31.
So on test day, CompTIA may try to trick you
and say, which of these addresses is not a private IP?
And then they'll give you something like
172.12 dot something, dot something.
Now this IP looks like a private IP
because it starts with 172,
but it isn't because it's not between 172.16 and 172.31.
So it's actually a public IP
because it's outside of that range.
So be really careful when you're seeing an address
that starts with 172
because it has to be within 172.16
dot something, dot something up to
172.31 dot something, dot something.
to be a private class B IP.
any of the other 172 dot something, dot something,
dot something addresses
will be considered a public IP,
so don't get that wrong on the exam.
Next, we need to take a look at some special types
of IP addresses known as the loopback
or localhost addresses.
Now, the loopback address, also known as the localhost,
is a specialized IP address
that is always assigned as 127.0.0.1.
Now all the way back in 1986 when this was created,
the developers weren't really worried about wasting
IP addresses because there were 4.3 billion IPv4 addresses.
So they simply went ahead and dedicated
the entire 127.0.0.0/8 range, or 16.7 million IPs
to be used as the internet host loopback address,
also known as our localhost.
Now, the loopback address is used
so that any higher level protocol
can send data back to the host itself
without going out to a switch or router.
Essentially, this creates a loopback to the host,
and it's often used for troubleshooting
and testing your network protocol software
on a given system.
Now, because of the way the standard was defined,
anything that starts with a 127 in the first octet
is going to be treated as a loopback address.
But almost always you're going to see this written
as 127.0.0.1 for this purpose.
That means the other 16.7 million IPs
inside the 127 dot something, dot something,
dot something range,
are really simply wasted as part of this loopback
or localhost range.
Now you've heard me call the loopback IP address
of 127.0.0.1, the localhost,
and almost every computer in the world,
if you type in the word localhost inside of your computer,
your local DNS settings are going to resolve
that back to 127.0.0.1.
If you want to go into your command line right now
and type in ping localhost, or ping 127.0.0.1,
you're going to get the exact same results
because localhost is the human readable name
for the IP address of 127.0.0.1.
Now, there's another special IP address range
you need to be aware of, and this is called APIPA.
Now APIPA, spelled A-P-I-P-A,
is the automatic private IP addresses,
and these APIPA addresses are dynamically assigned
by your operating system
whenever the network's DHCP server is unavailable
and an IP address was not already statically assigned
to your system, the APIPA range is 169.254.0.0
and it goes all the way up to 169.254.255.255,
which consists of 65,536 possible APIPA addresses
that you can use.
Now, basically anytime you see an IP address
reported as 169.254, dot something, dot something.
This means your device was unable
to complete the DHCP request and assignment process,
and because that device isn't getting
a normal private IP from our network using DHCP,
it's going to simply choose one at random
from the APIPA range instead.
Now, when your workstation first boots up,
it's going to attempt to get a dynamic IP address
using the DHCP protocol.
It goes through a four step process known as DORA, D-O-R-A.
This stands for Discover, Offer, Request, and Acknowledge.
Now if something goes wrong
with this DHCP negotiation process,
the system won't be able to get an IP address
from the DHCP server.
Now, if this happened, your computer would just crash
because it would keep trying over and over and over again
and nothing would happen.
So what the brilliant engineers of the Internet Task Force
did was create this special range of IPs
called APIPA to overcome this challenge.
Basically, it says if you have a workstation
that can't get a DHCP assignment for a dynamic IP address,
within a certain amount of time,
that workstation will just give up and pick its own address
from this special APIPA range of 169.254 dot something,
dot something.
So if you ever find a computer
that cannot connect to the internet,
the first thing you should check is its IP address.
You can do this using ipconfig on Windows Systems,
ifconfig on Mac Systems or ip on Linux Systems.
If you see an IP address that starts with 169.254,
dot something, dot something,
then you know it's a DHCP problem
and you need to check the DHCP server
to make sure it's working properly
and handing out private IP addresses
from the class A, class B, or class C range.
Now, that's as deep as we need to go
into DHCP for right now,
but we will come back to DHCP later on in its own lesson
to dive much deeper into how it works
and the kind of information it can provide your computer
in addition to that dynamically assigned IP address.
All right, I know that was a ton of information
in this video and if I went too fast for you,
I do recommend that you go ahead
and watch this video a second time.
There is so much important information in here
that you need to know as a good network technician
and for the exam.
So remember, when you're trying to understand
IPv4 address types,
it's really important that you recognize the distinctions
between public and private IPv4 addresses,
as well as the special ranges like loopback,
localhost, and APIPA addresses.
Now, public IPv4 addresses
are unique global identifiers that are needed for devices
to communicate over the internet.
And these public IP addresses are managed by ICANN
and its regional bodies.
Private IP addresses on the other hand,
are only used within our local networks
and they allow for internal communication
without being directly exposed to the internet.
This helps us save money
and it also helps us to preserve
the limited public IP version four address space
that is available today.
The loopback or localhost address
is used for internal testing
of your device's network protocols.
The loopback or localhost address is usually just going to use
127.0.0.1 as its IP address,
but the entire 127 dot something, dot something,
dot something range is actually reserved for loopback
and localhost use.
The automatic private IP address, or APIPA,
is a fallback for network configurations
whenever DHCP fails,
but they are considered to be private IPs
and not routable over the internet.
If you see a device has been assigned an APIPA address,
you should check its network connectivity first,
and if that's working properly,
you then need to go on to check the DHCP server
to make sure it's reachable and online.