Advanced Windows PowerShell Scripting Video Training

Advanced Windows PowerShell Scripting Video Training
Advanced Windows PowerShell Scripting Video Training

Wednesday, June 22, 2011

Super netting

Even though we appear to be in the twilight years of IPv4, you may still be faced with the question of super netting.

In the IPv4 world, we use a subnet mask to separate the network and host portion of an IP address.  With the IP address divided into 4 groups representing 8 bits, the normal subnets look like this:

255.0.0.0

255.255.0.0

255.255.255.0


The 255 is the decimal representation of 8 bits, all set to ‘1’.  The 0’s are the decimal representation of 8 bits, all set to ‘0’.  This makes subnetting easy.  Let’s say you need a subnet that can handle 4000 hosts?  Standard subnets will not work.  Here is how you figure out the subnet ID

Convert the 4000 to binary.  User the programmer mode on the Windows calculator

Just type in 4000 in DEC mode, and then switch to BIN mode.

image

The binary for this is 11111010000

If we add some leading zeros to make this an even 16 bit number, we get

0000111110100000

Now, place them into octets.

00001111.10100000

We can see by the leading one, that we need to borrow the lower 4 bits of the third octet for use as the host ID.  The leading 4 will be used as part of the network ID. In Window calculator, let’s figure out what just the first 4 leading bits will be.  To do this, set the calculator in BIN mode and type 11110000.  Now click DEC mode. You get the number 240.  Your subnet mask is:

255.255.240.0 or 11111111.11111111.11110000.00000000

There are also a limited number of subnets possible with subnetting.  We will continue to use the above subnet of 255.255.240.0 as our example.  Since we can only use the leading 4 bits for the network ID, we have to calculate the possible subnets.

00000000 ---- 0
00010000 ---- 16
00100000 ---- 32
00110000 ---- 48
01000000 ---- 64
01010000 ---- 80
01100000 ---- 96
01110000 ---- 112
10000000 ---- 128
10010000 ---- 144
10100000 ---- 160
10110000 ---- 176
11000000 ---- 192
11010000 ---- 208
11100000 ---- 224
11110000 ---- 240


Of these 16 subnets, the first and last one are reserved.  We only have 14 available subnets.

The IP address is derived from a combination of the bits from the host portion, and the network portion.  Let’s say that we need to use the last two bits of the third octet, and the first 6 of the fourth for our host ID.

00000011.11111100

We know that the first four bits are reserved for the network ID.  Lets place this in the 192 subnet.  Out subnet ID will look like this.

11111111.11111111.11000000.00000000

Let’s combine our host and network IDs

11111111.11111111.11000011.11111100

Running the 3rd octet through the Windows Calculator, we get 195.  If our network ID is 10.10.xxx.yyy, we can now determine that out IP address is 10.10.195.252

This is a very complicated method.  The link below will take you to a chart on the internet to try and help you determine the number of subnets and hosts a particular network can support.
http://www.pantz.org/software/tcpip/subnetchart.html

No comments: