Wednesday, 28 December 2016

IP ADDRESS SUB-NETTING SUPER-NETTING VLSM FLSM

IP Addressing Notes:


IP addresses are network layer addresses. As you saw earlier, IP addresses are 32-bit numbers. As shown in Figure 1-12, the 32 bits are usually written in dotted-decimal notation—they are grouped into 4 octets (8 bits each), separated by dots, and each octet is represented in decimal format. Each bit in the octet has a binary weight (the highest is 128 and the next is 64, followed by 32, 16, 8, 4, 2, and 1). Thus, the minimum value for an octet is 0, and the maximum decimal value for an octet is 255.

Figure  1.12 32-Bit IPv4 Addresses Are Written in Dotted-Decimal Notation
IP Address Classes
IPv4 addresses are categorized into five classes: A, B, C, D, and E. Only Class A, B, and C
addresses are used for addressing devices; Class D is used for multicast groups, and Class E is reserved for experimental use. The first octet of an IPv4 address defines which class it is in, as illustrated in Table 1-1 for Class A, B, and C addresses. The address class determines which part of the address represents the network bits (N) and which part represents the host bits (H), as shown in this table. The number of networks available in each class and the number of hosts per network are also shown.
Table 1-1 IP Address Classes A, B, and C Are Available for Addressing Devices


NOTE Class A addresses are any addresses that have the higher-order bit set to 0; this would include 0 through 127 in the first octet. However, network 0.0.0.0 is reserved, and network 127.0.0.0 (any address starting with decimal 127) is reserved for loopback functionality. Therefore, the first octet of Class A addresses ranges from 1 to 126.
NOTE Class D addresses have higher-order bits 1110 and are in the range of 224.0.0.0 to
239.255.255.255. Class E addresses have higher-order bits 1111 and are in the range of
240.0.0.0 to 255.255.255.255. For example, 192.168.5.1 is a Class C address. Therefore, it is in the format N.N.N.H—the network part is 192.168.5 and the host part is 1.
Private and Public IP Addresses
The IPv4 address space is divided into public and private sections. Private addresses are reserved addresses to be used only internally within a company’s network, not on the Internet. When you want to send anything on the Internet, private addresses must be mapped to a company’s external registered address. Public IPv4 addresses are provided for external communication.

RFC 1918, Address Allocation for Private Internets, defines the private IPv4 addresses as follows:
 10.0.0.0 to 10.255.255.255
 172.16.0.0 to 172.31.255.255
 192.168.0.0 to 192.168.255.255
The remaining addresses are public addresses.
NOTE Internet RFC documents are written definitions of the Internet’s protocols and policies. A complete list and the documents themselves can be found at http://www.rfc-editor.org/ rfc.html.

In binary format, a subnet mask bit of 1 indicates that the corresponding bit in the IP
address is a network or subnet bit, and a subnet mask bit of 0 indicates that the corresponding bit in the IP address is a host bit. Subnet bits come from the higher-order (leftmost) bits of the host field; therefore, the 1s in the subnet mask are contiguous

In binary format, a subnet mask bit of 1 indicates that the corresponding bit in the IP address is a network or subnet bit, and a subnet mask bit of 0 indicates that the corresponding bit in the IP address is a host bit. Subnet bits come from the higher-order (leftmost) bits of the host field; therefore, the 1s in the subnet mask are contiguous
Table 1.2 IP Address Default Subnet Masks

When all of an address’s host bits are 0, the address is for the subnet itself (sometimes called the wire). When all of an address’s host bits are 1, the address is the directed broadcast address for that subnet (in other words, for all the devices on that subnet).
The formula 2calculates the number of subnets created, where is the number of subnet bits (the number of bits borrowed from the host field). The formula 2h – 2 calculates the number of host addresses available on each subnet, where is the number of host bits. For example, 10.0.0.0 is a Class A address with a default subnet mask of 255.0.0.0, indicating 8 network bits and 24 host bits. If you want to use 8 of the host bits as subnet bits instead, you would use a subnet mask of 11111111.11111111.00000000.00000000, which is 255.255.0.0 in decimal format. You could then use the 8 subnet bits to address 256 subnets.
. Each of these subnets could support up to 65,534 hosts. The address of one of the subnets is 10.1.0.0; the broadcast address on this subnet is 10.1.255.255. Another way of indicating the subnet mask is to use a prefixprefix is a slash (/) followed by a numeral that is the number of bits in the network and subnet portion of the address—in other words, the number of contiguous 1s that would be in the subnet mask. For example, the subnet mask of 255.255.240.0 is 11111111.11111111.11110000.00000000 in binary format, which is 20 1s followed by 12 0s. Therefore, the prefix would be /20 for the 20 bits of network and subnet
information, the number of 1s in the mask.

There are three types of subnetting examples I will show in this chapter:
1) Subnetting when given a required number of networks
2) Subnetting when given a required number of clients
3) Given an IP address & Subnet Mask, finding original network range (reverse engineering a subnet problem)
Style 1:-Example 1: A service provider has given you the Class C network range 209.50.1.0. Your company must break the network into 20 separate subnets.
Step 1) Determine the number of subnets and convert to binary
- In this example, the binary representation of 20 = 00010100.
Step 2) Reserve required bits in subnet mask and find incremental value
- The binary value of 20 subnets tells us that we need at least 5 network bits to satisfy this requirement (since you cannot get the number 20 with any less than 5 bits – 10100)
- Our original subnet mask is 255.255.255.0 (Class C subnet)
- The full binary representation of the subnet mask is as follows:
255.255.255.0 = 11111111.11111111.11111111.00000000
- We must “convert” 5 of the client bits (0) to network bits (1) in order to satisfy the requirements:
New Mask = 11111111.11111111.11111111.11111000
- If we convert the mask back to decimal, we now have the subnet mask that will be used on all the new networks – 255.255.255.248
- Our increment bit is the last possible network bit, converted back to a binary number:
New Mask = 11111111.11111111.11111111.1111(1)000 – bit with the parenthesis is your increment bit. If you convert this bit to a decimal number, it becomes the number „8
Step 3) Use increment to find network ranges
- Start with your given network address and add your increment to the subnetted octet:
209.50.1.0
209.50.1.8
209.50.1.16 …etc        - You can now fill in your end ranges, which is the last possible IP address before you start the next range
209.50.1.0 – 209.50.1.7
209.50.1.8 – 209.50.1.15
209.50.1.16 – 209.50.1.23 …etc
You can then assign these ranges to your networks! Remember the first and last address from each range (network / broadcast IP) are unusable
Example 2: 172.16.0.0  into 60 subnets
Step 1) Determine the number of subnets and convert to binary
- In this example, the binary representation of 60 = 00111100
Step 2) Reserve required bits in subnet mask and find incremental value
- The binary value of 60 subnets tells us that we need at least 6 network bits to satisfy this requirement (since you cannot get the number 60 with any less than 6 bits – 111100)
- Our original subnet mask is 255.255.0.0 (Class B subnet)
- The full binary representation of the subnet mask is as follows:
255.255.0.0 = 11111111.11111111.00000000.00000000
We must “convert” 6 of the client bits (0) to network bits (1) in order to satisfy the requirements:
New Mask = 11111111.11111111.11111100.00000000
- If we convert the mask back to decimal, we now have the subnet mask that will be used on all the new networks – 255.255.252.0
- Our increment bit is the last possible network bit, converted back to a binary number:
New Mask = 11111111.11111111.11111(1)00.00000000 – bit with the parenthesis is your increment bit. If you convert this bit to a decimal number, it becomes the number 4.
Step 3) Use increment to find network ranges
- Start with your given network address and add your increment to the subnetted octet:
172.16.0.0
172.16.4.0
172.16.8.0 …etc
- You can now fill in your end ranges, which is the last possible IP address before you start the next range
172.16.0.0 – 172.16.3.255
172.16.4.0 – 172.16.7.255
172.16.8.0 – 172.16.11.255 …etc
- You can then assign these ranges to your networks! Remember the first and last address from each range (network / broadcast IP) are unusable
Style 2: to find number of clients
Example 1: A service provider has given you the Class C network range 209.50.1.0. Your company must break the network into as many subnets as possible as long as there are at least 50 clients per network.
Step 1) Determine the number of clients and convert to binary
- In this example, the binary representation of 50 = 00110010
Step 2) Reserve required bits in subnet mask and find incremental value
- The binary value of 50 clients tells us that we need at least 6 client bits to satisfy this requirement (since you cannot get the number 50 with any less than 6 bits – 110010)
- Our original subnet mask is 255.255.255.0 (Class C subnet)
- The full binary representation of the subnet mask is as follows:
255.255.255.0 = 11111111.11111111.11111111.00000000
- We must ensure 6 of the client bits (0) remain client bits (save the clients!) in order to satisfy the requirements. All other bits can become network bits:
New Mask = 11111111.11111111.11111111.11 000000 note the 6 client bits that we have saved
- If we convert the mask back to decimal, we now have the subnet mask that will be used on all the new networks – 255.255.255.192
- Our increment bit is the last possible network bit, converted back to a binary number:
New Mask = 11111111.11111111.11111111.1(1)000000 – bit with the parenthesis is your increment bit. If you convert this bit to a decimal number, it becomes the number 64 .
Step 3) Use increment to find network ranges
- Start with your given network address and add your increment to the subnetted octet:
209.50.1.0
209.50.1.64
209.50.1.128
209.50.1.192
- You can now fill in your end ranges, which is the last possible IP address before you start the next range
209.50.1.0 – 209.50.1.63
209.50.1.64 – 209.50.1.127
209.50.1.128 – 209.50.1.191
209.50.1.192 – 209.50.1.255
- You can then assign these ranges to your networks! Remember the first and last address from each range (network / broadcast IP) are unusable
Styel3:given ip address and subnet mask to find the actual nos of subnet and clients.
You are given the following IP address and subnet mask:
192.168.1.58
255.255.255.240
- When reverse engineering a problem, all you need to do is break the subnet mask back into binary and find the increment that was used
255.255.255.240 = 11111111.11111111.11111111.11110000
- As before, the last possible network bit is your increment. In this case, the increment is 16
- Use this increment to find the network ranges until you pass the given IP address:
192.168.1.0
192.168.1.16
192.168.1.32
192.168.1.48
192.168.1.64 (passed given IP address 192.168.1.58)
- Now, fill in the end ranges to find the answer to the scenario:
192.168.1.0 – 192.168.1.15
192.168.1.16 – 192.168.1.31
192.168.1.32 – 192.168.1.47
192.168.1.48 – 192.168.1.63 (IP address 192.168.1.58 belongs to this range)
The great exception rule:

-          because binary begins counting from zero, these network values may throw off calculations
-          2,4,8,16,32,64,128…….
-          These host values may throw off calculations
-          3, 7, 15, 31, 63, 127…….
When subnetting based on the number of networks, SUBTRACT 1 from the number
When subnetting based on the number of hosts per network, ADD 1 to the number
-Follow these rules and you will  always be safe
Ok !!!!!!!!!! may be you understand the above theory lets ease them with help of some real life problems:
TYPE 1: find number of hosts.(FLSM)
Class C example
Our solution steps are very simple
1)      Find number of bits for the host
2)      Find the block size
3)      What is the increment




TYPE 1: find number of hosts.(FLSM)
Class B example
Our solution steps are very simple
1)      Find number of bits for the host
2)      Find the block size
3)      What is the increment




VLSM example one

To overcome the drawbacks of FLSM we are using VLSM
By using VLSM we are able to save lots of IP addressing space also VLSM is used by all the link-state
Routing protocols.


In this case if we use FLSM the we are not able to provide IP address to A B and C , it can be seen by
the following diagram in case of FLSM ,we are only make two network

192.168.1.0
128 block size
192.168.1.128

128 block size

This is the limitation of the previous discussions of FLSM but if we use VLSM then see the 
 difference:







192.168.1.0 to 192.168.1.127 for A
128 block size

192.168.1.128 to 192.168.1.160 B
32 block size

4                         C
4
4
4
4
And so on upto 255

















CIDR PROBLEMS
TRICK:
If given CIDR is less than 32 and greater than 24 then subtract it into 32
If given CIDR is less than 24 and greater than 16 then subtract it into 24
If given CIDR is less than 16 and greater than 8 then subtract it into 16
Lets solve some problems:
1)      Find number of blocks , subnet mask , networks in the given IP address of 192.168.1.0/29
Solution: /29 means 32 – 29 = 3 ; 2^3 = 8 so the block size is 8
Now the increment is
192.168.1.0         ------------          192.168.1.7
192.168.1.8         ------------          192.168.1.15
192.168.1.16        ------------          192.168.1.31
:
192.168.1.248      -------------           192.168.1.255

If block size is 8 then the subnet mask is 256 – 8 = 248.
Means 255.255.255.248

  Let us solve some more problems
Write the subnet, broadcast address, and valid host range for each of the following:
1. 172.16.10.5/25
2. 172.16.10.33/27
3. 172.16.10.65/26
4. 192.168.100.37/29
Solutions
1)      32 – 25 = 7 ; 2^7 = 128
Subnet mask = 255.255.255.128
172.16.10.0    -----  172.16.10.127
172.16.10.128  -----  172.16.10.255
   2) 32 – 27 = 5 ; 2^5 = 32 (block size) for subnet mask 256 – 32 = 224)
     Subnet mask = 255.255.255.224
     172.16.10.0    ---  172.16.10.31
     172.16.10.32   -----  172.16.10.63
     :
     172.16.10.224  ---  172.16.10.255
            3) You may solve the third problem
   4) 32 – 29 = 3 ; 2^3 = 8 (block size ) 256 – 8 = 248 is the subnet mask
     So the subnet mask is 255.255.255.248

Now the block size is
    192.168.100.0   ---  192.168.100.7
    192.168.100.8   ---  192.168.100.15
    :
    192.168.100.32  ---  192.168.100.39
    192.168.100.40  ---  192.168.100.47
    :
    192.168.100.248 ---  192.168.100.255

Route Summarization

With route summarization, also referred to as route aggregation or supernetting, one route in the
routing table represents many other routes. Summarizing routes reduces the routing update traffic (which can be important on low-speed links) and reduces the number of routes in the routing table and overall router overhead in the router receiving the routes. In a hierarchical network design, effective use of route summarization can limit the impact of topology changes to the routers in one section of the network. If the Internet had not adapted route summarization by standardizing on classless interdomain routing (CIDR), it would not have survived.

-----------------------------------------------------------------------------------------------------------------------------
CIDR
CIDR is a mechanism developed to help alleviate the problem of IP address exhaustion and growth of routing tables. The idea behind CIDR is that blocks of multiple addresses (for example, blocks of Class C address) can be combined, or aggregated, to create a larger (that is, more hosts allowed), classless set of IP addresses. Blocks of Class C network numbers are allocated to each network service provider; organizations using the network service provider for Internet connectivity are allocated subsets of the service provider’s address space as required. These multiple Class C addresses can then be summarized in routing tables, resulting in fewer route advertisements. (Note that the CIDR mechanism can be applied to blocks of Class A, B, and C addresses; it is not restricted to Class C.) CIDR is described in RFC 1519, Classless Inter-Domain Routing (CIDR): An Address Assignment and Aggregation Strategy.
----------------------------------------------------------------------------------------------------------------------------
For summarization to work correctly, the following requirements must be met:
 Multiple IP addresses must share the same leftmost bits.
 Routers must base their routing decisions on a 32-bit IP address and a prefix length of up to
32 bits.
 Routing protocols must carry the prefix length with the 32-bit IP address.
For example, assume that a router has the following networks behind it:
192.168.168.0/24
192.168.169.0/24
192.168.170.0/24


192.168.171.0/24
192.168.172.0/24
192.168.173.0/24
192.168.174.0/24
192.168.175.0/24

Each of these networks could be advertised separately; however, this would mean advertising
eight routes. Instead, this router can summarize the eight routes into one route and advertise
192.168.168.0/21. By advertising this one route, the router is saying, “Route packets to me if
the destination has the first 21 bits the same as the first 21 bits of 192.168.168.0.”
Figure 3-2 illustrates how this summary route is determined. The addresses all have the first 21
bits in common and include all the combinations of the other 3 bits in the network portion of the

address; therefore, only the first 21 bits are needed to determine whether the router can route to
one of these specific addresses.
Figure 3-2 Find the Common Bits to Summarize Routes


So in this chapter we discuss about the various numerical related to IP addressing
Like how to find number of hosts , how to find number of network , how to find
CIDR , how to find number of host from given CIDR
We also solve problems on FLSM and VLSM ( really those problems are tricky)
At last we look one example of route summarization.

No comments:

Post a Comment