SPEAKER 2: Computers
are able to communicate across massive distances
at near-instant speeds. It's a remarkable
technical advancement at the root of how
billions of people use the internet
every single day. Earlier in this
course, we learned about how computers
communicate with each other over short distances or on a
single network segment, or LAN. In these next lessons, we'll
focus on the technologies that allow data to cross
many networks, facilitating communications
over great distances. By the end of this
module, you'll be able to describe the
IP addressing scheme and how subnetting works. This means you'll learn how to
perform basic math in binary in order to describe subnets. You'll also be able to
demonstrate how encapsulation works and how
protocols, such as ARP, allow different layers of
the network to communicate. And finally, you'll gain an
understanding of the basics behind routing,
routing protocols, and how the internet works. For now, route yourself
to the next video, and we'll get started. [MUSIC PLAYING] On a Local Area
Network, or LAN, nodes can communicate with
each other through their physical MAC addresses. This works well on small scale
because switches can quickly learn the MAC
addresses connected to each of their ports
to forward transmissions appropriately. But MAC addressing isn't
a scheme that scales well. Every single network
interface on the planet has a unique MAC address,
and they aren't ordered in any sort of systematic way. There's no way of knowing
where on the planet a certain MAC address might
be at any one point in time. So it's not ideal for
communicating across distances. Later on in this lesson, when
we introduce ARP, or Address Resolution Protocol, you'll see
that the way that nodes learn about each other's
physical addressing isn't translatable to anything
besides a single network segment anyway. Clearly, we need another
solution, and that is the network layer and the
Internet Protocol, or IP, and the IP addresses
that come along with it. By the end of this
lesson, you'll be able to identify
an IP address, describe how IP datagrams
are encapsulated inside the payload
of an Ethernet frame, and correctly identify and
describe the many fields of an IP datagram header. [MUSIC PLAYING] IP addresses are 32-bit-long
numbers made up of four octets, and each octet is normally
described in decimal numbers. 8 bits of data,
or a single octet, can represent all decimal
numbers from 0 to 255. For example, 12.34.56.78
is a valid IP address, but 123.456.789.100
would not be because it has numbers larger than could
be represented by 8 bits. This format is known as
dotted decimal notation. We'll deep-dive into
how some of this works in an upcoming
lesson about subnetting. The important thing
to know for now is that IP addresses
are distributed in large sections to various
organizations and companies instead of being determined
by hardware vendors. This means that IP addresses
are more hierarchical and easier to store data about than
physical addresses are. Think of IBM, which owns every
single IP that has the number 9 as the first octet. At a very high level, this
means that if an internet router needs to figure out where to
send a data packet intended for the IP address
9.0.0.1, that router only has to know to get it
to one of IBM's routers. That router can handle the
rest of the delivery process from there. It's important to call out
that IP addresses belong to the networks, not the devices
attached to those networks. So your laptop will always have
the same MAC address no matter where you use it, but it
will have a different IP address assigned to it at an
internet cafe than it would when you're at home. The LAN at the internet cafe
or the LAN at your house would each be individually
responsible for handing out an IP address to your laptop
if you power it on there. On a day-to-day basis,
getting an IP address is usually a pretty
invisible process. You'll learn more about some
of the technologies that play in a later lesson. For now, remember that,
on many modern networks, you can connect a new device,
and an IP address will be assigned to it automatically
through a technology known as Dynamic Host
Configuration Protocol. An IP address
assigned this way is known as a dynamic IP address. The opposite of this
is known as a static IP address, which must be
configured on a node manually. In most cases,
static IP addresses are reserved for servers
and network devices, while dynamic IP addresses
are reserved for clients. But there are
certainly situations where this might not be true. [MUSIC PLAYING] Just like how the data
packets at the Ethernet layer have a specific name,
Ethernet frames, so do packets at
the network layer. Under the IP protocol,
a packet is usually referred to as an IP datagram. Just like any Ethernet
frame, an IP datagram is a highly structured
series of fields that are strictly defined. The two primary sections
of an IP datagram are the header and the payload. You'll notice that
an IP datagram header contains a lot more
data than an Ethernet frame header does. The very first field
is 4 bits and indicates what version of internet
protocol is being used. The most common version of
IP is version 4, or IPv4. Version 6, or IPv6,
is rapidly seeing more widespread
adoption, but we'll cover that in a later module. After the version field, we
have the header length field. This is also a 4-bit
field that declares how long the entire header is. This is almost always
20 bytes in length when dealing with IPv4. In fact, 20 bytes is the
minimum length of an IP header. You couldn't fit
all the data you need for a properly formatted
IP header in any less space. Next, we have the
service type field. These 8 bits can
be used to specify details about Quality of
Service, or QoS, technologies. The important
takeaway about QoS is that there are services that
allow routers to make decisions about which IP datagram may
be more important than others. The next field is a 16-bit
field known as the total length field. It's used for exactly
what it sounds like-- to indicate the total
length of the IP datagram it's attached to. The identification
field is a 16-bit number that's used to group
messages together. IP datagrams have
a maximum size, and you might already be able
to figure out what that is. Since the total length
field is 16 bits, and this field indicates the
size of an individual datagram, the maximum size of
a single datagram is the largest number you can
represent with 16 bits, 65,535. If the total amount of
data that needs to be sent is larger than what can
fit in a single datagram, the IP layer needs
to split this data up into many individual packets. When this happens, the
identification field is used so that the
receiving end understands that every packet with the
same value in that field is part of the
same transmission. Next up, we have two
closely related fields-- the flag field and the
fragmentation offset field. The flag field is
used to indicate if a datagram is
allowed to be fragmented or to indicate that the datagram
has already been fragmented. Fragmentation is the process
of taking a single IP datagram and splitting it up into
several smaller datagrams. While most networks operate
with similar settings in terms of what size and IP
datagram is allowed to be, sometimes this could be
configured differently. If a datagram has to
cross from a network allowing a larger datagram size
to one with a smaller datagram size, the datagram
would have to be fragmented into smaller ones. The fragmentation
offset field contains values used by the
receiving end to take all the parts of a
fragmented packet and put them back together
in the correct order. Let's move along to the
Time To Live, or TTL field. This field is an
8-bit field that indicates how many router
hops a datagram can traverse before it's thrown away. Every time a datagram
reaches a new router, that router decrements
the TTL field by 1. Once this value
reaches 0, a router knows it doesn't have to forward
the datagram any further. The main purpose
of this field is to make sure that when there's
a misconfiguration in routing that causes an endless
loop, datagrams don't spend all eternity trying
to reach their destination. An endless loop could
be when router A thinks router B is the next
hop, and router B thinks router A is the next hop. Spoiler alert-- in
an upcoming module, you'll learn that the TTL field
has valuable troubleshooting qualities, but
secrets like these are only released to
those who keep going. After the TTL field, you'll
find the protocol field. This is another 8-bit
field that contains data about what transport
layer protocol is being used. The most common transport layer
protocols are TCP and UDP, and we'll cover both of those in
detail in the next few lessons. So next, we find the
header checksum field. This field is a checksum of
the contents of the entire IP datagram header. It functions very much like
the Ethernet checksum field we discussed in the last module. Since the TTL field has to
be recomputed at every router that a datagram touches,
the checksum field necessarily changes too. After all of that,
we finally get to two very important fields-- the source and destination
IP address fields. Remember that an IP
address is a 32-bit number, so it should come as no
surprise that these fields are each 32 bits long. Up next, we have the
IP options field. This is an optional
field and is used to set special characteristics
for datagrams primarily used for testing purposes. The IP options field is usually
followed by a padding field. Since the IP options field
is both optional and variable in length, the
padding field is just a series of zeros used
to ensure the header is the correct total size. Now that you know about all of
the parts of an IP datagram, you might wonder
how this relates to what we've learned so far. You might remember that in our
breakdown of an Ethernet frame, we mentioned a
section we described as the data payload section. This is exactly what
the IP datagram is, and this process is
known as encapsulation. The entire contents
of an IP datagram are encapsulated as the
payload of an Ethernet frame. You might have
picked up on the fact that our IP datagram also
has a payload section. The contents of
this page payload are the entirety of
a TCP or UDP packet, which we'll cover later. Hopefully, this helps
you better understand why we talk about networking
in terms of layers. Each layer is needed
for the one above it. [MUSIC PLAYING] IP addresses can be split into
two sections-- the network ID and the host ID. Earlier, we mentioned that
IBM owns all IP addresses that have a 9 as the value of the
first octet in an IP address. If we take an example IP
address of 9.100.100.100, the network ID would
be the first octet, and the host ID would
be the second, third, and fourth octets. The address class
system is a way of defining how the global
IP address space is split up. There are three primary
types of address classes-- Class A, Class B, and
Class C. Class A addresses are those where the first octet
is used for the network ID, and the last three are
used for the host ID. Class B addresses are
where the first two octets are used
for the network ID, and the second two are
used for the host ID. Class C addresses, as
you might have guessed, are those where the first three
octets are used for the network ID, and only the final octet
is used for the host ID. Each address class
represents a network of vastly different size. For example, since
a Class A network has a total of 24
bits of host ID space, this comes out to 2 to
the 24th, or 16,777,216 individual addresses. Compare this with
a Class C network which only has 8 bits
of host ID space. For a class C network,
this comes out to 2 to the eighth, or 256 addresses. You can also tell exactly what
address class an IP address belongs to just
by looking at it. If the very first bit
of an IP address is 0, it belongs to a class A network. If the first bits are 10, it
belongs to a Class B network. Finally, if the
first bits are 110, it belongs to a class C network. Since humans aren't great
at thinking in binary, it's good to know that
this also translates nicely to how these addresses
are represented in dotted decimal notation. You might remember that
each octet in an IP address is 8 bits, which
means each octet can take a value between 0 and 255. If the first bit has to be a
0, as it is with the Class A address, the possible
values for the first octet are 0 through 127. This means that any IP address
with a first octet with one of those values is
a Class A address. Similarly, Class B
addresses are restricted to those that begin
with the first octet value of 128 through
191, and Class C addresses begin with the first
octet value of 192 through 223. You might notice that this
doesn't cover every possible IP address. That's because there are two
other IP address classes, but they're not quite as
important to understand. Class D addresses always
begin with the bits 1110 and are used for
multicasting, which is how a single IP
datagram can be sent to an entire network at once. These addresses begin
with decimal values between 224 and 239. Lastly, class C addresses make
up all of the remaining IP addresses, but they're
unassigned and only used for testing purposes. In practical terms,
this class system has mostly been replaced
by a system known as CIDR, or Classless
Inter-Domain Routing. But the address class system
is still in place in many ways and is important to
understand for anyone looking for a well-rounded
networking education. And you know we're all
about that, so don't worry. We'll be covering CIDR
in a future lesson. [MUSIC PLAYING] Congrats. You now understand how both MAC
addresses are used at the data link layer and how IP addresses
are used at the network layer. Now we need to discuss how
these two separate address types relate to each other. This is where Address
Resolution Protocol, or ARP, comes into play. ARP is a protocol
used to discover the hardware address of a node
with a certain IP address. Once an IP datagram
has been fully formed, it needs to be encapsulated
inside an Ethernet frame. This means that the transmitting
device needs a destination MAC address to complete the
Ethernet frame header. Almost all
network-connected devices will retain a local ARP table. An ARP table is just
a list of IP addresses and the MAC addresses
associated with them. Let's say we want to send
some data to the IP address 10.20.30.40. It might be the case that
this destination doesn't have an entry in the ARP table. When this happens, the node
that wants to send data sends a broadcast ARP message
to the MAC broadcast address, which is all Fs. These kinds of
broadcast ARP messages are delivered to all computers
on the local network. When the network interface
that's been assigned an IP of 10.20.30.40 receives
this ARP broadcast, it sends back what's
known as an ARP response. This response message will
contain the MAC address for the network
interface in question. Now, the transmitting
computer knows what MAC address to put in the
destination hardware address field, and the Ethernet
frame is ready for delivery. It will also likely store this
IP address in its local ARP table so that it won't
have to send an ARP broadcast the next time it needs
to communicate with this IP. Handy. ARP table entries
generally expire after a short amount of time to
ensure changes in the network are accounted for. So don't expect
it to stick around the way I expect
you to stick around for the next ungraded quiz. [MUSIC PLAYING] In the most basic
of terms, subnetting is the process of taking a large
network and splitting it up into many individual smaller
subnetworks, or subnets. By the end of this
lesson, you'll be able to explain why
subnetting is necessary and describe how
subnet masks extend what's possible with just
network and host IDs. You'll also be able to discuss
how a technique known as CIDR allows for even more flexibility
than plain subnetting. Lastly, you'll be able to
apply some basic binary math techniques to better understand
how all of this works. Incorrect subnetting
setups are a common problem you might run into as an
IT support specialist. So it's important to have a
strong understanding of how this works. That's a lot, so let's dive in. As you might remember
from the last lesson, address classes give us a way
to break the total global IP space into discrete networks. If you want to communicate with
the IP address 9.100.100.100, core routers on the internet
know that this IP belongs to the 9.0.0.0 Class A network. They then route the message
to the gateway router responsible for the network
by looking at the network ID. A gateway router specifically
serves as the entry and exit path to a certain network. You can contrast this
with core internet routers, which might only
speak to other core routers. Once your packet gets to the
gateway router for the 9.0.0.0 Class A network,
that router is now responsible for getting that
data to the proper system by looking at the host ID. This all makes sense until you
remember that a single Class A network contains
16,777,216 individual IPs. That's just way too many devices
to connect to the same router. This is where
subnetting comes in. With subnets, you can
split your large network up into many smaller ones. These individual subnets will
all have their own gateway routers serving as the
ingress and egress point for each subnet. [MUSIC PLAYING] So far, we've learned
about network IDs, which are used to identify networks,
and host IDs, which are used to identify individual hosts. If we want to split
things up even further-- and we do-- we'll need to
introduce a third concept, the subnet ID. You might remember that
an IP address is just a 32-bit number. In a world without subnets, a
certain number of these bits are used for the network ID,
and a certain number of the bits are used for the host ID. In a world with
subnetting, some bits that would normally
comprise the host ID are actually used
for the subnet ID. With all three of these IDs
representable by a single IP address, we now have
a single 32-bit number that can be accurately delivered
across many different networks. At the internet
level, core routers only care about the
network ID and use this to send the datagram along
to the appropriate gateway router to that network. That gateway router then has
some additional information that it can use to
send the datagram along to the destination
machine or the next router in the path to get there. Finally, the host ID is
used by that last router to deliver the datagram to the
intended recipient machine. Subnet IDs are calculated via
what's known as a subnet mask. Just like an IP
address, subnet masks are 32-bit numbers that
are normally written out as four octets in decimal. The easiest way to understand
how subnet masks work is to compare one
to an IP address. Warning-- dense material ahead. We're about to get into
some tough material, but it's super important
to properly understand how subnet masks
work because they're so frequently misunderstood. Subnet masks are often
glossed over as magic numbers. People just memorize
some of the common ones without fully
understanding what's going on behind the scenes. In this course,
we're really trying to ensure that you leave with
a well-rounded networking education. So even though subnet masks
can seem tricky at first, stick with it, and you'll get
the hang of it in no time. Just know that,
in the next video, we'll be covering
some additional basics of binary math. Feel free to watch this
video a second or third time after reviewing the material. Go at your own pace,
and you'll get there in the perfect amount of time. Let's work with the IP
address 9.100.100.100 again. You might remember that
each part of an IP address is an octet, which means
that it consists of 8 bits. The number 9 in
binary is just 1001. But since each
octet needs 8 bits, we need to pad it
with some 0s in front. As far as an IP
address is concerned, having a number 9 as the first
octet is we represented as 0000 1001. Similarly, the numeral 100 as
an 8-bit number is 0110 0100. So the entire binary
representation of the IP address 9.100.100.100
is a lot of 1s and 0s. A subnet mask is a binary
number that has two sections. The beginning part, which is the
mask itself, is a string of 1s. Just 0s come after this. The subnet mask, which is the
part of the number with all the 1s tells us
what we can ignore when computing a host ID. The part with all the 0s
tells us what to keep. Let's use the common subnet
mask of 255.255.255.0. This would translate to
24 1s followed by 8 0s. The purpose of the mask,
or the part that's all 1s, is to tell a router what part of
an IP address is the subnet ID. You might remember
that we already know how to get the network
ID for an IP address. For 9.100.100.100,
a Class A network, we know that this is
just the first octet. This leaves us with
the last three octets. Let's take those
remaining octets and imagine them next to the
subnet mask in binary form. The numbers in the
remaining octets that have a corresponding
1 in the subnet mask are the subnet ID. The numbers in the
remaining octets that have a corresponding
0 are the host ID. The size of a subnet is entirely
defined by its subnet mask. So, for example, with a
subnet mask of 255.255.255.0, we know that only
the last octet is available for host IDs,
regardless of what size the network and subnet IDs are. A single 8-bit
number can represent 256 different numbers,
or, more specifically, the numbers 0 through 255. This is a good time to point out
that, in general, a subnet can usually only contain two less
than the total number of hosts IDs available. Again, using a subnet
mask of 255.255.255.0, we know that the octet
available for host IDs can contain the
numbers 0 through 255. But 0 is generally not
used, and 255 is normally reserved as a broadcast
address for the subnet. This means that really only
the numbers 1 through 254 are available for
assignment to a host. While this "total
number less than 2" approach is almost always
true, generally speaking, you'll refer to
the number of hosts available in a subnet
as the entire number. So even if it's understood
that two addresses aren't available for
assignment, you'd still say that 8 bits of host ID
space have 256 addresses available, not 254. This is because those other
IPs are still IP addresses, even if they aren't
assigned directly to a node on that subnet. Now, let's look at
a subnet mask that doesn't draw its boundaries
at an entire octet, or 8 bits of address. The subnet mask
255.255.255.224 would translate to 27 1s followed by 5 0s. This means that we have
five bits of host ID space, or a total of 32 addresses. This brings up a shorthand
way of writing subnet masks. Let's say we're dealing with
our old friend 9.100.100.100, with a subnet mask
of 255.255.255.224. Since that subnet mask
represents 27 1s followed by 5 0s, a quicker way of referencing
this is with the notation /27. The entire IP and subnet
mask could be written out as 9.100.100.100/27. Neither notation is necessarily
more common than the other, so it's important
to understand both. That was a lot. Make sure to go back and
watch this video again if you need a refresher. Or if you're a
total whiz, you can move on to the next video
on basic binary math. I'll see you there
or maybe here. [MUSIC PLAYING] Binary numbers can seem
intimidating at first since they look so different
from decimal numbers. But as far as the
basics go, the math behind counting, adding, or
subtracting binary numbers is exactly the same as
with decimal numbers. It's important to call
out that there aren't different kinds of numbers. Numbers are universal. There are only
different notations for how to reference them. Humans, most likely
because most of us have 10 fingers and
10 toes, decided on using a system with 10
individual numerals used to represent all numbers. The numerals 0, 1, 2,
3, 4, 5, 6, 7, 8, and 9 can be combined in ways to
represent any whole number in existence. Because there are
10 total numerals in use in a decimal
system, another way of referring to
this is as base 10. Because of the constraints of
how logic gates work inside of a processor, it's
way easier for computers to think of things only
in terms of 0 and 1. This is also known
as binary, or base 2. You can represent all
whole numbers in binary in the same way
you can in decimal. It just looks a
little different. When you count in decimal, you
move through all the numerals upward until you run out. Then you add a second column
with a higher significance. Let's start counting
at 0 until we get to 9. Once we get to 9, we
basically just start over. We add a 1 to a new
column then start over at 0 in the original column. We repeat this
process over and over in order to count
all whole numbers. Counting in binary
is exactly the same. It's just that you only
have two numerals available. You start with 0, which is
the same as 0 in decimal, then you increment once. Now you have 1, which is
the same as 1 in decimal. Since we've already run
out of numerals to use, it's time to add a new column. So now we have the number
10 which is the same as 2 in decimal. 11 is 3. 100 is 4. 101 is 5. 110 is 6. 111 is 7, et cetera. It's the exact same thing
we do with decimal, just with fewer numerals
at our disposal. When working with various
computing technologies, you'll often run into the
concept of bits, or 1s and 0s. There's a pretty simple
trick to figure out how many decimal numbers
can be represented by a certain number of bits. If you have an 8-bit number,
you can just perform the math 2 to the power of 8. This gives you
256, which lets you know that an 8-bit number can
represent 256 decimal numbers, or, put another way, the
numbers 0 through 255. A 4-bit number would
be 2 to the power of 4, or 16 total numbers. A 16-bit number would
be 2 to the power of 16, or 65,536 numbers. In order to tie this back to
what you might already know, this trick doesn't
only work for binary. It works for any number system. It's just the base changes. You might remember
that we can also refer to binary as base
2 and decimal as base 10. All you need to do
is swap out the base for what's being raised
to the number of columns. For example, let's
take a base-10 number with two columns of digits. This would translate to
10 to the power of 2. 10 to the power of
2 equals 100, which is exactly how many
numbers you can represent with two columns
of decimal digits, or the numbers 0 through 99. Similarly, 10 to
the power of 3 is 1,000, which is exactly how
many numbers you can represent with three columns
of decimal digits, or the numbers 0 through 999. Not only is counting in
different bases the same. So is simple arithmetic,
like addition. In fact, binary addition is
even simpler than any other base since you only have four
possible scenarios-- 0 plus 0 equals 0,
just like in decimal. 0 plus 1 equals 1, and
1 plus 0 equals 1-- should also look familiar. 1 plus 1 equals 10. Looks a little different
but should still make sense. You carry a digit
to the next column once you reach 10 in
doing decimal addition. You carry a digit
to the next column once you reach 2 when
doing binary addition. Addition is what's
known as an operator, and there are many
operators that computers use to make calculations. Two of the most important
operators are OR and AND. In computer logic,
a 1 represents true, and a 0 represents false. The way the OR operator works
is you look at each digit, and if either of them is
true, the result is true. The basic equation
is X OR Y equals Z, which could be read as,
if either X or Y is true, then Z is true. Otherwise, it's false. Therefore, 1 OR 0 equals
1, but 0 OR 0 equals 0. The operator AND
does what it sounds like it does-- it returns
true if both values are true. Therefore, 1 AND 1 equals
1, but 1 AND 0 equals 0, and 0 AND 0 equals 0, and so on. Now, you might be wondering
why we've covered all of this. And no, it's not to confuse you. It's all really to help explain
subnet masks a bit more. A subnet mask is a
way for a computer to use AND operators
to determine if an IP address exists
on the same network. This means that the host ID
portion is also known, since it will be anything left out. Let's use the binary
representation of our favorite IP, address 9.100.100.100,
and our favorite subnet mask, 255.255.255.0. Once you put one on top of the
other and perform a binary AND operator on each column, you'll
notice that the result is the network ID and subnet ID
portion of our IP address, or 9.100.100.100. The computer that just
performed this operation can now compare the results
with its own network ID to determine
if the address is on the same network
or a different one. I bet you never thought
you'd have a favorite IP address or subnet,
but that's what happens in the wonderful
world of basic binary math. [MUSIC PLAYING] Address classes were the
first attempt at splitting up the global internet IP space. Subnetting was introduced
when it became clear that address classes
themselves weren't a sufficient way of keeping
everything organized. But, as the internet
continued to grow, traditional subnetting
just couldn't keep up. With traditional subnetting
and the address classes, the network ID is always either
8-bit for Class A networks, 16-bit for Class B networks, or
24 bits for Class C networks. This means that there
might only be 254 Class A networks in
existence, but it also means there are 2,097,152
potential class C networks. That's a lot of entries
in a routing table. To top it all off, the
sizing of these networks aren't always appropriate for
the needs of most businesses. 254 hosts in a
Class C network is too small for many use cases. But the 65,534 hosts
available for use in a Class B network is often way too large. Many companies ended up with
various adjoining class C networks to meet their needs. That meant that
routing tables ended up with a bunch of entries for
a bunch of Class C networks that were all actually being
routed to the same place. This is where CIDR, or
Classless Inter-Domain Routing, comes into play. CIDR is an even more
flexible approach to describing blocks
of IP addresses. It expands on the
concept of subnetting by using subnet masks
to demarcate networks. To demarcate something
means to set something off. When discussing
computer networking, you'll often hear the
term "demarcation point" to describe where one network
or system ends and another one begins. In our previous model, we relied
on a network ID, subnet ID, and host ID to
deliver an IP datagram to the correct location. With CIDR, the network
ID and subnet ID are combined into one. CIDR is where we get the
shorthand slash notation that we discussed in the
earlier video on subnetting. This slash notation is also
known as CIDR notation. CIDR basically just
abandons the concept of address classes entirely,
allowing an address to be defined by only
two individual IDs. Let's take 9.100.100.100 with
a net mask of 255.255.255.0. Remember, this can also be
written as 9.100.100.100/24. In a world where we no
longer care about the address class of this IP, all we need
is what the network mask tells us to determine the network ID. In this case, that
would be 9.100.100. The host ID remains the same. This practice not
only simplifies how routers and other
network devices need to think about parts
of an IP address, but it also allows for more
arbitrary network sizes. Before, network
sizes were static. Think only Class A,
Class B, or Class C. And only subnets could
be of different sizes. CIDR allows for
networks themselves to be differing sizes. Before this, if a company needed
more addresses than a single Class C could provide, they'd
need an entire second Class C. With CIDR, they could combine
that address space into one contiguous chunk with a net
mask of /23, or 255.255.254.0. This means that
routers now only need to know one entry in
their routing table to deliver traffic to these
addresses instead of two. It's also important
to call out that you get additional available host
IDs out of this practice. Remember that you always lose
two host IDs per network. So if a /24 network has 2 to
the 8, or 256, potential hosts, you really only have
256 minus 2, or 254, available IPs to assign. If you need two networks of this
size, you have a total of 254 plus 254, or 508 hosts. A single /23 network, on the
other hand, is 2 to the 9, or 512. 512 minus 2? 510 hosts. [MUSIC PLAYING] The internet is an
incredibly impressive technological achievement. It meshes together millions
of individual networks and allows communications
to flow between them. From almost anywhere
in the world, you can now access data from
almost anywhere else, often in just fractions of a second. The way communications happen
across all these networks, allowing you to access data from
the other side of the planet, is through routing. By the end of this
lesson, you'll be able to describe the basics
of routing and how routing tables work. You'll be able to define some
of the major routing protocols and what they do and identify
nonrouteable address space and how it's used. You'll also gain an
understanding of the RFC system and how it made the
internet what it is today. All of these are
very important skills in order to troubleshoot
the networking issues you might run into
as an IT support specialist. Routing is one of
those things that is both very simple
and very complex. At a very high level, what
routing is and how routers work is actually pretty simple. But underneath the
hood, routing is a very complex and
technologically advanced topic. Entire books have been
written about the topic. Today, most intensive
routing issues are almost exclusively handled
by ISPs and only the largest of companies. We'll arm you with
the basic overview of routing to give you a
well-rounded networking education since it's an
important topic to understand, no matter what. But by no means will our
coverage be exhaustive. From a very basic
standpoint, a router is a network device
that forwards traffic depending on the destination
address of that traffic. A router is a device that has
at least two network interfaces since it has to be connected
to two networks to do its job. Basic routing has
just a few steps. One, a router receives
a packet of data on one of its interfaces. Two, the router examines the
destination IP of this packet. Three, the router then looks
up the destination network of this IP in its routing table. Four, the router
forwards that out through the interface that's
closest to the remote network as determined by additional
info within the routing table. These steps are
repeated as often as needed until the traffic
reaches its destination. Let's imagine a router
connected to two networks. We'll call the first network
Network A and give it an address space
of 192.168.1.0/24. We'll call the second
network Network B and give it an address space of 10.0.0.0/24. The router has an
interface on each network. On Network A, it has
an IP of 192.168.1.1. And on network B, it
has an IP of 10.0.0.254. Remember, IP addresses belong to
networks, not individual nodes on a network. A computer on Network A with
an IP address of 192.168.1.100 sends a packet to the
address 10.0.0.10. This computer knows
that 10.0.0.10 isn't on its local subnet,
so it sends this packet to the MAC address of
its gateway, the router. The router's
interface on Network A receives the packet because
it sees that destination MAC address belongs to it. The router then strips away the
data link layer encapsulation, leaving the network layer
content, the IP datagram. Now, the router can directly
inspect the IP datagram header for the destination IP field. It finds the destination
IP of 10.0.0.10. The router looks at its routing
table and sees that Network B, or the 10.0.0.0/24 network,
is the correct network for the destination IP. It also sees that this
network is only one hop away. In fact, since it's
directly connected, the router even
has the MAC address for this IP in its ARP table. Next, the router needs to form
a new packet to forward along to Network B. It
takes all of the data from the first IP datagram
and duplicates it. But it decrements
the TTL field by 1 and calculates a new checksum. Then it encapsulates
this new IP datagram inside of a new Ethernet frame. This time, it sets
its own MAC address of the interface on Network
B as the source MAC address. Since it has the MAC address
of 10.0.0.10 in its ARP table, it sets that as the
destination MAC address. Lastly, the packet is sent out
of its interface on Network B, and the data finally gets
delivered to the node living at 10.0.0.10. That's a pretty basic example
of how routing works, but let's make it a little
more complicated and introduce a third network. Everything else
is still the same. We have Network A, whose
address space is 192.168.1.0/24. We have Network B, whose
address space is 10.0.0.0/24. The router that bridges
these two networks still has the IPs of
192.168.1.1 on Network A and 10.0.0.254 on Network B. But let's introduce a
third network, Network C. It has an address
space of 172.16.1.0/23. There's a second
router connecting Network B and Network C.
Its interface on Network B has an IP of 10.0.0.1, and
its interface on Network C has an IP of 172.16.1.1. This time around, our
computer at 192.168.1.100 wants to send some data
to the computer that has an IP of 172.16.1.100. We'll skip the data
link layer stuff, but remember that it's
still happening, of course. The computer at 192.168.1.100
knows that 172.16.1.100 is not on its local
network, so it sends the packet to its gateway,
the router between network A and network B.
Again, the router inspects the content
of this packet. It sees a destination
address of 172.6.1.100. And through a lookup
of its routing table, it knows that the quickest way
to get to the 172.16.1.0/23 network is via another router
with an IP of 10.0.0.1. The router decrements
the TTL field and sends it along to
the router of 10.0.0.1. This router then
goes to the motions, knows that the destination
IP of 172.161.100 is directly connected,
and forwards the packet to its final destination. That's the basics of routing. The only difference
between our examples and how things work on
the internet is scale. Routers are usually connected
to many more than just two networks. Very often, your traffic may
have to cross a dozen routers before it reaches its
final destination. And, finally, in order to
protect against breakages, core internet routers are
typically connected in a mesh, meaning that there might be many
different paths for a packet to take. Still, the concepts
are all the same. Routers inspect the destination
IP, look at their routing table to determine which path is
the quickest, and forward the packet along the path. This happens over and over,
every single packet making up every single bit of traffic all
over the internet at all times. Pretty cool stuff, huh? [MUSIC PLAYING] During our earlier video
on the basics of routing, you might have noticed
a bunch of references to something known
as a routing table. Routing itself is a
pretty simple concept, and you'll find that routing
tables aren't that much more complicated. The earliest routers were just
regular computers of the era. They had two network interfaces,
bridged two networks, and had a routing table
that was manually updated. In fact, all major
operating systems today still have a routing
table that they consult before transmitting data. You could still build
your own router today if you had a computer
with two network interfaces and a manually
updated routing table. Routing tables can
vary a ton depending on the make and
class of the router, but they all share a
few things in common. The most basic routing table
will have four columns. Destination
network-- this column would contain a row
for each network that the router knows about. This is just the definition
of the remote network-- a network ID and a net mask. These could be stored in one
column inside our notation, or the network ID and net mask
might be in a separate column. Either way, it's
the same concept. The router has a
definition for a network, and therefore knows
what IP addresses might live on that network. When the router receives
an incoming packet, it examines the
destination IP address and determines which
network it belongs to. A routing table will generally
have a catchall entry that matches any
IP address that it doesn't have an explicit
network listing for. Next hop-- this is the IP
address of the next router that should receive data intended
for the destination network in question. Or this could just state the
network is directly connected and that there aren't any
additional hops needed. Total hops-- this is the crucial
part to understand routing and how routing tables work. On any complex network,
like the internet, there will be lots of different
paths to get from point A to point B. Routers try to
pick the shortest possible path at all times to ensure
timely delivery of data, but the shortest possible
path to a destination network is something that could change
over time, sometimes rapidly. Intermediary routers
could go down. Links could become disconnected. New routers could be introduced. Traffic congestion could
cause certain routes to become too slow to use. We'll get to know how
routers know the shortest path in an upcoming video. For now, it's just
important to know that for each next hop and
each destination network, the router will
have to keep track of how far away that
destination currently is. That way, when it receives
updated information from neighboring
routers, it'll know if it currently knows
about the best path or if a new, better
path is available. Interface-- the router also has
to know which of its interfaces it should forward traffic
matching the destination network out of. In most cases, routing
tables are pretty simple. The really impressive part is
that many core internet routers have millions of rows
in their routing tables. These must be consulted for
every single packet that flows through a router on its
way to its final destination. What's also
impressive is how much you've learned about routers,
routing, and routing tables. Nice work. I'll see you in the next video
on interior gateway protocols. [MUSIC PLAYING] We've covered the basics
of how routing works and how routing tables
are constructed, and they're both really
pretty basic concepts. The real magic of
routing is in the way that routing tables are always
updated with new information about the quickest paths
to destination networks. The protocols we'll be
learning about in this video will help you identify
routing problems on any network
you might support. In order to learn about
the world around them, routers use what are known
as routing protocols. These are special
protocols the routers use to speak to each other in order
to share what information they might have. This is how a router on
one side of the planet can eventually learn
about the best path to a network on the
other side of the planet. Routing protocols fall
into two main categories-- interior gateway protocols and
exterior gateway protocols. Interior gateway protocols
are further split into two categories--
link-state routing protocols and distance-vector protocols. In this video, we'll cover
the basics of interior gateway protocols. Interior gateway protocols
are used by routers to share information within
a single autonomous system. In networking terms,
an autonomous system is a collection of
networks that all fall under the control of
a single network operator. The best example
of this would be a large corporation
that needs to route data between their
many offices, and each of which might have their
own local area network. Another example is
the many routers employed by an internet
service provider, whose reaches are usually national in scale. You can contrast this with
exterior gateway protocols, which are used for the
exchange of information between independent
autonomous systems. Spoiler alert-- we'll
cover exterior gateway protocols in an upcoming video. The two main types of
interior gateway protocols are link-state routing protocols
and distance-vector protocols. Their goals are super
similar, but the routers that employ them share different
kinds of data to get the job done. Distance-vector protocols
are an older standard. A router using a
distance-vector protocol basically just takes
its routing table, which is a list of every
network known to it and how far away these
networks are in terms of hops. Then the router sends this list
to every neighboring router, which is basically every router
directly connected to it. In computer science, a
list is known as a vector. This is why a protocol that
just sends a list of distances to networks is known as a
distance-vector protocol. With a distance-vector
protocol, routers don't really know that much about the total
state of an autonomous system. They just have some
information about their immediate neighbors. For a basic glimpse into how
distance-vector protocols work, let's look at how to
routers might influence each other's routing tables. Router A has a routing table
with a bunch of entries. One of these entries is
for 10.1.1.0/24 network, which we'll refer
to as Network X. Router a believes that the
quickest path to Network X is through its own Interface 2,
which is where Router C is connected. Router A knows that sending
data intended for Network X through Interface 2 to Router
C means it'll take four hops to get to the destination. Meanwhile, router B is only two
hops removed from Network X, and this is reflected
in its routing table. Router B, using a
distance-vector protocol, sends the basic contents of
its routing table to Router A. Router A sees that Network X is
only two hops away from Router B. Even with the extra hop to
get from Router A to Router B, this means that Network
X is only three hops away from Router A if it forwards
data to Router B instead of Router C. Armed with
this new information, Router A updates its routing
table to reflect this. In order to reach Network
X in the fastest way, it should forward traffic
through its own Interface 1 to Router B. Now, distance-vector
protocols are pretty simple, but they don't
allow for a router to have much information about
the state of the world outside of their own direct neighbors. Because of this,
a router might be slow to react to a change in
the network far away from it. This is why link-state protocols
were eventually invented. Routers, using a
link-state protocol, take a more
sophisticated approach to determining the
best path to a network. Link-state protocols
get their name because each router advertises
the state of the link of each of its interfaces. These interfaces could be
connected to other routers, or they could be direct
connections to networks. The information
about each router is propagated to every other
router on the autonomous system. This means that every
router on the system knows every detail about every
other router in the system. Each router then uses this
much larger set of information and runs complicated
algorithms against it to determine what the best
path to any destination network might be. Link-state protocols
require both more memory in order to hold all of
this data and also much more processing power. This is because it has to run
algorithms against this data in order to determine
the quickest path to update the routing tables. As computer hardware has become
more powerful and cheaper over the years,
link-state protocols have mostly made distance-vector
protocols outdated. Up next, we'll talk about
exterior gateway protocols. See you there. [MUSIC PLAYING] Exterior gateway
protocols are used to communicate data between
routers representing the edges of an autonomous system. Since routers sharing data
using interior gateway protocols are all under control of
the same organization, routers use exterior
gateway protocols when they need to
share information across different organizations. Exterior gateway
protocols are really key to the internet
operating how it does today. So thanks, exterior
gateway protocols. The internet is an enormous
mesh of autonomous systems. At the highest levels,
core internet routers need to know about
autonomous systems in order to properly forward traffic. Since autonomous systems
are known and defined collections of
networks, getting data to the edge router of
an autonomous system is the number one goal
of core internet routers. The IANA, or the Internet
Assigned Numbers Authority, is a nonprofit organization
that helps manage things like IP address allocation. The internet couldn't function
without a single authority for these sorts of issues. Otherwise, anyone could try and
use any IP space they wanted, which would cause
total chaos online. Along with managing
IP address allocation, the IANA is also
responsible for a ASN, or Autonomous System
Number allocation. ASNs are numbers assigned to
individual autonomous systems. Just like IP addresses,
ASNs are 32-bit numbers. But unlike IP addresses,
they're normally referred to as just a single
decimal number instead of being split out into readable bits. There are two reasons for this. First, IP addresses need to be
able to represent a network ID portion and a host ID
portion for each number. This is more easily accomplished
by splitting the number in four sections of 8
bits, especially back in the day when address
classes ruled the world. An ASN never needs to change
in order for it to represent more networks or hosts. It's just the core
internet routing tables that need to
be updated to know what the ASN represents. Second, ASNs are
looked at by humans far less often than
IP addresses are. So because it can be useful
to be able to look at the IP 9.100.100.100 and know that
9.0.0.0/8 address space is owned by IBM, ASNs represent
entire autonomous systems. Just being able to look
up the fact that AS19604 belongs to IBM is enough. Unless you one day end up
working at an internet service provider, understanding
more details about how exterior
gateway protocols work is out of scope for
most people in IT. But grasping the basics of
autonomous systems, ASNs, and how core internet routers
route traffic between them is important to understand
some of the basic building blocks of the internet. [MUSIC PLAYING] And now, a brief history lesson. Even as far back as
1996, it was obvious that the internet was
growing at a rate that couldn't be sustained. When IP was first defined,
it defined an IP address as a single 32-bit number. A single 32-bit
number can represent 4,294,967,295 unique
numbers, which definitely sounds like a lot. But as of 2017, there are an
estimated 7.5 billion humans on Earth. This means that the IPv4
standard doesn't even have enough IP
addresses available for every person on the planet. It also can't account for
entire data centers filled with thousands and
thousands of computers required for large-scale
technology companies to operate. So in 1996, RFC
1918 was published. RFC stands for
Request For Comments and is a long-standing way for
those responsible for keeping the internet running to agree
upon the standard requirements to do so. RFC 1918 outlined a
number of networks that would be defined as
nonroutable address space. Nonroutable address
space is basically exactly what it sounds like. They are ranges of IPs set aside
for use by anyone that cannot be routed to. Not every computer
connected to the internet needs to be able to communicate
with every other computer connected to the internet. Nonroutable address space allows
for nodes on such a network to communicate with each
other, but no gateway router will attempt to forward traffic
to this type of network. This might sound super limiting,
and in some ways it is. In a future module, we'll cover
a technology known as NAT, or Network Address Translation. It allows for computers on
nonroutable address space to communicate with other
devices on the internet. But for now, let's just
discuss nonroutable address space in a vacuum. RFC 1918 defined three
ranges of IP addresses that will never be routed
anywhere by core routers. That means that they
belong to no one and that anyone can use them. In fact, since they're separated
from the way traffic moves across the internet,
there's no limiting to how many people might
use these addresses for their internal networks. The primary three ranges of
nonroutable address space are 10.0.0.0/8, 172.16.0.0/12,
and 192.168.0.0/16. These ranges are free
for anyone to use for their internal networks. It should be called out that
interior gateway protocols will route these address spaces,
so they're appropriate for use within an autonomous system,
but exterior gateway protocols will not. We've covered a
lot in this module, and congratulations to
you for sticking with it. Next up, we'll cover the
transport and application layers. But first up, another quiz. You can do it. And remember, you can always
go back and review the material as much as you need to. SPEAKER 1: Congratulations
on finishing this lesson from the Google IT
Support Certificate. Access the full experience,
including job search help, and get the official
certificate by clicking the icon or the link in the description. Watch the next lesson in
the course by clicking here and subscribe to our
channel for more lessons