ipv4 final

25
IP v4 Subnetting IPV4 IP Address Subnetting Made Easier “I HOPE” By Bill Donahue MS, CCNA, CCDA Solutions Design Engineer Version 1.0 1

Upload: firemarshalbill

Post on 26-May-2015

600 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Ipv4 Final

IP v4 Subnetting

IPV4

IP Address Subnetting

Made Easier“I HOPE”

By

Bill Donahue MS, CCNA, CCDA

Solutions Design Engineer

Version 1.0 1

Page 2: Ipv4 Final

IP v4 Subnetting

1.0 Introduction

IP v4 was developed in technical time a long time ago when it looked to have an unlimited supply of addresses available. With the ever increasing usage in IP addresses we have been waging a war ever since in order to preserve what little space is left. One of the techniques to optimize addresses is called subnetting. Network engineers must have a good understanding on how this is accomplished well beyond the use of a subnetting calculator. The goal of this whitepaper is to help simplify this using techniques I have learned from my years as both a Network Design Engineer and Faculty at ITT Tech.

I will cover some of the basics that you should already have an understanding of and then review the technique that I have refined from my Cisco training and other classes on the subject. I will try to keep it on the lighter side so that you can easily read through.

2.0 Binary – Decimal or how do I count

We as humans are used to counting by 10. Computers as computers are used to counting by 2. What engineers as the translators must be able to do is convert them back and forth with ease. No I am not going to spend any time explaining how the decimal system operates, if you do not understand this then STOP reading this paper now. Binary does require a little practice.

Some of the basics definitions include:

Bit – a single numerical value in binary either 1 or 0

Byte – Eight bits and a key value in the IP Addressing scheme that you must know

In IP v4 Addressing understanding what the values are is key. In the Binary system just as in the decimal system the values increase from right to left with the Most Significant Bit being on the left. The difference is the Binary the powers increase by 2 not 10.

Version 1.0 2

Page 3: Ipv4 Final

IP v4 Subnetting

So a byte with its eight bits would have the following values

27 26 25 24 23 22 21 20

What does this mean - each bit in the respective bit position starting from the right if it is a 1 will mean 2 raised to that power in that bit position and knowing the first 7 or being able to right them down like I have to do before any calculation is key.

Here is a handy chart showing the decimal values of the above numbers

27 = 128

26 = 64

25 = 32

24 = 16

23 = 8

22 = 4

21 = 2

20 = 1

When doing any conversions of a byte value I would recommend writing these numbers across the top of a piece of paper and then filling in the respective decimal value for each “1” in the byte for the bit position. Add them all up and you have your decimal equivalent to the Binary value. Reversing our trend here and going from decimal to binary is just as easy except we use subtraction and start on the left or with the most significant bit and keep subtracting the decimal value and reducing our number until we reach zero. Seeing is believing so let’s go over some examples of this so that you understand this very important IP addressing step.

2.1 Binary to Decimal

DO NOT TRY TO DO THIS IN YOUR HEAD MISTAKES WILL HAPPEN

Let’s try this byte value 10101010 and convert it to decimal Remember the first part of this is to put the eight bit place values down on the top of the paper like this:

128 64 32 16 8 4 2 1

You can then insert the binary number below and in each bit position that is a 1 we add the decimal value up to come up with a total lets see what happens on the next page.

Version 1.0 3

Page 4: Ipv4 Final

IP v4 Subnetting

Remember our byte value is 10101010 so

128 64 32 16 8 4 2 1

1 0 1 0 1 0 1 0

Gives us - 128 + 32 + 8 + 2 = 170 in decimal

A couple more examples

10110111 in binary

128 64 32 16 8 4 2 1

1 0 1 1 0 1 1 1

128 + 32 + 16 + 4 + 2 + 1 = 183

11111111 in binary

128 64 32 16 8 4 2 1

1 1 1 1 1 1 1 1

128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 = 255.

****** This is actually an extremely important value to know – IF ALL BITS are 1 then the value is 255, you will see later why this is an important value to memorize.

Version 1.0 4

Page 5: Ipv4 Final

IP v4 Subnetting

2.2 Decimal to Binary

Now let’s reverse direction and go from decimal to binary values again we want to have our scale across the paper and let’s start with 188 as a decimal value that we want to convert to binary. We start by subtracting the highest value and repeating until we are at 0.

128 64 32 16 8 4 2 1Starting with 188 we subtract 128 leaving 60 then we subtract 32 because 64 does not fit and we repeat all the way to zero – here it is using basic arithmetic

188 – 128 = 60

60 – 32 = 28

28 – 16 = 12

12 – 8 = 4

4 – 4 = 0

Now putting in our “1” values we get

128 64 32 16 8 4 2 1

1 0 1 1 1 1 0 0Another example lets try 207

207 – 128 = 79

79 – 64 = 15

15 – 8 = 7

7 – 4 = 3

3 – 2 = 1

1 -1 = 1

Gives us 11001111 as seen below

128 64 32 16 8 4 2 1

1 1 0 0 1 1 1 1

Version 1.0 5

Page 6: Ipv4 Final

IP v4 Subnetting

3.0 IP v4 Basics

IP version 4 consists of 32 bits broken down into four groups of 8 bits (byte) separated by a period. These bits are then written down as a decimal equivalent number so that humans can read. Hence the reason why we as engineers must be able to convert back and forth. Try reading the following same value and figure which is easier to understand

10100011.11111111.00000001.11001100 in binary or

163.255.1.204 in decimal

As you can see the second value is much easier to understand. Now what does this number mean not much unless you understand a key point. That is, some of this number represents a network address and some of this number represents a host address. Where this separation takes place is of critical importance and can change via subnetting so lets work through the steps to get there.

3.1 Basic IP Address Classes

In the world of IPV4 there are 4 classes of IP addresses that network people need to be concerned with (in reality there are 5 classes). For simplicity they are Class A-D and experimental 5th class (Class E). These are referred to as the Classful boundary and separate the network portion and host portions of the network. It is this boundary that we are manipulating with subnetting to adjust our line of demarcation to allocate more or less hosts.

These classes are broken down based on address numbering in the first byte as follows

Decimal Range Binary Value Host Bits

Class A – 0 – 126 0xxxxxxx 24

Class B – 128-191 10xxxxxx 16

Class C – 192-223 110xxxxx 8

Class D - 224-240 1110xxxx (Multicasting)

Note: you may notice that there is no 127 value listed between the Class A and B addresses. That is because the value is reserved for Loopback purposes and cannot be used for general network addressing.

Version 1.0 6

Page 7: Ipv4 Final

IP v4 Subnetting

3.2 Public vs. Private

Our IPV4 addresses are separated into two general categories of addresses these are Public and Private. What exactly does this mean – preserved IPV4 addresses and security?

A Public IP Address is a Registered address range assigned to a company that will be allowed to traverse the internet and can only be used to address a specific Layer 3 device.

A Private IP Address is an Unregistered address range that a company can use internally to assign IP Addresses to its Layer 3 devices and with the use of Network Address Translation saves valuable IPV4 address space. These addresses are not routable over the IP Network. This also provides a level of security as the internal device is not truly seen from the outside world.

Private addresses include space out of each class as follows:

Class A – 10.0.0.0 to 10.255.255.255

Class B – 172.16.0.0 to 172.31.255.255

Class C – 192.168.0.0 to 192.168.255.255

See RFC 1918 for a detailed explanation

3.3 CIDR notation

In the world of subnetting we need a mask to match with the IP Address to help us define which portion of the address is network and which portion is host. There are two types of masks one for humans and one for computers.

For Computers we will transmit the mask with the IP address using the same format as the address itself with the difference being we will assign 1’s to the network and 0’s to the host. One critical thing to remember is that the network values start on the left and MUST continue sequentially to the right

As an example let’s use our address from before:

10100011.11111111.00000001.11001100 in binary or

163.255.1.204 in decimal

Assuming standard addressing and the value of 163 in the first byte we have a Class B address and the network portion would be the first 2 bytes or 16 bits. If we subnet by just one bit we would need to let the network know that we have done this by transmitting the mask with it. It would look like this:

10100011.11111111.00000001.11001100 mask = 11111111.11111111.10000000.0000000

163.255.1.204 in decimal mask 255.255.128.0

Version 1.0 7

Page 8: Ipv4 Final

IP v4 Subnetting

Lots of writing so we use CIDR notation for humans and it represents exactly the same information just in a more easily read format. The binary would remain the same but the decimal value would look like this:

163.255.1.204 /17

The /17 tells the user that the first 17 bits are network bits with the e value of one. If you look at the binary representation you will see that they match.

Version 1.0 8

Page 9: Ipv4 Final

IP v4 Subnetting

4.0 Subnetting

Let’s get into the heart of subnetting. I will start with a brief step – by – step outline and then using an example I will go into detailed instructions as they pertain to each step. Many of the technical aspects were covered in the previous sections of this white paper.

4.1 Step – by – Step Overview

This may seem a little confusing but as you will see in the detailed steps it is fairly simple if you go one step at a time. I would also like to acknowledge Cisco with their use of the demarcation line which makes this process much simpler.

Step 1 – Write down the 128 64 32 16 8 4 2 1 conversion table at the top of a blank piece of paper

Step 2 – Using the Subnet Mask figure out which byte we are working with

Step 3 – Using the Conversion table from step 1 convert the working byte to binary

Step 4 – Insert the mask below the binary converted number

Step 5 – Draw a line of demarcation separating the network and host portions of the address

Step 6 – Multiply down the mask and address

Step 7 – Convert back to decimal this is now your network number network number

Step 8 – Now change all host bits to the right of the demarcation line in step 5 to “1”s.

Step 9 – Convert back to decimal and you now have your broadcast address.

Step 10 – Then add 1 to the network address and you now have your 1 st host address in this subnet

Step 11 – Subtract 1 from the broadcast address and you have the last host in the subnet

Version 1.0 9

Page 10: Ipv4 Final

IP v4 Subnetting

4.2 Class C Subnetting example

We will start with a Class C address as an example. This is the simplest one to do since all the manipulation takes place in the right most byte.

193.200.175.188 /28

Step 1 – Write down the 128 64 32 16 8 4 2 1 conversion table at the top of a blank piece of paper. Since I am doing this as an example I will be carrying the items down throughout each step.

128 64 32 16 8 4 2 1

Step 2 – Using the Subnet Mask figure out which byte we are working with. In this example the /28 would put us in the 4th byte (188) since each period represents eight bit positions and we are counting over to the 28th position.

Step 3 – Using the Conversion table from step 1 convert the working byte to binary.

So using what we learned earlier we do our subtraction and fill in under our conversion chart, 1s where we can subtract and 0s where we cannot

188 – 128 = 60

60 – 32 = 28

28 – 16 = 12

12 – 8 = 4

4 – 4 = 0

128 64 32 16 8 4 2 1 1 0 1 1 1 1 0 0

Step 4 – Insert the mask below the binary converted number

/28 would be 4 bits into the byte

128 64 32 16 8 4 2 1 1 0 1 1 1 1 0 0

1 1 1 1 0 0 0 0

Version 1.0 10

Page 11: Ipv4 Final

IP v4 Subnetting

Step 5 – Draw a line of demarcation separating the network and host portions of the address. This is very important do not skip this simple step.

128 64 32 16 8 4 2 1 1 0 1 1 1 1 0 0

1 1 1 1 0 0 0 0

NETWORK PORTION HOST PORTION

Step 6 – Multiple down the mask and address

128 64 32 16 8 4 2 1 1 0 1 1 1 1 0 0

1 1 1 1 0 0 0 0

1 0 1 1 0 0 0 0

Step 7 – Convert back to decimal this is now your network number

Converting 10110000 back to decimal gives us a value of 176 since we are working in the 4th bytes and the original number given was 193.200.175.188 /28

The network number associated with the original IP Address is

193.200.175.176

Step 8 – Now change all host bits to the right of the demarcation line in step 5 to “1”s.

128 64 32 16 8 4 2 1 1 0 1 1 1 1 0 0

1 1 1 1 0 0 0 0

1 0 1 1 1 1 1 1

Version 1.0 11

Page 12: Ipv4 Final

IP v4 Subnetting

Step 9 – Convert back to decimal and you now have your broadcast address.

Converting 10111111 back to decimal gives us a value of 191. Since we are working in the 4th bytes and the original number given was 193.200.175.188 /28

The broadcast address associated with the original IP Address is

193.200.175.191

Step 10 – Then add 1 to the network address and you now have your 1 st host address in this subnet.

193.200.175.176 network

Plus 1 193.200.175.177 first subnet host

Step 11 – Subtract 1 from the broadcast address and you have the last host in the subnet

193.200.175.191 broadcast

Minus 1 193.200.175.190 last subnet host

Following the above steps on IP Address 193.200.175.188 /28 we end up with

193.200.175.176 Network Address

193.200.175.177 First Subnet Host

193.200.175.190 Last Subnet Host

192.200.175.191 Broadcast Address

Version 1.0 12

Page 13: Ipv4 Final

IP v4 Subnetting

4.3 Class B Subnetting example

We will start with a Class C address as an example. This is the simplest one to do since all the manipulation takes place in the right most byte. The MOST IMPORTANT thing to remember when working with Class B subnetting is to not forget that even though we are working with the 3rd byte the 4th byte will need to be manipulated to all 0’s for Network Address and all 1’s for Broadcast address

173.200.195.108 /19

Step 1 – Write down the 128 64 32 16 8 4 2 1 conversion table at the top of a blank piece of paper. Same as before

128 64 32 16 8 4 2 1

Step 2 – Using the Subnet Mask figure out which byte we are working with. In this example the /19 would put us in the 3rd byte (195) since each period represents eight bit positions and we are counting over to the 19th position.

Step 3 – Using the Conversion table from step 1 convert the working byte to binary.

So using what we learned earlier we do our subtraction and fill in under our conversion chart, 1s where we can subtract and 0s where we cannot

195 – 128 = 67

67 – 64 = 3

3 -2 = 1

1 -1 = 0

128 64 32 16 8 4 2 1 1 1 0 0 0 0 1 1

Step 4 – Insert the mask below the binary converted number

/19 would be 3 bits into the byte

128 64 32 16 8 4 2 1 1 1 0 0 0 0 1 1

1 1 1 0 0 0 0 0

Version 1.0 13

Page 14: Ipv4 Final

IP v4 Subnetting

Step 5 – Draw a line of demarcation separating the network and host portions of the address. This is very important do not skip this simple step. Also do not forget that the 4th byte will need to be made all 0’s for the network or all 1’s for the broadcast

128 64 32 16 8 4 2 1 1 1 0 0 0 0 1 1

1 1 1 0 0 0 0 0

NETWORK PORTION HOST PORTION

Step 6 – Multiple down the mask and address

128 64 32 16 8 4 2 1 1 1 0 0 0 0 1 1

1 1 1 0 0 0 0 0

1 1 0 0 0 0 0 0

Step 7 – Convert the answer back to decimal this is now your network number

Converting 11000000 back to decimal gives us a value of 192 since we are working in the 3rd bytes and the original number given was 173.200.195.108 /19

The network number associated with the original IP Address is

173.200.192.0

REMEMBER: The forth byte is also all 0’s for the network number

Step 8 – Now change all host bits to the right of the demarcation line in step 5 to “1”s. This will also include the 4th byte

128 64 32 16 8 4 2 1 1 1 0 0 0 0 1 1

1 1 1 0 0 0 0 0

1 1 0 1 1 1 1 1

Version 1.0 14

Page 15: Ipv4 Final

IP v4 Subnetting

Step 9 – Convert back to decimal and you now have your broadcast address.

Converting 11011111 back to decimal gives us a value of 223. Since we are working in the 3rd bytes and the original number given was 173.200.195.108 /19

Remember that the 1’s carry into the 4th byte

The broadcast address associated with the original IP Address is

173.200.223.255

Step 10 – Then add 1 to the network address and you now have your 1 st host address in this subnet.

173.200.192.0 network

Plus 1 173.200.192.1 first subnet host

Step 11 – Subtract 1 from the broadcast address and you have the last host in the subnet

173.200.223.255 broadcast

Minus 1 173.200.223.254 last subnet host

Following the above steps on IP Address 173.200.195.108 /19 we end up with

173.200.192.0 Network Address

173.200.192.1 First Subnet Host

173.200.223.254 Last Subnet Host

173.200.223.255 Broadcast Address

173.200.224.0

Version 1.0 15

Page 16: Ipv4 Final

IP v4 Subnetting

References

1. Cisco CCNA TV – Cisco.com

2. CCNA ICND Exam Certification Guide by Wendell Odom

3. Some of my students at ITT Tech that said – “hey this way may be easier”

Version 1.0 16