Официален блог на WebEKM EKM очаквайте сайта онлайн скоро.

Download Free Templates http://bigtheme.net/ free full Wordpress, Joomla, Mgento - premium themes.

IPv4 Reverse Engineering & “Magic Number”

ipv4magicnumbersmallOne of the most crucial skill in networking is calculating network address and  usable network space based on given IP address and prefix only. These actions are also known as reverse engineering and if you won’t get to know this “networking nursery” don’t dream about dealing with computer networks seriously. Applying binary system is cumbersome and very time consuming (especially if you are rookie) so maybe someone ingenious has invented something better ? 


Let’s take IP address /20


What can I conclude from given address and prefix ?

I could say that this address belongs to “Network A”, but since 1993 when resourceful people have invented Classless Addressing (CIDR) it doesn’t have any meaning in my calculation.

What is the most interesting for me, that prefix /20 belongs to 3rd octect. How did I figure it  out ?

10 10 115 0  
0-7 8-15 16-23 24-32 number of used bits
/20   my subnet mask

That’s mean that I will deal with 3rd octet only

So what I have  to do in order to accomplish reverse engineering and breaking my network address down ?

Firstly, I have to find out what is /20 subnet mask in dotted decimal notation because I’m not going to use binary system at all. In order to do that I’ll  use below table.

Because my network subnet uses 4 bits  in 3rd octet, it looks in that way                

1 2 3 4 5 6 7 8 number of using bits
128  192  224  240  248  252  254  255  decimal notation
/20 3rd octet of my network subnet


So my full subnet mask looks in that way


Secondly I have to calculate something what is called MAGIC NUMBER which I will use later in further calculations. In order to do that I have to subtract the subnet mask of my 3rd octet from 256.






Let’s find out which network our IP address belongs to. In order to do that I’m dividing 3rd octet by Magic Number (16)  115:16=7,18

Now I am rejecting everything after a comma (,18) so I’m getting 7. I’m multiplying 7 by Magic Number, and result I am putting into 3rd octet  7*16=112 and finally I got my network address

Since I’ve got network address I can define first usable network address ( It may be our Gateway) and network broadcast address (utilizes by Address Resolution Protocol for example) first usable network address broadcast address network address of the next subnet (112+16(magic number)


Quantity of usable addresses I count from formula :

2n-2     /  n = 32 bits –  prefix 

212-2 = 4096 – 2 = 4094 

I have to subtract 2 addresses  : network address and brodcast address because they can’t be used for hosts addressing. 

Maximum quantity of usable subnets (Point-to-Point links for 2 hosts in each network) I count from formula :

2(n-2)  / n =  32 bits – prefix

2(12-2) = 210 = 1024

That’s mean, if I’m  going to create only 1 network I may have 4094 hosts, but if I’m going to have maximum quantity of networks I can divide our network space for 1024 subnets.

, ,

Onlain bookmaker bet365.com - the best bokie