Comments 0

Document transcript

Guide to Internet Protocol

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

In plain English, the above means that if you have two or more devices that want to communicate, they need acommon 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 orprotocol. Vendors (IBM, Cisco, Microsoft, Novell) then follow these standards and implement them in theirproducts.

There are hundreds of protocols out there, and it is impossible to list them all here. Instead we have included themost 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 theseprotocols works.

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 focuses 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 Internet Protocol

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

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

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

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

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 fewdifferent sections in order to make it easy to readand 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 fittogether.

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 diagramof 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 learnabout the network ID and host ID in an IP address.

Lesson

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 howsubnetting works, along with simple and complicated examples. You should be comfortable with the first threesections in order to understand this section.

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 2: Binary and the Internet Protocol

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

the screen is just an interpretation of what the computer understands, so theinformation 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. Thismost 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 the smallest unit/value of Binary notation. The same way we say 1 cent isthe 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 thatis 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 theeyes), you would say that's 8 Bits or one Byte. Yes, that is correct; eight Bits are equal to one Byte. It doesn'tmatter 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 wayBinary 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 theinformation useful to us. IP works a bit like this as well, where 98% of the time we see it in a decimal notation, butthe computer understands it in binary. The picture below gives you an example of how a computer understandsan IP address:

The above example shows an IP address in

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

Now, keeping in mind what we said earlier about Bits and Bytes, have you ever heard or read people saying thatan 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 Binaryrelates to an IP address, which is usually represented in its decimal notation.

Understanding 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 aregoing 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 first octet in the IP address 192.168.0.1 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 createone octet or, if you like, the 192 number. Each bit takes a certain value which never changes, and this value isshown in purple, right above the bit. We then select the bits we need in such a way that the sum of all selectedbits gives us the decimal number we need.

If you wanted to explain the conversion in mathematical terms, you would 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 5is '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 bit1 is '2^0' = 1 in decimal.

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

means that Bit 1 does NOTtranslate 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 of11000000, which is 192 in decimal. You must remember that the values of each bit never change. For example,bit 8 always has a decimal value of 128, whereas bit 1 always takes the value of 1. Using this method, you willfind it easy to convert decimal to Binary without the need for complex mathematical calculations.

So let's have a look at the 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) inorder 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 youunderstood the above, you should be able to convert any Binary or Decimal number.

Protocols, Lesson 3: The Internet Protocol header

Introduction

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

When a computer receives a packet from the network, the computer will first check the destination MAC addressof 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 IPaddress. (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 travelsdown the OSI model and reaches the Network layer, the destination and source IP address of this packet areadded 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 areplaced. In here you

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

It's worth noting that the 9th field, which is the "Protocol" field, contains some important information that thecomputer uses to find out where it must pass 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 dataarrives at a computer and the packet is processed by each layer, it needs to know whereabouts aboveto pass thedata. This protocol field tells the computer to give the remaining data to either the TCP or UDP protocol, which isdirectly above it.

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

Protocols, Lesson 4: Internet Protocol classes-

Network and host ID

Introduction

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

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

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

IP address classes and structure

When the IEEE committee sat down to sort out the range of numbers that were going to be used by allcomputers, they came up with five different ranges or, as we call them, "classes" of IP addresses. When someoneapplies for IP addresses they are given a certain range within aspecific class depending on the size of theirnetwork. 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, Band C) are used to identify workstations, routers, switches and other devices, whereas the last two classes (D andE) 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) ofan IP address is enough for us to determine the class to which it belongs. And, depending on the class to whichthe IP address belongs, we can determine which portion of the IP address is the network ID and which is the nodeID.

For example, if I told you that the first octet of an IP address is "168," then, using the above table, you wouldnotice that it falls 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 assigneddifferent IP ranges within these classes, depending on the size of their network. For instance, if a companyrequired 1000 IP addresses, it would probably be assigned a range that falls within a class B network rather thana class A or C.

The class A IP addresses were designed for large networks, class B for medium size networks and class C forsmaller 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 whyclasses exist. Putting it as simply as possible, anIP 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 IDas your street in that suburb. You can tellexactly where someone is if you have their suburb and street name. In the same way, the network ID tells us towhich network a particular computer belongs and the node ID identifies that computer from all the rest that residein the same network.

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

In the 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 IPaddress is 192.168.0.2. The network ID portion of 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 thenetwork ID and which is the host ID?

That's what we are going to answer next.

Thenetwork 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 andnode portions.

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

Explanation:

The table above might seem confusing at first but it's actually very simple. We will take class A as an exampleandanalyze 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 power of 7 = 128 networks and for the hosts : 2 to the power of 24 = 16,777,216 hosts in each network, ofwhich 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). This is why when we calculate the "valid" hosts in a network wealways subtract "2". So if I asked you how many "valid" hosts can you have a on class A network, you shouldanswer 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 thenumber of networksand 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 thehost 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 isthe network broadcast address (see the table towards the end of this page). So if I asked you howmany "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 network ID (Bits 22, 23, 24 are set and can't be changed) and eight bits forthe 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 thenetwork broadcast address (see the table towards the end of this page). So if I asked you how many "valid" hostsyou can have on class C network, you should answer 254 and NOT 256.

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

this reason it's best to avoid using these IPaddresses.

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

IP address

Function

Network 0.0.0.0

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

Network 127.0.0.0

Reserved for Loopback. The Address 127.0.0.1 is often used to refer to thelocal host. Using this Address, applications can address a local host as if itwere a remote host.

IP Address with allhost bits

set to "0"(Network Address)e.g. 192.168.0.0

Refers to the actual network itself. For example, network 192.168.0.0 can beused to identify network 192.168. This type of notation is often used withinrouting tables.

IP Address with allnode bits

set to "1"(Subnet / NetworkBroadcast) e.g.192.168.255.255

IP Addresses with all node bits set to "1" are local network broadcastaddresses and mustNOT

The IP Address with all bits set to "1" is a broadcast address and mustNOT

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

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

IMPORTANT NOTE: It is

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

be used.

So when calculating available IP addresses in a network, always remember to subtract 2 from the number of IPaddresses 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 freetech support from Microsoft.

Subnetting is a very interesting and important topic. I gather that most of you have heard about it or have someidea what it's all 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 Imust say that I think that most of themsee 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 understood everything, then you won'thave any problem understanding subnetting. On the other hand, if you do not understand what we have beentalking about in the previous pages, you will find this part somewhat difficult. Whichever the case, I'm going to tryand

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 and 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 subnet masks is covered first, and then you get to see and learn how the network isaffected 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 detailand introduce a few new concepts. Classless and classful IP addresses are covered here and you'll learn how thesubnet maskaffects them.

Lesson 8:The

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

Lesson 9:Routing

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

Lesson 10:Subnetting

guidelines. Some last information to help you plan your new networks

and afew 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 isgiven to a company, the company might want to "break" (the correct term is "partition") that one network intosmaller ones, one for each department. This way, the technical department and management department caneach have a small network of their own. By subnetting the network, we can partition it to as many smallernetworks 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 the default subnet mask. You need tohave 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 determinesthe 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 inorder to meet our needs. If, for example, we require one network which can contain up to 254 computers, then aclass C network with its default subnet mask will do fine. If we need more, then we might consider a class Bnetwork with its default subnet mask.

Note that the default subnet masks have been set by the IEEE committee, the same guys that set and approvethe 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 254hosts.

Understanding the concept

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

Because of the subnet mask we used, all these computers are part of the one network marked in blue. This alsomeans 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 maskappropriately so

we can get the desired result. Let's say we needed to change the subnet mask from255.255.255.0 to 255.255.255.224 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 thingssimple for now and showing only two of these smaller networks because I want you to understand the concept ofsubnetting 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 veryimportant that 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 complexity ofsome subnets and the flexibility they offer. For this reason I created this little paragraph to let you know how weare going to approach and learn subnetting.

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

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

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. Whatyou need to keep in mind is that each class has its DEFAULT subnet mask, which we can change to suit ourneeds. I have already mentioned this in the previous page, but we need to look into it in a bit more detail.

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

We can see this once again in the picture below, where the IP address is analyzed in binary, because this is theway 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 decimalsubnet mask and converted it to binary, along with the IP address. It is essential to work in binary because itmakes things clearer and we can avoid making silly mistakes. The ones (1) in the subnet mask "lock" or, if youlike, define the network ID portion. If we change any

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

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

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

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

Looking at the picture above you will now notice that we have a subnet ID, something that didn't exist before. Asthe 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.

If

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

Summary

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

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

would be 255.255.255.0, 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 "subnetID". This subnet ID is created by borrowing bits from the host ID portion.

Thepicture below shows us both examples:

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

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

oncemore :)

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 theavailable subnet masks and analyze a class C network using a specific subnet mask. It's all pretty simple, as longas 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 theguidelines we need when 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 onthe random subnet mask you choose, it will either create a lot of routing and communication problems, or it won'tbe 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 useit. Most important, we are going to make sure we understandWHY you need to choose specific subnet masksdepending 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 eachclass's subnet mask is possibly the best and easiest way to learn

them.

Numer of bits

Class A

Class B

Class C

0

(default mask)

255.0.0.0(default_mask)

255.255.0.0 (default_mask)

255.255.255.0 (default_mask)

1

255.128.0.0 (default

+1)

255.255.128.0 (default+1)

255.255.255.128

(default+1)

2

255.192.0.0 (default+2)

255.255.192.0 (default+2)

255.255.255.192

(default+2)

3

255.224.0.0 (default+3)

255.255.224.0 (default+3)

255.255.255.224

(default+3)

4

255.240.0.0 (default+4)

255.255.240.0 (default+4)

255.255.255.240

(default+4)

5

255.248.0.0 (default+5)

255.255.248.0 (default+5)

255.255.255.248

(default+5)

6

255.252.0.0 (default+6)

255.255.252.0 (default+6)

255.255.255.252

(default+6)

7

255.254.0.0 (default+7)

255.255.254.0 (default+7)

255.255.255.254

(default+7) *Only 1 Host per subnet

8

255.255.0.0 (default+8)

255.255.255.0 (default+8)

255.255.255.255

(default+8) *Reserved for Broadcasts

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

The trick to understanding the pattern of the above table is to think of it in the following way: Each class has itsdefault subnet mask, which I have noted using the green color, and all we are doing is borrowing 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 youthe decimal numbers that we get each time we borrow a bit from the host ID portion. If you can't understand howthese decimal 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. Forexample, when we borrowed three bits in the class C network, we ended up partitioning the network into eightsmaller networks. Let's take a look at a detailed example (which we will break into three parts) so we can fullyunderstand all the above.

We are going to do an analysis using the class C network and three bits which we tookfrom the host ID. Theanalysis will take place once we convert our decimal numbers to binary, something that's essential for this type ofwork. 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 yournetworks.

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

At first the diagram below seems quite complex, so try 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 contains all theinformation we are after. Now, the last octet has two parts, the subnet ID and host ID. When we want to calculatethe subnets and hosts, we deal with them one at a time. Once that's done, we put the subnet ID and host IDportion together so we can 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 oneeach time, we get to see all the networks available. So we start off with 000 and finish at 111. On the right handside 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 inDecimal) 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).

Note:

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

weare doing here for each subnet. This formula is :2 to the power of X-2. Where X is the number of bits we have inthe 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 ofthat 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 our new network:

I hope the example didn't confuse you too much; the above example is one of the simplest type, which is why Ichose 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 times, you will get to understand it. Thesethings 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 ofthings. This will be analyzed here. It's an easy and very interesting page, so sit back and read through itcomfortably.

Communication between subnets

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

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

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

Looking at our example of the class C network on the previous page, the fact is that one computer is part of thenetwork 192.168.0.0 and the other one part of network 192.168.0.32, and these are two different networks. In ourexample, from the moment we modified the default subnet mask from 255.255.255.0 to 255.255.255.224, we splitthat 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 tospend 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 notgoing 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 eachhost and, as you can see, they all came out nice: PASS.

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

We have concluded that there cannot be any sort of communication between the computers of network 1 andnetwork 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 canestablish communication between the two subnets.

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

rule.

We need a router which will route packets from one network to the other. Let's have a look at the different wayswe 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 Server which has at least two network cards installed. Byconnecting each network card to one of our networks and configuring the network cards so that each one belongsto 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 installedand it's been assigned an IP address that falls within our network 1 range and therefore can communicate with myworkstation. On the other hand the NetWare server now acts as a gateway for network 1, so my workstation isreconfigured to use it as its gateway. Any packets from network 1 to network 2 or the Internetwill pass throughthe 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 theNetWare 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 communicatewith the server:

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

Once configured, the server takes care of any routing between 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 establishcommunications between our networks! If this was a large network, then a router could possibly be the idealsolution, 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 isconnected to network 1 and it will be able to see all other servers and access the Internet. It's a similar setup toMethod 1 but instead of a server we have a dedicated router. Oh, and by the way, if we would end up using sucha configuration in real life.. the hub which both of the router's interfaces connects to would be replaced by sometype of WAN link.

That completes 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 beavoided if the initial design and installation 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 froman administrator's point of view, I'd say that a properly done job is one that has had a lot ofthought put into it toavoid 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 ofthe above problems. You would be amazed at how frequently I see networks suffering from all the above at largecompanies.

Guidelines-

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 oftwo. For example, if an organization needs five subnets, 2 to the power of 2 or 4 will not provide enough subnetaddressing 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 tothe power of 4 = 16 subnets, this might not be enough when the seventeenth subnet needs to be deployed. In thisexample, it might be wise to provide for more growth and select 2 to the power of 5 = 32 as the maximum numberof subnets.

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

You must ensure that there are enough bits availableto assign host addresses to the organization's largestsubnet. If the largest subnet needs to support 40 host addresses today, 2 to the power of 5 = 32 will not provideenough 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 thefuture. Make sure the organization's address allocation provides enough bits to deploy the required subnetaddressing plan.

When developing subnets, class C addresses present the greatest challenge because fewer bits are available todivide between subnet addresses and host addresses. If you accommodate too many subnets, there may be noroom for additional 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 caterfor any additional future requirements.