Now what about subnet masks.
I've mentioned subnet masks a few times.
What is the subnet mask.
What does it do.
Well a subnet mask is used to determine which part of an IP address is the network portion and which
part of the address is the host portion.
This allows a PC for example to determine whether a device that it wants to communicate with is a remote
device or a local device.
So here's an example we have a PC with IP address 10 dot one that wanted that one and another PC with
an IP address of 10 to one to two to one when the PC on the left wants to forward traffic to the PC
on the right with the IP address tendered one to two that one.
Does the PC for the traffic onto the local segment or does it forward it to its default gateway.
If these two devices are in the same subnet they can communicate directly without the use of a default
gateway.
But if they are on different subnets the PCs will forward their traffic to their default gateways which
will do the interview LAN routing.
If they're on the local land or Local Area Network as an example all rocked the traffic if the traffic
is forwarded to a traditional router.
So at least three switch may do the routing between two villans way router my router the traffic between
these two devices.
If they are on different subnets but how would you determine if these two devices are on the same subnet
or if they're on different subnets.
Now I'm going to explain this in more detail in the next few minutes.
But as an example 10.0 wondered 1.1 and Tendo wonder 2.1 are in the same subnet if they are using a
slash 16 mosque.
However if they are using a 24 mosque that means that the devices are on different subnets.
So let me explain that in more detail in Dittrich mosque allows a device to determine once again which
portion of the address is the host portion and which portion of the address is the network portion.
This allows a local PC as an example to determine whether the device it wants to communicate with is
on a remote network and is thus reachable via the default gateway.
Or if the device is on the local subnet and therefore does not require the use of a default gateway
say PCa and PC be on the same subnet no default gateway is required.
But if they are on different subnets then a default gateway would typically be required to do the routing
between the two PCs.
So that's essentially what a network mask does.
Now as I've explained Plus a B and C networks have default mosques which are also known as natural mosques
in a class A address the first octet is the network in a class B address the first two octets are network
and with a Class C address the first three octets of the network portion.
I'll explain more complicated subnet masks in the submitting videos.
But let's first start with some simple examples.
In this example we have a class a network that hasn't been submitted across a network the default mosque
is to far 5.0 0.0.
So if we look at a address such as 10 dot one to 1 one and convert that into binary it's going to look
as follows.
Now look at the following mosque 2 4 5 in binary equates to 8 binary ones 0 in decimal equates to 8
binary zeros.
So converting the mosque into binary shows us that the network portion consists of contiguous ones or
continuous ones starting from the left hand side.
A 1 in binary in the network mosque indicates network a zero in binary in the network mosque indicates
host.
So in this example this portion of the address is a network and this portion of the address is host.
Hence this device with IP address tendered one but one that one is on network 10.00 at 0.
This is the network portion and this is the host portion.
This device with IP address 10.0 1.1 one is on network 10 so when working out the network and host portions
of an address follow these two simple rules any address bits that have a corresponding mosque that set
to one in binary represents the network in the address bits that have a corresponding mosque but set
to zero represents the host.
So one in binary means network 0 in binary means host.
So in this example 10 is the network because they are ones in the mosque in binary.
So the network ID is set to 10.
Notice these octets are populated by binary zeros that means host.
So the host ID is equal to 1 dot 1.1.
So in summary the network is 10.
The host portion of the address is 1.1 1.
Here's another example.
Remember any address bits that have a corresponding mosque but set to 1 in binary represents makework
any address bits that have a corresponding mosque but set to 0 in binary represent node ID.
So here we've got a class A address.
One got one that wanted one.
But note the difference.
The network mosque in this case is true 5 5 5.5 5.0 etc. so converting 1.1 at 1.1 to binary gives us
the following.
Taking the network mosque and converting that to binary gives us the following.
Notice 205 equates to 8 binary ones which therefore means that those Portion of The address is a network
so the network ID is one dot one and looking at the remaining part of the address which is populated
with binary zeros in the network mosque means that one door one is the host portion of the address.
In other words the network is one dot 1.0 to zero with a host portion of one.
Got one on that network.
The mosque is 2 5 5 5 0 0.
In this example its easy to see the network portion of the address because we have 2 4 5 2 5 5 in the
network mosque.
Just be aware that things can get a lot more complicated than what we are seeing in these examples.
You'll see that when we get to the submitting videos these two examples are simple because it's easy
to recognize which portion is a network and which portion is host.
In the submitting videos I'm going to show you much more complicated examples and in those examples
it's more difficult to determine which portion is network and which portion is host.
So in summary how does a device know whether another device is local remote to itself.
So the first thing it will do is check the network portion of its local address and then compare that
to the address of the other host.
If the network portion of the address is the same the local device knows that the other device is local
to itself.
If the network portion is not the same the local device knows that the other device is remote.