So in this example, are these devices in the same subnet or in different subnets?
The PC on the left has an IP address of 10.1 1.1 with a subnet mask of 255.255.0.0.
The device on the right has an IP address of 10.1 or 2.1 with a mosque of 255.255.020.
So the device on the left does the following when it wants to communicate with the device on the right.
It does a logical and on the network portion of the address.
So at first determines which portion of its address is the network portion.
And then it compares that to the network portion of the device that it's wanting to communicate with.
So in this example, the network portion is 10.1.
So in other words, the first two octets of the address on network, the device checks the first two
octets of the other device to see if it's the same as its local network portion.
And in this example, they are the same.
So the device on the left will send traffic to the device on the right directly, and it will not try
and send the traffic to its default gateway.
What it will do is send an OPP message onto the local segment requesting the MAC address associated
with IP address 10.1 to 2.1.
It will try and communicate with 10.1 or 2.1 on the local segment directly and not send the traffic
to a default gateway.
And the reason for that is that the network portion of the addresses are the same.
So the local device knows that the other device is on the same local segment as itself.
In this example, the network mosque has changed.
It's 255.255.255.0.
So the device on the left will do a logical and and check whether the network portion of the device
that it's wanting to communicate with is the same as its network portion.
So based on the subnet mask, the local devices network portion is 10.11.
The device it's wanting to communicate with has a network portion of ten .1.2.
So in this case, the network portion is different.
So the local host knows that the device that it's wanting to communicate with is on a different subnet
to itself.
So because these two devices are on different subnets, the local device will send its traffic to its
configured default.
Gateway PCs will send traffic to their default gateways when a default gateway is configured.
In this example, let's assume that a default gateway is configured, and that's normally what happens
in a real world implementation.
So the PC is trying to talk to a device in a different subnet so it'll send its traffic to its default
gateway.
So in summary, the subnet mask allows the local device to determine whether the device that it's trying
to communicate with is on the same subnet as itself or if it's on a different subnet.
Now, Cisco and most network vendors do not support just contiguous subnet masks.
A discontinuous subnet mask would look something like the following notice.
In the binary we have binary ones, then binary zeros, then binary ones, binary zeros, binary ones,
binary zeros and so forth and so on.
This type of discontinuous subnet mask is not supported, only contiguous subnet masks are supported.
In this example, we have contiguous or continuous ones in the binary and then contiguous or continuous
zeros in the binary.
Converting that to decimal gives us a value of 255 to 40.00.
In this example, notice we have contiguous ones in binary and then contiguous zeros in binary, giving
us a result in decimal of 255.255.192.0.
So in a subnet mask we must start with binary ones and they must be contiguous.
So you cannot have binary ones, then binary zeros, then binary ones and so forth and so on.
They must be contiguous ones and then contiguous zeros.
So you can't, for argument's sake, have a subnet mask, something like 0.0.0. 240.
That's not supported.
Subnet masks have to be contiguous ones, followed by contiguous zeros.
This contiguous subnet masks are not supported.
And thank.
Goodness for that because it makes our lives as a network engineers a lot easier to have.
Contiguous subnet masks.