Private My Christianity My Science My Home My Computer My Burgh Contact Me


/network ID	subnet mask		first host in block (usually router/gateway)	number of hosts

/30		255.255.255.252		1,5,9,13,17,21,25,29,33,37,41,45,49...		2
/29		255.255.255.248		1,9,17,25,33,41,49,57,65,73,81,89,97...		6
/28		255.255.255.240		1,17,33,49,65,81,97,113,129,145,161,177...	14
/27		255.255.255.224		1,33,65,97,129,161,193,225			30
/26		255.255.255.192		1,65,129,193					62
/25		255.255.255.128		1,129						126
/24 (class c)	255.255.255.0		1						254
/16 (class b)	255.255.0.0								65,534
/8 (class a)	255.0.0.0  								16,277,214



Subnet masks, like IP addresses, are 4 segments of 0-255 decimal numbers (which can be translated to 4 segments of 8 binary bits or 1 byte)
EX:
136.142.149.211 (or 10001000.10001110.10010101.11010011)

To translate binary into decimal, just think of each bit as a power of 2, starting on the right and going left (like the way you write numbers or align them in order to add them up: the ones column would be flush/lined up on the right, then going leftward to get to the tens placeholder, then left to the hundreds, then thousands, etc.); so, the decimal value of the bits (starting on the right and going left) would be 1 (2^0), 2 (2^1), 4 (2^2), 8 (2^3) , 16 (2^4), 32 (2^5), 64 (2^6), 128 (2^7), then just add them up by using the binary 1 as on (or add) and 0 as off (or don't add).
EX:
11010011 (binary) = 211 (decimal):
add 128, add 64, skip 32, add 16, skip 8, skip 4, add 2, add 1 (or 128+64+16+2+1=211)

To translate decimal to binary, just start subtracting out he largest power of 2 that you can (also writing down "0" or "I couldn't subtract that value") as a "1" or "yes, I did subtract that vlaue out", until you are left with zero.
EX:
211 (decimal) = 11010011 (binary):
211 - 128 = 83, 83 - 64 = 19, can't subtract 32, 19 - 16 = 3, can't subtract 8, can't subtract 4, 3 - 2 = 1, 1 - 1 = 0 (or as far as starting with 211 and subtracting out 128, 64, 32, 16, 8, 4, 2, and 1 in order to end up with 0, would be yes, yes, no, yes, no, no, yes, yes, respectively)



To calculate subnet mask for your number of hosts, where you would sort of snap in to a number of hosts by using the equation 2^x - 2.
EX:
couldn't just want 7 ip addresses; would have to pick 6 (2^3-2) or 14 (2^4-2):
14 = 2^4-2 = 2 * 2 * 2 * 2 - 2

Write out the powers of 2 (decimal) from right to left (again, think like math, where you have the ones on the right and go leftward to get to tens, hundreds, thousands, etc.) and then *under* each (column), write the same number of zeros as the "power" of 2 you needed to use to get the desired number of hosts, and this will be the last segment of the subnet mask.
EX:
if we wanted 14 hosts, which was 2 to the power of 4 minus 2, our "power" would be 4, thus four zeros (right to left) and the rest (or 4 left) ones (that you would add up):
128 64 32 16 8 4 2 1
1   1  1  1  0 0 0 0
so the last segments (decimal) values is 240 (i.e. 128+64+32+16), so the subnet mask would be 255.255.255.240 (for wanting only 14 hosts or a /28 network).



To calculate the network id, think of the whole address as 8 bits x 4 segments = 32 bits.  Then you would determine how many bits you needed to represent the number of hosts you wanted, where you wouldn't need any off bits (or zero) that are on the left (or the higher numbers); i.e. start counting bits when you get to the left-most on (or "1") bit; THEN, you would use the remaining number of bits as your "network id".
EX:
I need about 50 ip address: hmm, 2*2=4, 4*2=8, 8*2=16, 16*2=32, 32*2=64, which is enough, but then subtract 2 (i.e. don't forget that you can't use the starting point (or host) and whole range (or broadcasting to the entire block) ip addresses), so that would be 62, which is enough IP addresses (i.e. don't forget you can't just have the number you want, has to snap in to the nearest power of 2 minus 2).  Now in binary, 62 would be:
128 64 32 16 8 4 2 1
0   0  1  1  1 1 1 0
which means I had to use 6 bits (ignoring those left-most only zeros), which subtracting from 32 (total) bits is 26; so, my network id is "/26", as in, "I need a /26 network if I'm to have enough space for 50 (or 62 max) IP addresses".

Also, if you have the math down, you could think of it as the power of 2 as the number of bits you need, so if you wanted 254 hosts (or 2^8-2), you would be using 8 bits, leaving 24 bits, so your network id would be "/24" and would then just add it to the host ip address, or x.x.x.0/24.

But now you start to have to worry about where that range starts, but then this is usually going to be determined by how the providor chops ups the subnet (i.e. what size networks and in what order).
EX:
136.142.149.0/24 (a class b network), could be chopped up as follows (to contain at least one /26 network):
136.142.149.0/26, 136.142.149.64/26, 136.142.149.128/26, 136.142.149.192/26
136.142.149.0/25, 136.142.149.128/26, 136.142.149.192/26
136.142.149.0/26, 136.142.149.64/25, 136.142.149.192/26
136.142.149.0/26, 136.142.149.64/26, 136.142.149.128/25
136.142.149.0/28, 136.142.149.16/27, 136.142.149.48/26, 136.142.149.112/25, 136.142.149.240/28



So, in summation, you want to know how many IP addresses you will need (think of a power of 2, then minus 2, and will your desired number of IP addresses fit inside that number) and then you know what size network you need and what your subnet mask is; and then, find out your network host or starting IP address (not first usable IP address, which is usually your gateway or router) and then you have your information!
EX:
136.142.149.32/27 has usable range 136.142.149.33-62 (30 IP addresses) and subnet mask 255.255.255.224
136.142.149.208/28 has usable range 136.142.149.209-223 (14 IP addresses) and subnet mask 255.255.255.240
136.142.149.240/29 has usable range 136.142.149.241-246 (6 IP addresses) and subnet mask 255.255.255.248


Fine: you just want a cheat sheet:

Hosts*NetmaskAmount of a Class C
/304255.255.255.2521/64
/298255.255.255.2481/32
/2816255.255.255.2401/16
/2732255.255.255.2241/8
/2664255.255.255.1921/4
/24256255.255.255.01
/23512255.255.254.02
/221024255.255.252.04
/212048255.255.248.08
/204096255.255.240.016
/198192255.255.224.032
/1816384255.255.192.064
/1732768255.255.128.0128
/1665536255.255.0.0256
*Usable IP addresses would be more like minus three (think about the network number, or address used to identify the subnet, the router or gateway address, and the broadcast address)