TCP/IP Cheat Sheet

advertisement
Rutgers CCPD / The Beacon Institute for Learning
TCP/IP Address Classes
Class
IP address
A
B
C
w.x.y.z
w.x.y.z
w.x.y.z
Network ID
Host ID
w.
w.x.
w.x.y.
Valid Ranges
x.y.z
y.z
z
001 – 127
128 – 191
192 – 223
High-Order Bits
0
10
110
Octet High-Order Bit(s) Binary Representation
Items in boldface are always the value shown
Class
A
B
C
D
E
Octet 1
Octet 2
Octet 3
Octet 4
wwwwwwww.
xxxxxxxx.
yyyyyyyy.
zzzzzzzz
00000000.
10000000.
11000000.
11100000.
11110000.
00000000.
00000000.
00000000.
00000000.
00000000.
00000000.
00000000.
00000000.
00000000.
00000000.
00000000
00000000
00000000
00000000
00000000
Default Subnet Masks
Class
IP Address
Network ID
Host ID
A
Default Mask
w.x.y.z
255.0.0.0
w.
255.
x.y.z
0.0.0
Default Mask
w.x.y.z
255.255.0.0
w.x.
255.255.
y.z.
0.0
Default Mask
w.x.y.z
255.255.255.0
w.x.y.
255.255.255.
z
0
B
C
1 of 4
Rutgers CCPD / The Beacon Institute for Learning
Address Summary
Class
Number of
Networks
Number of
Hosts
Valid Range Network Ids
(First Octet Only)
Decimal
Binary
A
126
16,777,214
001.
126.
00000001.
01111110.
B
16,384
65,534
128.
191.
10000000.
10111111.
C
2,097,152
254
192.
223.
11000000.
11011111.
Calculating Binary / Decimal Conversions
The following chart can be applied to any single octet:
Bits
Decimal Value
8
128
7
6
5
64
32
16
2 of 4
4
3
8
2
4
1
2
1
Rutgers CCPD / The Beacon Institute for Learning
Example:
For a decimal IP address of 131.107.002.200
Octet 1:
Octet 2:
Octet 3:
Octet 4:
131
107
002
200
=
=
=
=
10000011
01101011
00000010
11001000
or
or
or
or
128 + 2 + 1
64 + 32 + 8 + 2 + 1
2
128 + 64 + 8
When converting decimal to binary or binary to decimal it is important to remember:
1. The decimal values shown in the table above are absolute and therefore never change
2. Binary numbers deal in only two discreet states; 1’s and 0’s or more commonly referenced as On
or Off with 1 being On and 0 being Off
3. Always begin your conversion with the high-order bit, the left most one or bit 8 and continue
working to the right
4. When converting decimal to binary you are given the decimal value of each octet. With that in
mind for an example as shown above we can obtain the binary value of the 1st octet, 131., by
applying the following formula:
a) 1st compare the decimal value (131) to the absolute decimal value of the high-order bit 8
which is 128. If it is higher then that bit must be On or equal to a 1, if it is lower then the bit
must be Off or a 0. The binary value at this point has a “1” in the left most bit.
b) Next take the absolute decimal value of the following bit; remember you are working left to
right. In the chart bit 7 is equal to 64. Add this value to our prior value which was on or equal
to a 1, 128 + 64 = 192. Since 192 is greater than 131 bit 7 must be Off. At this point we have
a binary value of “10” in the two left most bits.
c) We now move one more bit to the left or bit 6. As we did above we apply the absolute
decimal value for that bit, which is 32, to the 128 we already have. So the calculation is 128 +
32 and that equals 160 which is still higher than 131. The result is bit 6 must also be Off. We
now have a binary value of “100” in the three left most bits.
d) Continuing on this line, bit 5 equals a decimal value of 16. So 128 + 16 = 144 which is still
higher than 131 so that bit must be Off also. Our binary value now has “1000” in the four left
most bits.
e) Moving on to bit 4, which has a decimal value of 8, we add 128 + 8 and the total equals 136.
It is still higher than 131 so bit 5 must be Off and the binary value now has “10000” in the five
left most bits.
f)
Turning now to bit 3, which has a decimal value of 4, we add 128 + 4 and the total equals
131. Close but it’s still higher than 131 so bit 4 must be Off and the binary value has “100000”
in the six left most bits.
g) On to bit 2, which has a decimal value of 2, we add 128 + 2 and the total is 130. Since it’s
lower than our 131 the 2nd bit must be on. Our binary value now has “1000001” in the seven
left most bits.
h) Finally the last bit or bit 1, which has a decimal value of 1, we add 128 + 2 + 1 and the total is
131. I know where did the + 2 come from, remember we continually add all bits that are On.
Our binary value is now complete and has a value of “10000011” which is equal to a decimal
value of 131. Success!
3 of 4
Rutgers CCPD / The Beacon Institute for Learning
5. When converting binary to decimal, this is the easy one; you are given the binary value of each
octet. With that in mind for an example as shown above we can obtain the decimal value of the
2nd octet, 01101011, by applying the following formula:
a) Take the entire binary value and place it in the chart on page 2.
Bits
Decimal Value
Binary Value
8
7
6
5
4
3
2
1
128
64
32
16
8
4
2
1
0
1
1
0
1
0
1
1
b) All we need do is add the decimal values for all bits that are On and presto we have the
decimal conversion done. So it looks like this: 64 + 32 + 8 + 2 + 1 = 107.
Now that you know how to do it, try doing it for the 3rd and 4th octets.
Try the formulas on these, if you dare
192.168.92.254
209.158.10.68
92.41.254.238
251.252.253.255
11111001.00100111.11111111.10101010
01010101.11001100.00110011.00001111
11111111.11111111.11111111.11111111
00000001.11111111.00000000.11111111
During class, I will give you some more to do and maybe even show you how to use a
calculator to do it even faster.
4 of 4
Download