Sunday, November 23, 2008

IP Addressing Scheme :

IP Addressing Scheme :
A BRIEF INTRODUCTION
Introduction
Internet has completely changed than when it was first established in the early 1980's. Now the Internet is the world's largest public data network, expanding rapidly. It leads to tremendous popularity of the W3C (WWW), and new business horizons.

As the popularity of Internet increasing , it is providing numerous organizations across the globe with access to an ever expanding user/customer population.
Internet Problems :
Over the years, the Internet has experienced two major scaling problems to provide continuous and uninterrupted growth:
-The exhaustion of the IPv4 address spacing &
-The ability to route traffic between the ever increasing number of networks .

The depletion of the IP address space. (IP version 4 (IPv4), defines a 32-bit address means
there are only 232 (4,294,967,296) IPv4 addresses available. This might seem a large number of addresses, but with the uprising of new customers and ever increasing net population for IP addresses, the finite number of IP addresses is becoming not adequate.

Also, the traditional model of classful addressing scheme does not used to its maximum potential. The (ALE) of the IETF has expressed that if the current address allocation policies are not modified, new users may be unable to connect to the global Internet!


The second problem is caused by the rapid growth in the size of the Internet routing
backbone routers .Over recent years, routing tables have experienced exponential growth.

Unfortunately, the routing problem cannot be solved simply by installing more routers and increasing the size of the routing tables .Other factors ranges from CPU power to compute routing table/topology changes, the increasingly dynamic nature of WWW connections and their effect on router forwarding caches, and the sheer volume of information that needs to be managed by people and machines over different networks and topologies.

The long term solution can be found in the IP Next Generation (IPng or IPv6).
Class IP Addressing :
When IP was first standardized in September 1981, the specification required that each system attached to an IP-based internet be assigned a unique, 32-bit Internet address value. The first part of an Internet address identifies the network on which the host resides, while the second part identifies the particular host on the given networks.

All hosts on a given network share the same network-prefix but must have a unique host-number. Similarly, any two hosts on different networks must have different network-prefixes but may have the same host-number.

Primary Address Classes :
In order to provide the flexibility support different size networks, the network designers decided that the IP address space should be divided into three different address classes - Class A, Class B, and Class C. This is often referred to as " classful " .

One of the fundamental features of classful IP addressing is that each address contains a self-encoding key that identifies the dividing point between the network-prefix and the host-number.

Class A Networks (/8 Prefixes)
Each Class A network address has an 8-bit network-prefix with the highest order bit set
to 0 and a seven-bit network number, followed by a 24-bit host-number. Today, it is no longer considered 'modern' to refer to a Class A network. Class A networks are now
referred to as "/8s" (pronounced "slash eight" or just "eights") since they have an 8-bit
network-prefix.

A maximum of 126 (27-2) /8 networks can be defined. The calculation requires that the 2 is subtracted because the /8 network 0.0.0.0 is reserved for use as the default route and the /8 network 127.0.0.0 (also written 127/8 or 127.0.0.0/8) has been reserved for the "loopback" function. Each /8 supports a maximum of 16,777,214 (224-2) hosts per
network. The host calculation requires that 2 is subtracted because the all-0s ("this
network") and all-1s ("broadcast") host-numbers may not be assigned to individual
hosts.

Since the /8 address block contains 231 (2,147,483,648 ) individual addresses and the IPv4 address space contains a maximum of 232 (4,294,967,296) addresses, the /8 address space is 50% of the total IPv4 unicast address space.

Class B Networks (/16 Prefixes)
Each Class B network address has a 16-bit network-prefix with the two highest order
bits set to 1-0 and a 14-bit network number, followed by a 16-bit host-number. Class B networks are now referred to as"/16s" since they have a 16-bit network-prefix.

A maximum of 16,384 (214) /16 networks can be defined with up to 65,534 (216-2) hosts per network. Since the entire /16 address block contains 230 (1,073,741,824) addresses, it represents 25% of the total IPv4 unicast address space.

Class C Networks (/24 Prefixes)
Each Class C network address has a 24-bit network-prefix with the three highest order bits set to 1-1-0 and a 21-bit network number, followed by an 8-bit host-number. Class C networks are now referred to as "/24s" since they have a 24-bit network-prefix.

A maximum of 2,097,152 (221) /24 networks can be defined with up to 254 (28-2) hosts per network. Since the entire /24 address block contains 229 (536,870,912) addresses, it represents 12.5% (or 1/8th) of the total IPv4 unicast address space.

Other Classes
In addition to the three most popular classes, there are twoadditional classes. Class D addresses have their leading four-bits set to 1-1-1-0 and are used to support IP
Multicasting. Class E addresses have their leading four-bits set to 1-1-1-1 and are reserved for experimental use.

Dotted-Decimal Notation
To make Internet addresses easier for human users to read and write, IP addresses are often expressed as four decimal numbers, each separated by a dot. This format is called "dotted-decimal notation."
Dotted-decimal notation divides the 32-bit Internet address into four 8-bit (byte) fields and specifies the value of each field independently as a decimal number with the fields separated by dots. Figure 5 shows how a typical /16 (Class B) Internet address can be expressed in dotted decimal notation.

bit #0 31
10010001 00001010 00100010 00000011
145 10 34 3

145.10.34.3
Figure 5: Dotted-Decimal Notation

Table 1: Dotted-Decimal Ranges for Each Address Class :
Address Class Dotted-Decimal Notation Ranges
A (/8 prefixes) 1.xxx.xxx.xxx through 126.xxx.xxx.xxx

B (/16 prefixes) 128.0.xxx.xxx through 191.255.xxx.xxx

C (/24 prefixes) 192.0.0.xxx through 223.255.255.xxx

Dotted-decimal values that can be assigned to each of the three principle address classes. The "xxx" represents the host-number field of the address which is assigned by the local network administrator.




IP Subnetting Easy Interpretation :
The first step in understanding how to subnet is to understand an IP address and Subnet Mask. An IPv4 IP address is made up of 32 bits ( 4 octets of 8 bits). There are 3 classes of IP addresses we can use for an IP network. The left most octet defines the class.
Class A range 1.x.x.x - 126.x.x.x with a default subnet mask of 255.0.0.0
Class B range 128.x.x.x - 191.x.x.x with a default subnet mask of 255.255.0.0
Class C range 192.x.x.x - 223.x.x.x with a default subnet mask of 255.255.255.0
The default subnet mask defines how much of the IP address is dedicated to the network portion with the balance dedicated to the hosts on that network.
Let's review binary! If there are 8 bits in an octet, and all bits have a 1 in them, the result is 255. Remember the powers of 2 for each bit:

__ __ __ __ __ __ __ __
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1 Decimal Equivalent

Now lets take an IP address and break it down:
Here's the IP address 135.105.0.0. that is registered for our company ABC, Inc.
Step #1 - Determine what class the IP address is in answer: Class B
Step #2 - Determine what the default subnet mask is answer: 255.255.0.0
Setp #3 - Using the answer in step #2, determine how many bits are
set to 1 starting from the left answer: 16
Step #4 - The answer from #3 will also tell you how many bits are dedicated to the network portion of the IP address.
Step #5 - Draw a line separating the network portion of the IP address from the Host portion
This is what we have so far 135.105.|0.0. If we used n to represent the bits for the network portion and h for the host portion of the IP address, our address would look like this:
nnnnnnnn.nnnnnnnn.|hhhhhhhh.hhhhhhhh
With this is mind, lets determine the # of hosts we can have on the network of 135.105.0.0 To do this remember one and only one calculation 2#-2 where # will represent the number of bits. How many bits are dedicated to the Host address? 16 Use the 16 in the equation to get 216-2= 65,534 possible Hosts. Now you are probably asking why the minus 2 in the equation. Some implementations of IP addressing do not allow you to use an address where the Hosts bits are all 0's or all 1's. In fact, all 1's are used for broadcasts. So we have to exclude them from the total possible hosts. 216 = 65,536 - 2 excluded = 65,534.
Now ABC, Inc. has grown and the company would like to break up their LAN into separate independent networks. This process is done through subnetting. We are still going to use the same IP address of 135.105.0.0 To define separate subnets, we need to play with the subnet mask of 255.255.0.0
To start the subnetting process, you will BORROW bits from the Host portion of the IP address and dedicate them to the subnet. The question is, just how many bits do we borrow? The answer starts with defining either the number of Subnets you need or the number of Hosts per subnet you need. Either will work. ABC, Inc. needs to break up their LAN into 5 subnets, 1 for each department - Sales, Marketing, Accounting, Payroll, and Human Resources. So we know how many subnets we need, but still don't know how many bits to borrow. Lets go back to the one calculation you have to remember 2#-2. If we replace the # sign with 1 through 8 bits (remember there are 8 bits in an octet), these are the results:
21-2 = 0 possible subnets
22-2 = 2 possible subnets
23-2 = 6 possible subnets
24-2 = 14 possible subnets
25-2 = 30 possible subnets
26-2 = 62 possible subnets
27-2 = 126 possible subnets
28-2 = 254 possible subnets
Which equation is the first to support 5 subnets? Answer: 23-2. This will give us the 5 we need plus 1 extra. Now, if you expect growth in the future, use an equation that supports more subnets. OK, we have the answer. If we borrow 3 bits, we will get 6 subnets, 5 of which we are going to use right away. The number of bits to borrow came from the 3 in the equation above.
Hang on, here we go subnetting!!! Let's take a look at why 23-2 only supports 6 subnets. KEEP IN MIND, YOU CANNOT USE ALL 0's OR ALL 1's. With that lets take 3 bits and figure the combinations by hand. We can have:
000
001
010
011
100
101
110
111
Throw out the combination's with all 0's and all 1's, count the remaining combinations and you have your 6 possible subnets. Now lets break down the subnet mask to include the 3 bits we borrowed from the Host portion to define our 6 subnets - s.
Before we started we had: nnnnnnnn.nnnnnnnn.hhhhhhhh.hhhhhhhh

Now we have: nnnnnnnn.nnnnnnnn.ssshhhhh.hhhhhhhh

Just for kicks, we now have 13 h's for our Hosts. How many Hosts can we have on each of the 6 Subnets? Using 213-2, we get 8190 Hosts.
Let's keep things rolling. See those 3 s, figure their decimal equivalent:
s s s __ __ __ __ __
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1 Decimal Equivalent
The answer is 128+64+32=224. You've just figured out the number to use for the 3rd octet, 224. Now our subnet mask is 255.255.224.0. With this subnet mask, we borrowed 3 bits from the Host portion and used them to define our Subnet. Great!! But wait, were not done yet.
You now have to figure the address you can use for each Subnet in the 3rd octet. Remember, YOU CANNOT USE ALL 0's OR ALL 1's. Here is how we do it, 2 different ways.
A.) Take the right most s, and get its decimal value answer: 32 OR
B.) Take 256 and subtract your subnet mask of 224 answer: 32
Either will work just fine. Pick a method to use consistently.
The 32 represents the range increment (R.I.). Take the 3 bits, put all 0's in their spots, get the decimal equivalent, answer: 0. Take the result and add the R.I. to get 32. Take that result and add the R.I. to get 64 and so on. Here are the ranges:
Decimal Binary
0 000 CAN'T USE
32 001 1st useable Subnet
64 010 2nd useable Subnet
96 011 3rd useable Subnet
128 100 4th useable Subnet
160 101 5th useable Subnet
192 110 6th useable Subnet
224 111 CAN'T USE
Now we have 6 subnets defined, all using the Subnet Mask of 255.255.224.0. The subnets are:
135.105.32.0
135.105.64.0
135.105.96.0
135.105.128.0
135.105.160.0
135.105.192.0
Almost Done!! Last thing we need to do is determine what addresses to assign to the Hosts. Lets take the 135.105.32.0 subnet and break it down to n, s, and h's.
nnnnnnnn.nnnnnnnn.ssshhhhh.hhhhhhhh
We are going to work with the s and h's from this point on. If we use 32 (our first available Subnet) for the s part we get 001 in binary. If we use all 0's for the h's we get 00000.00000000 in binary. Put the 2 together to make up the last 2 octets, we get:
00100000.00000000 (in decimal this is 32.0)
32 . 0
Now lets put all 1's in the h's, keeping the s part the same. We now get:
00111111.11111111 (in decimal this is 63.255)
63 . 255
What have we been saying all along? YOU CAN'T USE ALL 0's OR ALL 1's. So we add 1 to the starting number and subtract 1 from the ending number in the range and get: 32.1 and 63.254. This is the Range of addresses we can assign to Hosts on the 32 Subnet. Here are the Ranges for all 6 Subnets:
Subnet Range
32 32.1 - 63.254
64 64.1 - 95.254
96 96.1 - 127.254
128 128.1 - 159.254
160 160.1 - 191.254
192 192.1 - 223.254
Last but not least, take the original IP address and tack it onto the front of these Subnets and your work is done.
Original IP address and Subnet mask:
135.105.0.0
255.255.0.0
Divided into 6 Subnets:
Subnet Subnet mask: Range of adresses
135.105.32.0 255.255.224.0 135.105.32.1 - 135.105.63.254
135.105.64.0 255.255.224.0 135.105.64.1 - 135.105.95.254
135.105.96.0 255.255.224.0 135.105.96.1 - 135.105.127.254
135.105.128.0 255.255.224.0 135.105.128.1 - 135.105.159.254
135.105.160.0 255.255.224.0 135.105.160.1 - 135.105.191.254
135.105.192.0 255.255.224.0 135.105.192.1 - 135.105.223.254
Question: The host with the IP address of 135.105.145.16 using the Subnet mask of 255.255.224.0 resides on which subnet? Answer: The host resides on the 135.105.128.0 subnet.












more to come on this topic later !

amisauv !

No comments: