In this section we gonna look at IP subnetting.
I’d like to teach you multiple methods for subnetting.
Subnetting is one of those subject that a lot of Network Engineers struggle with.
But in this section I hope I'll be able to simplify for you
and give you various methods.
So that any subnetting questions that you might encounter
can be completed quickly and easily.
There are 2 main parts in this section:
in the 1st part I'm gonna show you 2 methods to quickly and easily answer
questions like, what subnet is this host on or what is a last host in this subnet?
So I’m gonna teach you the binary method and then
I’m gonna teach you what I call the quick method.
I suggest that you look at both and then choose one
and get good at that specific method.
I think binary is very important to understand.
But as the quick method name indicates it’s very quick and easy
to answer subnetting questions using the quick method.
In the 2nd part I’d like to show you how to create multiple subnets
when given a specific network or subnet, so you will be able to answer questions
like subnet this network into at least 10 subnets or subnet this network
into subnets each having 10 hosts on them.
So in part 1 you'll be given an IP address and then you gonna need to learn
how to work out the subnet address, 1st host address, last host address
and the broadcast address and we'll gonna use 2 methods: the binary method
and the quick method, and as I mentioned I suggest that you choose 1 of the
2 methods, look at both, decide which one you prefer
and then learn and get good at that specific method.
So here's the typical example:
You’ve been given a host with an address of 192.168.10.18 for the /24 mask
and you’ll need to be able to answer the following questions:
what IP address with router 1 be configured with, this router being router 1
if it is to use the first IP address in the same subnet as PC 1?
Which is the PC here? The second question could be:
What broadcast address is used by PC 1?
or thirdly what IP address would router 1 be configured with if it is to use
the last IP address in the same subnet as PC1?
So the first question was, what IP address will the router use if it is
configured with the first IP address?
And the third one is: what IP address would it be configured with if it were
configured with the last IP address in the subnet?
And fourthly, a question could be what subnet is PC 1 part of?
so you should within 30 to 60 seconds be able to answer those question
and I’m gonna show you how to do that now.
So the first method is to use binary to work out the answers.
I personally prefer binary because it's used all over the place in networking.
And I want you get your head around how binary works.
It will save you a lot of time in the long run.
Please refer to the binary section of this course
if you are not sure about the basics of binary.
we are going to assume knowledge of binary now
we're just gonna use binary to work out the answer to those questions.
In the binary method, you need to remember 4 rules
to work out the network with subnet address
you fill the host portion of the address with binary 0's
So you work out which part is network and which part is host
and you fill the host portion with binary 0's.
To work out the broadcast address,
you fill the host portion of the address with binary 1's.
To work out the first host in the subnet, you fill the host portion of the
address with binary 0's except for the very last bit which is set to a binary 1.
And to work out the last host in the subnet, you fill the host portion of the
address with binary 1's except for the last bit which is set to binary 0.
If you remember those 4 rules, you will be able to work out the answer to any
of those questions very quickly.
So let’s start the basic example.
We have a PC with an IP address 192.168.1.18/24 or it could be written as
192.168.1.18 with the mask of 255.255.255.0
As you learnt in the IP addressing section, these 2 are equivalent subnet mask.
It's very similar to saying tomato or tomato or router or router.
It means the same thing it's just a different way of displaying the subnet mask.
Now hopefully you remember that 24 means 24 bits in the subnet mask
in other word 8 bits in the first octet, 8 bits in the second octet
and the 8 bits in the third octet. That means the first 3 octets are network.
So 192.168.1 is the network portion of the address and this last octet is the
host portion and that’s how I’ve written it here.
The first 3 octets are displayed in black representing the network portion and
the last octet is shown in red which represents the host portion of the address.
There’s no point converting the network portion into binary.
So I’ve just left as it is, so the subnet is equal to 192.168.1.
and if you remember back to our rules to get the subnet,
you fill the host portion of the address with binary 0's
So this is the single octet, so 8 binary 0's need to fill that host portion.
If you convert 8 binary 0's back into decimal you'll get the value 0.
So the subnet is 192.168.1.0 for this specific IP address.
To get the first host in the subnet, you fill the host portion of the address
with binary 0's except for the last bit which make binary 1.
So an octet once again is 8 bits.
So there are 7 binary 0's followed by single binary 1.
Converting that back to decimal you get 1,
so the first host in this subnet is 192.168.1.1
To work out the last host, fill the host portion of the address with binary 1's
except for the last bit you set to binary 0
That's 7 binary 1's followed by binary 0, if you convert that back to decimal
you'll get the value 254.
So the very last host in this subnet is 192.168.1.254
To get the broadcast address, fill the host portion of the address
with binary 1's, so single octet fill with binary 1's is equal to 255 in decimal
So there you have it. We can work out the subnet, the first host, the last host
and the broadcast address very quickly and easily using the binary method.
So if you were ask to configure the 1st IP address in the same subnet as PC 1
on the routers interface you would know that you need to configure the IP address
192.168.1.1/24 or 192.168.1.1 255.255.255.0
You could be expected to type the commands unto the router to configure it with
the relevant IP address, later in this course you'll learn the commands to do that
But for now, realize that you might need to work out first, last, broadcast and
subnet addresses When giving a specific IP address.
This is our first example using the binary method
I’d like to show you more complicated example now.
So in this example you've been given an IP address 172.16.35.123/20
or in other words 255.255.240.0
This is a little bit more complicated because the mask
does not fall on the octet boundary,
in other words, it's not a simple /8 or /16 or /24 subnet.
The network and host portion lies somewhere in the third octet.
So just to reiterate, /20 means that 20 bits of the 32 bit IP address
which are used for networks or subnet portion and the remaining 12 bits are used
as the host portion of the address.
So somewhere in the third octet, the network host portion changes.
So once again our IP address is 172.16.35.123/20
Now the first octet is 8 bits in size , the second octet is 8 bits in size.
So adding those together you get 16 bits.
The third octet is 8 bits in size, so adding those 3 together gives you 24 bits.
So /20 in the subnet mask means that the split between subnet
and host occurs somewhere in the third octet.
So once again the first octet is 8 bits, second octet is 8 bits thus
20 bits puts the split somewhere in the third octet.
So what you need to do is convert the third and fourth octet
into binary because they both have host bits.
There’s no need to convert the first 2 octets into binary
because no host bits are found in the first 2 octets.
So 00100011 is the binary equivalent of decimal 35, 0 followed by 4 binary 1's
followed by 0 followed by 2 binary 1's is the binary equivalent of decimal a 123.
So all we’ve done is convert 35 and 123 into their binary equivalents.
Please see the binary section of this course if you are not
sure how to convert decimal into binary and back again.
20 bits of subnet mask put us in this position because we have 8 bits
plus 8 bits in the first 2 octets which give us a total
of 16 binary bits plus 1 is 17 plus 1 is 18 plus 1 is 19 plus 1 is 20
So we can draw a line at this point to split the network and host portion
To the left of this line, the binary bits indicate network or subnet,
to the right of this line the binary bits indicates host.
So there are split between network and host portions in this address at this line.
So to work out the answers you need to remember the 4 rules.
The first rule states that, to work out the network or subnet address,
you need to fill the host portion of the address with binary 0's.
So to the right of the line we need to fill
this entire portion of the address with binary 0's.
So once again 20 bits of subnet mask put us in this position
and we fill everything to the right with binary 0's.
So we end up having 172.16 the first 4 bits of the third octet
remain the same and all remaining bits are set to binary 0.
When you convert that back to decimal, please note firstly that these 4 bits
in red plus the following 4 bits in green are part of the third octet.
So 0010 followed by 0000 when converted from binary
to decimal gives us a value of 32. The fourth octet is filled with 0's.
So converting an octet filled with binary 0's to decimal give us a value of 0.
So the subnet address is 172.16.32.0
Now to work out the first host address, fill the host portion of the address
with binary 0's except for the last bit which is set to binary 1.
So here you go, the first host is equal to 172.16.0010
remember, we don’t touch this portion of the address, we only change the host
portion of the address, so we fill the host portion with binary 0's
except for the last bit which we set to binary 1.
Once again the third octet consist of 4 binary bits which are part of the network
or subnet and 4 binary bits which a part of the host portion.
Those 4 red binary bits together with those 4 green binary bits
give us a decimal value of 32.
The last octet is 7 binary 0's followed by single binary 1
which is equal to decimal 1, so the first host address is 172.16.32.1
To work out the last host address, fill the host portion of the address
with binary 1's except for the last bit which is set to binary 0.
So the last host is equal to 172.16.0010 followed 4 binary 1's, in the third octet
followed by 7 binary 1's in the fourth octet and then lastly a binary 0.
So the third octet consist of this 4 red bits and this 4 green bits.
So if you convert 0010 followed by 4 1's into decimal
you'll get the decimal equivalent which is 47, 7 binary 1's
followed by binary 0, gives you the equivalent decimal value of 254.
So the last host in this subnet is 172.16.47.254
To work out the broadcast address, fill the host portion
of the address with binary 1's.
So the broadcast address is equal to 172.16.0010
Once again, the network and subnet portion are left as is.
And then you fill the host portion with binary 1's.
So the third octet is equal to 0010 and 4 binary 1's
which once again gives you the decimal equivalent of 47.
8 binary 1's in octet gives you the decimal value 255.
So the broadcast address would be 172.16.47.255
So in summary, an address of 172.16.35.123 with the subnet mask of /20 resides
on subnet 172.16.32.0 and has a broadcast address of 172.16.47.255
the first host in the same subnet is 172.16.32.1
and the last host in the same subnet is 172.16.47.254
This was a slightly more complicated example, but I’m hoping that by now
you have learned the process to work out subnet first host, last host and
broadcast address when given an IP address and its subnet mask.