Guide to Internet Protocol

blackstartNetworking and Communications

Oct 26, 2013 (5 years and 2 months ago)


Guide to Internet Protocol

In networking and communications, a protocol is the formal specification that defines the procedures that must be
followed when transmitting or receiving data. Protocols define the format, timing, sequence, and error checking
ed on the network.

In plain English, the above means that if you have two or more devices that want to communicate, they need a
common protocol, or set of rules, that guides the computers about how and when to talk to each other.

Protocols are defined by

RFCs (requests for comments), in which the IETF maps out the new standard or
protocol. Vendors (IBM, Cisco, Microsoft, Novell) then follow these standards and implement them in their

There are hundreds of protocols out there, and it is impossib
le to list them all here. Instead we have included the
most common and will follow up with more specialized protocols in future articles.

The table below shows the most popular TCP/IP protocols. The OSI model shows at which layer each of these
protocols w

One thing to keep in mind is that as you move from the lower layers (Physical) to the upper layers (Applications),
the device that's dealing with the protocol will require more processing time.

TCP/IP protocol stack ..................The OSI model

The series focus
es on all things IP...

Lesson 1: Introduction to IP

Lesson 2: Binary and the Internet Protocol

Lesson 3: The Internet Protocol (IP) header

Lesson 4: Internet Protocol classes

Network and host ID

Lesson 5: Introduction to subnetting

Lesson 6: IP subnetting

The basic concepts

Lesson 7: Subnet masks and their effect

Lesson 8: Subnetting analysis

Lesson 9: Subnet routing and communications

Lesson 10: Subnetting guidelines

Protocols, Lesson 1: Introduction to the Intern
et Protocol

Perhaps one of the most important and well known protocols is Internet Protocol, or IP. IP gives us the ability to
uniquely identify each computer in a network or on the Internet.

When a computer is connected to a network or the Internet, it
is assigned a unique IP address. If you're
connecting to the Internet, chances are you're given an IP automatically by your ISP. If you're connecting to a
LAN, then you're either given the IP automatically or you manually configure the workstation with an
assigned IP.

I can't overemphasize the importance of fully understanding IP if you really want to know how network
communications work. DNS, FTP, SNMP, SMTP, HTTP and a lot of other protocols and services rely heavily on
IP in order to function correctly,

so you can immediately see that IP is more than just an address on your

Now, because IP is a HUGE subject and it's impossible to cover in one or two pages, I decided to split it into a few
different sections in order to make it easy to read
and learn about.

Here is a summary of what's covered:

Binary and the Internet Protocol: Here we cover a few basic Binary concepts and get to see how Binary and IP fit

Lesson 2: Binary and the Internet Protocol

Internet Protocol header: Find out how IP fits in the OSI model. This article also includes a detailed 3
D diagram
of the IP header.

Lesson 3: The Internet Protocol header

Internet Protocol classes: We explain the five different IP classes and analyze them in Binary. You'll also learn
about the network ID and host ID in an IP address.


4: Internet Protocol classes

Network and host ID

Subnetting: This is one of the most important things you should know. You'll find a detailed explanation on how
subnetting works, along w
ith simple and complicated examples. You should be comfortable with the first three
sections in order to understand this section.


5: Introduction to subnetting


6: IP subnetting

The basic concept


7: Subnet masks and their effect


8: Subnetting analysis


9: Subnet routing and communications


10: Subnetting guidelines

ocols, Lesson 2: Binary and the Internet Protocol

To understand the Internet Protocol, we need to learn and understand Binary. An important part of IP is
subnetting, which can only be explained and understood when an IP address is converted to Binary. A lo
t of
people are not aware that computers do not understand words, pictures and sounds when we interact with them
by playing a game, reading or drawing something on the screen. The truth is that all computers can understand is
zeros and ones. What we see on

the screen is just an interpretation of what the computer understands, so the
information displayed is useful and meaningful to us.

Binary: Bits and bytes

Everyone who uses the Internet would have, at one stage or another, come across the "Byte" or "Bit
" term. This
most frequently happens when you're downloading; you get the speed indication in bytes or Kbytes per second.
We are going to see exactly what a Bit, Byte and Kbyte is, so you understand the terms.

To put it as simply as possible, a Bit is th
e smallest unit/value of Binary notation. The same way we say 1 cent is
the smallest amount of money you can have, a Bit is the same thing but in Binary.

A Bit can have only one value, either a one or a zero. So if I gave you a value of zero (0) then you

would say that
is one Bit. If I gave you two of them (00), you would say that's two Bits.

Now, if you had eight zeros or ones together, as in 0110 1010 (I put a space in between to make it easier for the
eyes), you would say that's 8 Bits or one Byte. Y
es, that is correct; eight Bits are equal to one Byte. It doesn't
matter if they are all ones or zeros or a mixture of the two.

The picture below gives you some examples:

To sum this all up, 1024 Bytes equal 1 Kbytes (Kilobyte). Why 1024 and not 1000? Well it's because of the way
Binary works. If you did the math, you would find the above correct.

So, what's binary got to do with IP?

Well, just as I explained in the introduction, computers display the zeros and ones in a way that makes the
information useful to us. IP works a bit like this as well, where 98% of the time we see it in a decimal notation, but
the computer understands it i
n binary. The picture below gives you an example of how a computer understands
an IP address:

The above example shows an IP address in

decimal notation, which we understand more easily. This IP address
( is then converted to Binary, which is what the computer understands. You can see how big the
number gets. It's easier for us to remember four different numbers than 32 zeros
or ones.

Now, keeping in mind what we said earlier about Bits and Bytes, have you ever heard or read people saying that
an IP address is a 32 Bit address? It is, and you can now see why:

So to sum up all the above, we now know what Binary notation is, what a Bit, Byte and Kbyte is and how Binary
relates to an IP address, which is usually represented in its decimal notation.

ing the conversion between decimal and binary

Now we're going to look at how the conversion works between decimal and binary. This is an important step,
because you'll probably find yourself in need of such a conversion when dealing with complex subnets.

The conversion is not that hard once you grasp the concept. The picture below shows an IP address that we are
going to convert to Binary. Keep in mind that the method I'm going to show you is the same for all conversions.
We are now going to convert the f
irst octet in the IP address to Binary/ In other words, we take the
"192" and convert it to Binary. We are not going to have to do any difficult calculations, just simple additions:

If you have read and understood the first section of this page, you should know that we need eight bits to create
one octet or, if you like, the 192 number. Each bit takes a certain value which ne
ver changes, and this value is
shown in purple, right above the bit. We then select the bits we need in such a way that the sum of all selected
bits gives us the decimal number we need.

If you wanted to explain the conversion in mathematical terms, you wo
uld say that each bit is a power of 2 (2^),
for example, bit 8 is actually '2^7' = 128 in decimal, bit 7 is '2^6 = 64 in decimal, bit 6 is '2^5' = 32 in decimal, bit 5
is '2^4' = 16 in decimal, bit 4 is '2^3' = 8 in decimal, bit 3 is '2^2' = 4 in decimal,
bit 2 is '2^1' = 2 in decimal, and bit
1 is '2^0' = 1 in decimal.

Note: When calculating the decimal value of an octet (192 in the example above), the Bit numbers do NOT
represent the power of two value we must use in order to get the decimal value. This

means that Bit 1 does NOT
translate to 2^1=1 in decimal.

In our example, we used the 192. As you saw, we needed bits 8 and 7 and this gave us the Binary number of
11000000, which is 192 in decimal. You must remember that the values of each bit never cha
nge. For example,
bit 8 always has a decimal value of 128, whereas bit 1 always takes the value of 1. Using this method, you will
find it easy to convert decimal to Binary without the need for complex mathematical calculations.

So let's have a look at th
e next octet, which is the decimal number 168:

Here again you can see that we needed to choose bits 8, 6 and 4 (in other words put a "
1" in the bit's position) in
order to get a decimal value of 168. So the Binary value of 10101000 is equal to the decimal value of 168.

Let's now look at all 4 octets of our IP address, in Binary:

No matter which way you convert, from Decimal to Binary or Binary to Decimal, the same method is used. If you
understood the above, you should be able to convert any Binary or Decimal number.

Protocols, Lesson 3: The Internet Protocol header


Just like every other protocol, IP has a place in the OSI model. Because it's such an important protocol and other
protocols depend upon it, IP needs to be placed before them in the OSI mode
l. That's why you will find it in Layer

When a computer receives a packet from the network, the computer will first check the desti
nation MAC address
of the packet at the Datalink Layer (2). If it passes, it's then passed on to the Network layer.

At the Network layer, it will check the packet to see if the destination IP address matches the computer's IP
address. (If the packet is a

broadcast, it will pass the network layer anyway.)

From there, the packet is processed as required by the upper layers.

On the other hand, the computer may be generating a packet to send to the network. Then, as the packet travels
down the OSI model a
nd reaches the Network layer, the destination and source IP address of this packet are
added in the IP header.

The IP header

Now we are going to analyze the Internet protocol header, so you can see the fields it has and where they are
placed. In here you

will find the destination and source IP address field which is essential to every packet using
the protocol.

It's worth noting that the 9th field, which is the "Protocol" field, contains some important information that the
computer uses to find out where it must pa
ss the datagram once it strips off the IP header.

If you remember, TCP and UDP exist on Layer 4 of the OSI Model, which is the transport layer. When data
arrives at a computer and the packet is processed by each layer, it needs to know whereabouts above
to pass the
data. This protocol field tells the computer to give the remaining data to either the TCP or UDP protocol, which is
directly above it.

The destination IP address is another important field which contains the IP address of the destination mach

Protocols, Lesson 4: Internet Protocol classes

Network and host ID


Every protocol suite defines some type of addressing that identifies computers and networks. IP addresses are no
exception to this rule. There are certain values that

an IP address can take; these have been defined by the IEEE

A simple IP address is a lot more than just a number. It tells us the network of which the workstation is part and
the node ID.

IP address classes and structure

When the IEEE committ
ee sat down to sort out the range of numbers that were going to be used by all
computers, they came up with five different ranges or, as we call them, "classes" of IP addresses. When someone
applies for IP addresses they are given a certain range within a
specific class depending on the size of their
network. To keep things as simple as possible, let's first have a look at the five different classes:

In the above table, you can see the five classes. Our first class is A and our last is E. The first three classes (A, B
and C) are used to identify workstations, routers, switches and other devices, whereas the last two classes (D and
E) are

reserved for special use.

An IP address consists of 32 Bits, which means it's four Bytes long. The first octet (first eight bits or first byte) of
an IP address is enough for us to determine the class to which it belongs. And, depending on the class to w
the IP address belongs, we can determine which portion of the IP address is the network ID and which is the node

For example, if I told you that the first octet of an IP address is "168," then, using the above table, you would
notice that it fall
s within the 128
191 range, which makes it a class B IP address.

Understanding the classes

We are now going to take a closer look at the five classes. Earlier I mentioned that companies are assigned
different IP ranges within these classes, depending on t
he size of their network. For instance, if a company
required 1000 IP addresses, it would probably be assigned a range that falls within a class B network rather than
a class A or C.

The class A IP addresses were designed for large networks, class B for m
edium size networks and class C for
smaller networks.

Introducing network ID and node ID concepts

We need to understand the network ID and node ID concept because it will help us to fully understand why
classes exist. Putting it as simply as possible, an
IP address gives us two pieces of valuable information:

1) It tells us which network the device is part of (network ID).

2) It identifies that unique device within the network (node ID).

Think of the network ID as the suburb you live in and the node ID
as your street in that suburb. You can tell
exactly where someone is if you have their suburb and street name. In the same way, the network ID tells us to
which network a particular computer belongs and the node ID identifies that computer from all the res
t that reside
in the same network.

The picture below gives you a small example to help you understand the concept: Explanation:

In t
he above picture, you can see a small network. We have assigned a class C IP range for this network.
Remember that class C IP addresses are for small networks. Looking now at Host A, you will see that its IP
address is The network ID portion o
f this IP address is in blue, while the host ID is in orange.

I suppose the next question someone would ask is: How do I figure out which portion of the IP address is the
network ID and which is the host ID?

That's what we are going to answer next.

network and node ID of each class

The network class helps us determine how the four byte, or 32 bit, IP address is divided between network and
node portions.

The table below shows you (in binary) how the Network ID and Node ID changes depending on the cla


The table above might seem confusing at first but it's actually very simple. We will take class A as an example
analyze it so you can understand exactly what is happening here:

Any class A network has a total of 7 bits for the Network ID (bit 8 is always set to 0) and 24 bits for the Host ID.
Now all we need to do is calculate how much seven bits is:

2 to the powe
r of 7 = 128 networks and for the hosts : 2 to the power of 24 = 16,777,216 hosts in each network, of
which two cannot be used because one is the Network Address and the other is the network broadcast address
(see the table towards the end of this page). T
his is why when we calculate the "valid" hosts in a network we
always subtract "2". So if I asked you how many "valid" hosts can you have a on class A network, you should
answer 16,777,214 and NOT 16,777,216.

Below you can see all this in one picture:

The same story applies for the other two classes we use, that's class B and class C, the only difference is that the
number of networks
and hosts changes because the bits assigned to them are different for each class.

Class B networks have 14 bits for the network ID (Bits 15, 16 are set and can't be changed) and 16 bits for the
host ID, that means you can have up to '2 to the power of 14'

= 16,384 networks and '2 to the power of 16' =
65,536 hosts in each network, of which two cannot be used because one is the network address and the other is
the network broadcast address (see the table towards the end of this page). So if I asked you how
many "valid"
hosts can you have on class B network, you should answer 65,534 and NOT 65,536.

Class C networks have 21 bits for the ne
twork ID (Bits 22, 23, 24 are set and can't be changed) and eight bits for
the host ID, that means you can have up to '2 to the power of 21' = 2,097,152 Networks and '2 to the power of 8' =
256 hosts in each network, of which two cannot be used because one

is the network address and the other is the
network broadcast address (see the table towards the end of this page). So if I asked you how many "valid" hosts
you can have on class C network, you should answer 254 and NOT 256.

Now, even though we have thre
e classes of IP addresses that we can use, there are some IP addresses that
have been reserved for special use. This doesn't mean you can't assign them to a workstation but in the case that
you did, it would create serious problems within your network. For

this reason it's best to avoid using these IP

The following table shows the IP addresses that you should avoid using:

IP address



Refers to the default route. This route is to simplify routing tables used by IP.


Reserved for Loopback. The Address is often used to refer to the
local host. Using this Address, applications can address a local host as if it
were a remote host.

IP Address with all
host bits

set to "0"
Network Address
. 192.168.

Refers to the actual network itself. For example, network can be
used to identify network 192.168. This type of notation is often used within
routing tables.

IP Address with all
node bits

set to "1"
Subnet / Network
) e

IP Addresses with all node bits set to "1" are local network broadcast
addresses and must

be used.

Some examples: (Class A), (Class B), (Class C). See "
" & "
" for more info.

IP Address with
all bits

set to "1" (Network
Broadcast) e.g.

The IP Address with all bits set to "1" is a broadcast ad
dress and must

be used. These are destined for all nodes on a network, no matter what IP
address they might have.

Now make sure you keep to the above guidelines because you're going to bump into a lot of problems if you


imperative that every network, regardless of Class and size, has a Network Address
(first IP address e.g. for Class C network) and a Broadcast Address (last IP address e.g. for Class C network), as mentioned in the table and expl
anation diagrams above, which

be used.

So when calculating available IP addresses in a network, always remember to subtract 2 from the number of IP
addresses within that network.

Protocols, Lesson 5: Introduction to subnetting

Subnetting is one

of my favorite subjects. It can be as simple as 1, 2, and 3 or as complex as trying to get free
tech support from Microsoft.

Subnetting is a very interesting and important topic. I gather that most of you have heard about it or have some
idea what it's a
ll about. For those who haven't dealt with subnets before... hang in there because you're not alone!

For some reason a lot of people consider subnetting to be a difficult subject. This is true to some extent, but I
must say that I think that most of them
see it that way because they do not have a solid foundation in networking.
If you read my previous articles in this section, then you DO have a solid foundation.

Some advice

If you started reading about IP on this site from the beginning and have understo
od everything, then you won't
have any problem understanding subnetting. On the other hand, if you do not understand what we have been
talking about in the previous pages, you will find this part somewhat difficult. Whichever the case, I'm going to try

explain subnetting as simply as possible and hope to answer all your questions.

Now, because subnetting is a big topic to talk about and analyze in one page, I've split it into a few sections.
Logically, as you move on to higher sections, the concepts an
d material difficulty will increase:

Lesson 6: Basic subnetting concepts
. This section is to help you understand what a subnet really is.
Introduction to the default s
ubnet masks is covered first, and then you get to see and learn how the network is
affected by changing the subnet mask. There are plenty of diagrams to ensure that you get the picture right.

Lesson 7: Subnet masks and their effect
. Here we will look at the default subnet mask in a bit more detail
and introduce a few new concepts. Classless and classful IP addresses are covered here and you'll learn how the
subnet mask
affects them.

Lesson 8:

subnet mask bits
. Detailed analysis of subnet masks bits. Learn to recognize the number of
bits in a subnet mask, followed by an introduction to complex s

Lesson 9:

and communications between subnets
. Understand how routers deal with subnets,
how computers which are in different subnets can communicate w
ith each other, and a few general notes
on subnetting that you should know.

Lesson 10:

. Some last information to help you plan your new networks

and a
few things to keep in mind so you can avoid future problems with subnets.

Protocols, Lesson 6: IP subnetting

The basic concepts

What is subnetting?

When we subnet a network, we basically split it into smaller networks. For example, when a set

of IP addresses is
given to a company, the company might want to "break" (the correct term is "partition") that one network into
smaller ones, one for each department. This way, the technical department and management department can
each have a small netw
ork of their own. By subnetting the network, we can partition it to as many smaller
networks as we need. This also helps reduce traffic and hides the complexity of the network.

By default, all type of classes (A, B and C) have a subnet mask; we call it th
e default subnet mask. You need to
have one because:

1) All computers need the subnet mask field filled when configuring IP

2) You need to set some logical boundaries in your network

3) You should at least enter the default subnet mask for the class you
're using

In the previous pages I spoke about IP classes, network IDs and host IDs. The subnet mask is what determines
the network ID and host ID portion of an IP address.

The table below shows clearly the subnet mask that applies for each network class.

When dealing with subnet masks in the real world, we are free in most cases to use any type of subnet mask in
order to meet our need
s. If, for example, we require one network which can contain up to 254 computers, then a
class C network with its default subnet mask will do fine. If we need more, then we might consider a class B
network with its default subnet mask.

Note that the defau
lt subnet masks have been set by the IEEE committee, the same guys that set and approve
the different standards and protocols.

We will have a closer look at this later on and see how we can achieve a class C network with more than 254

g the concept

Let's stop here for one moment and have a look at what I mean by partitioning one network into smaller ones by
using different subnet masks.

The picture below shows our example network ( All computers here have been configured w
ith the
default class C subnet mask (

Because of the subnet mask we used, all these computers are part of the one netw
ork marked in blue. This also
means that any one of these hosts (computers, router and server) can communicate with each other.

If we now wanted to partition this network into smaller segments, then we would need to change the subnet mask
appropriately so

we can get the desired result. Let's say we needed to change the subnet mask from to on each configured host.

The picture below shows us how the computers will see the network once the subnet mask has changed:

In reality, we have just created eight networks from the one large (blue) network we had, but I am keeping things
simple for now and showing only t
wo of these smaller networks because I want you to understand the concept of
subnetting and see how important the subnet mask is.

In the following pages we'll analyze in great depth the way subnetting works and how to calculate it. It is very
important th
at you understand the concepts introduced in this section, so make sure you do, before continuing!

Protocols, Lesson 7: Subnet masks and their effect

There are a few different ways to approach subnetting, and it can get confusing because of the complex
ity of
some subnets and the flexibility they offer. For this reason I created this little paragraph to let you know how we
are going to approach and learn subnetting.

We are going to analyze the common subnet masks for each class, giving detailed examples

for most of them
and allowing you to "see" how everything is calculated and understand the different effects a subnet mask can
have as you change it. Once you have mastered this, you can then go on and create your custom subnet masks
using any type of cla

Default subnet masks of each class

By now you should have some idea what the subnet mask does and how it's used to partition a network. What
you need to keep in mind is that each class has its DEFAULT subnet mask, which we can change to suit our
. I have already mentioned this in the previous page, but we need to look into it in a bit more detail.

The picture below shows our three network classes with their respective default subnet masks:

The effect of a subnet mask on an IP address

In the IP classes page we analyzed and showed how an IP address consists of two parts, 1) The network ID and
2) The host ID. This rule applies fo
r all IP addresses that use the default subnet mask, so we call them classful IP

We can see this once again in the picture below, where the IP address is analyzed in binary, because this is the
way you should work when dealing with subnet masks

We are looking at an IP address with its subnet mask for the first time. What we have done is take the decimal
subnet mask and conv
erted it to binary, along with the IP address. It is essential to work in binary because it
makes things clearer and we can avoid making silly mistakes. The ones (1) in the subnet mask "lock" or, if you
like, define the network ID portion. If we change any

bit within the network ID of the IP address, then we
immediately move to a different network. So in this example, we have a 24 bit subnet mask.


All class C classful IP addresses have a 24 bit subnet mask (

All class B classful IP a
ddresses have a 16 bit subnet mask (

All class A classful IP addresses have an 8 bit subnet mask (

On the other hand, the use of an IP address with a subnet mask other than the default results in the standard host
bits (the Bits u
sed to identify the HOST ID) being divided in to two parts: a subnet ID and Host ID. These types of
IP addresses are called classless IP addresses.

In order to understand what a "classless IP address" is without getting confused, we are going to take the
IP address as above, and make it a classless IP address by changing the default subnet mask:

Looking at the picture above you wi
ll now notice that we have a subnet ID, something that didn't exist before. As
the picture explains, we have borrowed three bits from the host ID and used them to create a subnet ID.
Effectively we partitioned our class C network into smaller networks.


you're wondering how many smaller networks, you'll find the answer on the next page. I prefer that you
understanding everything here rather than blasting you with more subnet ID's, bits and all the rest :)


In this page we saw the default subnet m
ask of each class and also introduced the classful and classless IP
addresses, which are a result of using various subnet masks.

When we use IP addresses with their default subnet masks, e.g. is a class C IP address so the
default subnet mask

would be, then these are "classful IP addresses."

On the other hand, classless IP addresses have their subnet mask modified in a way so that there is a "subnet
ID". This subnet ID is created by borrowing bits from the host ID portion.

picture below shows us both examples:

I hope that you have understood the new concepts and material on this page. Next we are going t
o talk about
subnet bits, learn how to calculate how many bits certain subnet masks are and see the different and most used
subnet masks available.

If you think you might have not understood a few sections throughout this page, I would suggest you read it

more :)

Protocols, Lesson 8: Subnetting analysis

We have already covered subnetting in some depth, but there is still much to learn. We are going to explain the
available subnet masks and analyze a class C network using a specific subnet mask. I
t's all pretty simple, as long
as you understand the logic behind it.

Understanding and analyzing different subnet masks

OK, so we know what a subnet mask is, but we haven't spoken (yet) about the different values they take, and the
guidelines we need whe
n we use them. That's what we are going to do here.

You cannot take any subnet mask you like and apply it to a computer or any other device, because depending on
the random subnet mask you choose, it will either create a lot of routing and communication p
roblems, or it won't
be accepted at all by the device you're trying to configure.

For this reason, we'll look at the various subnet masks so you know exactly what you need to use, and how to use
it. Most important, we are going to make sure we understand
WHY you need to choose specific subnet masks
depending on your needs. Most people simply use a standard subnet mask without understanding what that does.
This is not the case for the visitors to this site.

Let's first have a look at the most common subnet

masks, and then I'll show you where the numbers come from:

Common subnet masks

In order to keep this place tidy, we are going to see the common subnet masks for each class. Looking at each
class's subnet mask is possibly the best and easiest way to learn


Numer of bits

Class A

Class B

Class C


(default mask)


.0.0 (

.0 (


.0.0 (


.0 (




.0.0 (

.0 (




.0.0 (

.0 (




.0.0 (

.0 (




.0.0 (

.0 (




.0.0 (

.0 (




.0.0 (

.0 (


) *
Only 1 Host per subnet


.0.0 (

.0 (


) *
Reserved for Broadcasts

The above table might seem confusing at first, but don't despair! It's simple; really, you j
ust need to look at it in a
different way!

The trick to understanding the pattern of the above table is to think of it in the following way: Each class has its
default subnet mask, which I have noted using the green color, and all we are doing is borrowin
g a bit at a time
(starting from 1, all the way to 8) from the host ID portion of each class. I have used various colors to show you
the decimal numbers that we get each time we borrow a bit from the host ID portion. If you can't understand how
these decim
al numbers work out, then you should read up on the Binary & IP page.

Each time we borrow a bit from the Host ID, we split the network into a different number of networks. For
example, when we borrowed three bits in the class C network, we ended up partit
ioning the network into eight
smaller networks. Let's take a look at a detailed example (which we will break into three parts) so we can fully
understand all the above.

We are going to do an analysis using the class C network and three bits which we took
from the host ID. The
analysis will take place once we convert our decimal numbers to binary, something that's essential for this type of
work. We will see how we get eight networks from such a configuration and their ranges!

In this first part, we can see clearly where the eight networks come from. The rule applies to all types of subnets,
no matter what class they are. Simply take the

subnet bits and place them into the power of two and you get your

Now, that was the easy part. The second part is slightly more complicated and I need you focused so you don't
get mixed up!

At first the diagram below seems quite complex, so tr
y to follow me as we go through it:

The IP address and subnet mask is show in binary format. We focus on the last octet which contain
s all the
information we are after. Now, the last octet has two parts, the subnet ID and host ID. When we want to calculate
the subnets and hosts, we deal with them one at a time. Once that's done, we put the subnet ID and host ID
portion together so we ca
n get the last octet's decimal number.

We know we have eight networks (or subnets) and, by simply counting or incrementing our binary value by one
each time, we get to see all the networks available. So we start off with 000 and finish at 111. On the righ
t hand
side I have also put the equivalent decimal number for each network.

Next we take the host ID portion, where the first available host is 0 0001 (1 in Decimal), because the 0 0000 (0 in
Decimal) value is reserved as it is the network address (see IP

classes page), and the last value which is 1 1111
(31 in decimal) is used as a broadcast address for each subnet (see Broadcast page).


I've given a formula in the IP classes page that allows you to calculate the available hosts, that's exactly what

are doing here for each subnet. This formula is :2 to the power of X
2. Where X is the number of bits we have in
the host ID field, which for our example is 5. When we apply this formula, we get 2 to the power of 5

2 = 30 Valid
(usable) IP addresses
. If you're wondering why we subtract 2, it's because one is used for the Network Address of
that subnet and the other for the Broadcast Address of that subnet. This shouldn't be new news to anyone :)

Summing up, these are the ranges for each subnet in ou
r new network:

I hope the example didn't confuse you too much; the above example is one of the simplest type, which is why I
chose a class C network, they are the easiest to work with.

If you did find it somewhat difficult, try to read over it slowly. After a few t
imes, you will get to understand it. These
things do need time to sink in!

Protocols, Lesson 9: Subnet routing and communications

We have analyzed subnetting and understood how it works, but haven't yet dealt with the "communication" side of
things. Th
is will be analyzed here. It's an easy and very interesting page, so sit back and read through it

Communication between subnets

After reading all the previous pages about subnetting, let me ask you the following:

Do you think computers that
are on the same physical network but configured to be on separate subnets are able
to communicate?

The answer is "no". Why? Simply because you must keep in mind that we are talking about the communication
between two different networks!

Looking at our ex
ample of the class C network on the previous page, the fact is that one computer is part of the
network and the other one part of network, and these are two different networks. In our
example, from the moment we modified the defaul
t subnet mask from to, we split
that one network to 8 smaller ones.

Let's try it

And because we just have to prove it, we are going to try it on my home network. In the worst case I'll have to
spend all night trying to figure

out what went wrong, but it will be worth it!

Without complicating things, here is a diagram of my home network. (I've excluded any computers we are not
going to be using, in order to save space.)

That's the network we have to play with. I have put on the diagram the results of a few simple pings from each
host and, as you can see, they all came out nice: PASS.

In order to proceed to

phase two of our experiment, I modified the subnet mask of my workstation to
/ , my Slackware Linux Firewall to / (internal Network Interface
Card) and my NetWare 6 server to / 255.255.
255.224 as shown in the diagram below:

As you can see, the results for my workstation were devastating

alone and totally unaware t
hat the other two
servers are still there. When my workstation tries to ping the Linux Firewall, it will get no reply, because its
gateway is a host which belongs to another network, something that we knew would never work.

We have concluded that there ca
nnot be any sort of communication between the computers of network 1 and
network 2. How can two hosts in two different subnets talk to each other? That's what we are going to cover.

Building the bridge

There is a way to allow the communication between my

workstation and my servers and the Internet. Actually,
there are a few ways to achieve this and I'll show you a few , even though some might seem silly or impractical.
We are not interested in the best solution at the moment, we just want to know the ways

in which we can
establish communication between the two subnets.

Considering that subnets are smaller networks, you would remember that we use routers to achieve
communications between two networks. This example of my home network is no exception to this


We need a router which will route packets from one network to the other. Let's have a look at the different ways
we can solve this problem:

Method 1: Using a server with two network cards

Our first option is to use one of the servers, or a new Se
rver which has at least two network cards installed. By
connecting each network card to one of our networks and configuring the network cards so that each one belongs
to one subnet/network we can route packets between them:

The above diagram shows pretty much everything that's needed. The second network card has been installed
and it's been assigned an IP address that falls within our n
etwork 1 range and therefore can communicate with my
workstation. On the other hand the NetWare server now acts as a gateway for network 1, so my workstation is
reconfigured to use it as its gateway. Any packets from network 1 to network 2 or the Internet
will pass through
the NetWare server

Method 2: Binding 2 IP addresses to the same network card

This method is possibly the best and easiest way around our problem. We use the same network card on the
NetWare server and bind another IP address to it.

This second IP address will obviously fall within the network 1 IP range so that my workstation can communicate
with the server:

As noted on the diagram, the only problem we might encounter is the need for the operating system of the server
to support this type of configuration, but most modern operating systems would comply.

Once configured, the server takes care of any routing be
tween the two networks.

Method 3: Installing a router

The third method is to install a router in the network.

This might seem a bit far fetched but remember that we are looking at all possible ways to establish
communications between our networks! If th
is was a large network, then a router could possibly be the ideal
solution, but given the size of my network, well... let's just say it would be a silly idea :)

My workstation in this setup would forward all packets to its gateway, which is the router's interface and is
connected to network 1 and it will be able to see all other servers and access the Internet. It's a similar setup to
ethod 1 but instead of a server we have a dedicated router. Oh, and by the way, if we would end up using such
a configuration in real life.. the hub which both of the router's interfaces connects to would be replaced by some
type of WAN link.

That complet
es our discussion on Subnet routing and communication.

Protocols, Lesson 10: Subnetting guidelines

The number of problems that can occur in a network are numerous, and

believe it or not

most of them can be
avoided if the initial design and insta
llation of the network are done properly.

When I say "done properly," I don't just mean connecting the correct wires into the wall sockets. Looking at it from
an administrator's point of view, I'd say that a properly done job is one that has had a lot of
thought put into it to
avoid silly routing problems and meet today's and any future needs.

This page contains all the information you need to know in order to design a network that won't suffer from any of
the above problems. You would be amazed at how fr
equently I see networks suffering from all the above at large


Plan for growth

When creating subnets for your network, answer the following questions:

How many subnets are needed today?

Calculate the maximum number of subnets

required by rounding up the maximum number to the nearest power of
two. For example, if an organization needs five subnets, 2 to the power of 2 or 4 will not provide enough subnet
addressing space, so you must round up to 2 to the power of 3 = 8 subnets.

How many subnets are needed in the future?

You must plan for future growth. For example, if 9 subnets are required today, and you choose to provide for 2 to
the power of 4 = 16 subnets, this might not be enough when the seventeenth subnet needs to be d
eployed. In this
example, it might be wise to provide for more growth and select 2 to the power of 5 = 32 as the maximum number
of subnets.

What are the maximum number of hosts on a given segment?

You must ensure that there are enough bits available
to assign host addresses to the organization's largest
subnet. If the largest subnet needs to support 40 host addresses today, 2 to the power of 5 = 32 will not provide
enough host address space, so you would need to round up to 2 to the power of 6 = 64.

How many hosts will there be in the future?

Besides planning for additional subnets, you must also plan for more hosts to be added to each subnet in the
future. Make sure the organization's address allocation provides enough bits to deploy the require
d subnet
addressing plan.

When developing subnets, class C addresses present the greatest challenge because fewer bits are available to
divide between subnet addresses and host addresses. If you accommodate too many subnets, there may be no
room for addi
tional hosts and growth in the future.

All the above points will help you succeed in creating a well designed network which will have the ability to cater
for any additional future requirements.