TCP/IP Cheatsheet v2.1: Check Out Our Other Free Study Guides and Great Practice Test Software!
TCP/IP Cheatsheet v2.1: Check Out Our Other Free Study Guides and Great Practice Test Software!
com
Check out our other Free Study Guides and great Practice Test Software!
Section 1:
Section 2:
Section 3:
Section 4:
Section 5:
Section 6:
Section 7:
Section 8:
Check out one of our other great Study Guides, "IP Summary Addressing Cheatsheet"
("IP-SUMMARY.PDF") for detail information on VLSM and CIDR.
Page 0
Section 1:
Number of
Networks
Number of Host
Per Network
126
16,384
2,097,152
16,777,214
Range of
Network ID's
(First Octet)
1 -- 126
128 -- 191
192 -- 223
65,534
254
The First Octet Rule: High order bits determine the Class of Address
The Most Significant (highest) bits for each Class are frozen, leaving the remainder for the Hosts portion
An Octet is a binary number of 8 bits. The smallest number is '00000000' and the largest is '11111111'
A shortcut is: 2
Class A =
Class B =
Class C =
Class D =
Class E =
This 2 to the power of 8 is the largest octet (all 8 bits are 1's). It's 255 in decimal.
Binary
Start
00000000
10000000
11000000
11100000
11110000
Binary
End
01111111
10111111
11011111
11101111
11110111
=
=
=
=
=
Class A =
Class B =
Class C =
Class D =
Class E =
First
Octet
1-126
128-191
192-223
224-239
240-247
Most
Sig Bits
0
10
110
1110
11110
Special
Note
Assignable
Assignable
Assignable
Multicast
InterNIC
Network
Net.H.H.H
Net.Net.H.H
Net.Net.Net.H
Host
x.255.255.255
x.y.255.255
x.y.z.255
Special Use
Reference
10.X.X.X
127.X.X.X
172.(16-31).X.X
192.0.0.X
192.0.1.X
192.0.2.X
192.0.(3-255).X
192.1.(0-1).X
192.1.2.X
192.1.3.X
192.168.X.X
Private
Loopback
Private
Reserved
Backbone-Test-C
Internet-Test-C
Unassigned
Backbone Local Nets
Backbone Fiber Nets
Backbone Apollo Nets
Private
RFC 1918
Diagnostics
RFC 1918
JBP
RH6
JBP
NIC
SGC
SGC
SGC
RFC 1918
Page 1
Section 2:
32
X
Weighted Values
16
8
X
X
4
X
Step 2 is subtracting each Weighted Value from your Decmial value, until you reach 0.
Let's say we want to conver the decimal value 29 to binary. It goes like this:
Can 128 go into 29? No, so it's a 0. Can 64 go into 29? No, so it's a 0. You get the idea
Most Significant Bit
128
64
0
0
32
0
Weighted Values
16
8
1
1
4
1
After going all the way down the Weighted Values chart, we now have our answer: 00011101
32
X
Weighted Values
16
8
X
X
4
X
Step 2 is adding up the binary values under the Weighted Values, until you reach your decimal value.
Let's say we want to conver the binary value 11000011 to decimal. It goes like this:
Draw a line under 128 and add 128, draw a line under 64 and add 64, draw a line under 2 and add 2, etc.
Most Significant Bit
128
64
1
1
32
0
Weighted Values
16
8
0
0
4
0
After going all the way down the Weighted Values chart, we now have our answer: 128+64+2+1 = 195
Page 2
Section 3:
Subnet Masking
This is the idea of taking the larger network block and chopping it into smaller pieces of equal size.
Routers require this logical segmentation to be able to address different logical subnets.
Clients require a default gateway IP address (the routers interface) to get off their local subnet.
The subnet mask is more important to a router than any other TCP/IP value.
The number of bits that are used in the subnet mask determine how many logical subnets you get.
There are a few rules involved in subnet masking.
1. The subnets cannot be all 0 or all 1 in the network or host portion of the address.
2. The all 0 subnet is called Subnet Zero, and sometimes can be used (not recommended).
3. The all 1 subnet is called the All 1's subnet, and can never be used (directed broadcast).
4. The incremental value is the IP host address starting point for the subnet.
5. Each incremental value represents another logical subnet.
6. Routers only care about the Net ID, and the subnet Broadcast.
7. Clients only care about local IP address on their subnet, and their subnet broadcast.
8. Each bit represents a power of 2. The easiest way to determine subnets is to use powers of 2.
Binary
Decimal
Binary
Bits
Number of Valid Host
Mask
Mask
Hosts
Used
Subnets Increments
00000000
0
<--->
00000000
0
Net ID
Not a Sub
10000000
128*
<--->
00000001
1
1
128
11000000
192
<--->
00000011
2
2
64
11100000
224
<--->
00000111
3
6
32
11110000
240
<--->
00001111
4
14
16
11111000
248
<--->
00011111
5
30
8
11111100
252
<--->
00111111
6
62
4
11111110
254*
<--->
01111111
7
126
2*
11111111
255*
<--->
11111111
8
254
1*
* = 7 subs valid for Class A or B in 1st octet. Class C has only 5 valid - the last 2 are binary all 1.
Page 3
Section 4:
Logical Addressing
* All SubNets can be broken down to: 7 ranges, 3 classes each (A, B, C)
Max. No.
Math For Max. Host
Subnet
Mask
Sub Bits
Subnets
Host ID per Subnet
Required
Host Bits
Available
Class A
0
14
30
62
126
24-2
16,777,214 255.0.0.0
23-2
22-2
21-2
20-2
Invalid
24
Class A
23
Not recommended
4,194,302 255.192.0.0
22
Range 1/7
2,097,150 255.224.0.0
21
Range 2/7
1,048,574 255.240.0.0
19-2
18-2
17-2
128 = Subnet 0
20
Range 3/7
524,286
255.248.0.0
19
Range 4/7
262,142
255.252.0.0
18
Range 5/7
131,070
255.254.0.0
17
Range 6/7
65,534
255.255.0.0
16
Invalid
128 = Subnet 0
15
Not recommended
16,382
255.255.192.0
10
14
Range 1/7
8,190
255.255.224.0
11
13
Range 2/7
4,094
255.255.240.0
12
12
Range 3/7
2,046
255.255.248.0
13
11
Range 4/7
1,022
255.255.252.0
14
10
Range 5/7
510
255.255.254.0
15
Range 6/7
254
255.255.255.0
16
Invalid
128 = Subnet 0
17
Not recommended
255.255.255.192
18
Range 1/5
Class B
0
1
2
2
14
30
62
126
16-2
15-2
14-2
13-2
12-2
11-2
10-2
9-2
Class C
0
14
30
62
8-2
7-2
6-2
5-2
4-2
3-2
2-2
62
30
255.255.255.224
19
Range 2/5
14
255.255.255.240
20
Range 3/5
255.255.255.248
21
Range 4/5
255.255.255.252
22
Range 5/5
Page 4
Section 5:
Using 2 bit subnet mask: Class C: 255.255.255.192 & Class B: 255.255.192.0 & Class A: 255.192.0.0
SUBNET
OCTET
00/000000*
00/000001*
00/111110*
00/111111*
0*
1*
62*
63*
64
Subnetwork 1 of 4
01/000000
01/000001
01/111110
01/111111
64
65
126
127
64
Subnetwork 2 of 4
10/000000
10/000001
10/111110
10/111111
128
129
190
191
64
*Broadcast subnet
(do not use)
11/000000*
11/000001*
11/111110*
11/111111*
192*
193*
254*
255*
64
RANGE
Incremental Value
DESCRIPTION
Page 5
Section 5: CONTINUED
Using 3 bit subnet mask: Class C: 255.255.255.224 & Class B: 255.255.224.0 & Class A: 255.224.0.0
SUBNET
OCTET
000/00000*
000/00001*
000/11110*
000/11111*
0*
1*
30*
31*
32
Subnetwork 1 of 8
001/00000
001/00001
001/11110
001/11111
32
33
62
63
32
Subnetwork 2 of 8
010/00000
010/00001
010/11110
010/11111
64
65
94
95
32
Subnetwork 3 of 8
011/00000
011/00001
011/11110
011/11111
96
97
126
127
32
Subnetwork 4 of 8
100/00000
100/00001
100/11110
100/11111
128
129
158
159
32
Subnetwork 5 of 8
101/00000
101/00001
101/11110
101/11111
160
161
190
191
32
Subnetwork 6 of 8
110/00000
110/00001
110/11110
110/11111
192
193
222
223
32
*Broadcast subnet
(do not use)
111/00000*
111/00001*
111/11110*
111/11111*
224*
225*
254*
255*
32
RANGE
Incremental Value
DESCRIPTION
Page 6
Section 6:
Powers of 2 Shortcut
Think of subnetting as stealing from Peter to give to Paul.
You have a maximum number of bits (determined by class) to play with, and if you overlap, it won't work.
Steal host bits moving from Left to Right to acquire more Subnets.
Steal subnet bits moving from Right to Left to acquire more Hosts per Sub.
Left-to-Right: Use Network n bits (2^n )-2=x to get x total number of SubNets per stolen Host bit.
Example:
Answer:
Note:
Steal 3 Host bits out of total 8 for Subnets on a Class C (see below)
This means you can have (2^3)-2 = (8-2) = 6 Subnets from this 3-bit Mask.
The leading 3 bits (11100000) = 128+64+32 = 224 Decimal SubNet Mask.
Right-to-Left: Use remaining Host h bits (2^h )-2=x to get total x number of Hosts per SubNet.
Example:
Answer:
Note:
Class A
Total 24 bits
to use for
subnetting
There are 5 Host bits remaining out of 8 after using 3 for Subnets on Class C (see above)
This means you can have (2^5)-2 = (32-2) = 30 Hosts per Subnet.
The Subnet Mask answer would be either slash notation /27 or decimal 255.255.255.224
You are using a Class C address, with 3 bits of subnetting, and 5 host bits remaining.
Bits Req
(n)
Subnets
(2^n-2)
1
2
3
4
5
6
7*
8*
(2^1)-2
(2^2)-2
(2^3)-2
(2^4)-2
(2^5)-2
(2^6)-2
(2^7)-2
(2^8)-2
(2^23)-2
(2^22)-2
(2^21)-2
(2^20)-2
(2^19)-2
(2^18)-2
(2^17)-2
(2^16)-2
8,388,606
4,194,302
2,097,150
1,048,574
524,286
262,142
131,070
65,534
Slash
(Notation)
/9
/10
/11
/12
/13
/14
/15
/16
Masks
(Decimal)
Sub
(Slice)
255.128.0.0
255.192.0.0
255.224.0.0
255.240.0.0
255.248.0.0
255.252.0.0
255.254.0.0
255.255.0.0
Subnet 0
Sub 1/7
Sub 2/7
Sub 3/7
Sub 4/7
Sub 5/7
Sub 6/7
Sub 7/7
* = 7 subs valid for Class A or B in 1st octet. Class C has only 5 valid - the last 2 are binary all 1.
Class B
Total 16 bits
to use for
subnetting
Bits Req
(n)
Subnets
(2^n-2)
1
2
3
4
5
6
7*
8*
(2^1)-2
(2^2)-2
(2^3)-2
(2^4)-2
(2^5)-2
(2^6)-2
(2^7)-2
(2^8)-2
(2^15)-2
(2^14)-2
(2^13)-2
(2^12)-2
(2^11)-2
(2^10)-2
(2^9)-2
(2^8)-2
32,766
16,382
8,190
4,094
2,046
1,022
510
254
Slash
(Notation)
Masks
(Decimal)
/17
/18
/19
/20
/21
/22
/23
/24
255.255.128.0
255.255.192.0
255.255.224.0
255.255.240.0
255.255.248.0
255.255.252.0
255.255.254.0
255.255.255.0
Sub
(Slice)
Subnet 0
Sub 1/7
Sub 2/7
Sub 3/7
Sub 4/7
Sub 5/7
Sub 6/7
Sub 7/7
* = 7 subs valid for Class A or B in 1st octet. Class C has only 5 valid - the last 2 are binary all 1.
Class C
Total 8 bits
to use for
subnetting
(2^1)-2
(2^2)-2
(2^3)-2
(2^4)-2
(2^5)-2
(2^6)-2
(2^7)-2
(2^6)-2
(2^5)-2
(2^4)-2
(2^3)-2
(2^2)-2
Hosts Per
(Decimal)
Slash
(Notation)
0
62
30
14
6
2
/25
/26
/27
/28
/29
/30
Masks
(Decimal)
255.255.255.128
255.255.255.192
255.255.255.224
255.255.255.240
255.255.255.248
255.255.255.252
Sub
(Slice)
Subnet 0
Sub 1/5
Sub 2/5
Sub 3/5
Sub 4/5
Sub 5/5
Page 7
Section 7:
Subs
32
1
Weighted Values
16
8
0
0
4
0
Hosts
2.) Using powers of 2, next see how many Host bits you have remaining.
a. Going from Right to Left, count the remaining bits. This will be how many Hosts per Sub you get.
b. Since we know we had 16 host bits total for our Class B, and we stole 3 bits, that leave us with 13 bits for Hosts.
c. Compute (2^13)-2= 8,190 Hosts Per Sub. Wow!!
d. Since this is so many more Hosts than we need, consider stealing extra Host bits to create extra Subs for future expansion!!
3.) Using the Weighted Values chart, find out what the decimal Subnet Mask will be.
a. Simply add 128 + 64 + 32 = 224 from the chart above.
b. Since this was a Class B and the first 2 octets are reserved, the default mask is 255.255.0.0
c. We stole the first 3 bits out of octet #3, so that is the only octet we really ever cared about.
d. The new decimal mask is 255.255.224.0, or shorthand notation /19 (8+8+3=19)
4.) Using the Decimal Mask, OR the last Network Bit's Weighted Value, find the Incremental Value.
a. Option 1: Take the new Subnet mask (the octet found in Step 3a above) and subtract from 256.
a. Option 2: Look at the Weighted Values chart and find the last bit flipped to 1 going Left to Right.
b. Either way, we now have the Incremental Value of 32.
c. This means Valid Subnetwork #1 is going to be 32, and each valid subnet will increase by 32, until the Subnet Mask is hit.
5.) Using the Incremental Value, count up and find the First Host IP, Broadcast for that Sub, and Last Host IP.
a. Start at the Incremental Value, which is 32.
b. Add up the next Incremental Value, which is 32 + 32 = 64.
c. Take one LESS than the NEXT Incremental value (64-1=63), and that is the PREVIOUS subnets Broadcast (for sub 32).
d. Add one to the current Incremental Value (32+1=33), that is your First Host (for sub 32).
e. Subtract one from the current subnets Broadcast (63-1=62), that is your Last Host (for sub 32).
f. See the chart below for details.
Notes:
There are (2^3)-2=6 subnets created. The -2 is important, because you cannot use all 0 or all 1 subnets.
The special all 0 address is the network ID for that subnet, and will be used by a router in its routing table.
The special all 1 address is the network broadcast for all subnets on this wire.
Range 0 x 32
Range 1 x 32
0 Subnet # 0
32 Subnet #1
Range 2 x 32
64 Subnet #2
Range 3 x 32
Range 4 x 32
Range 5 x 32
Range 6 x 32
Range 7 x 32
96
128
160
192
224
Subnet #3
Subnet #4
Subnet #5
Subnet #6
Subnet # 7
Page 8
Section 8:
11000000
11100000
11110000
11111000
11111100
11111110 *
11111111 *
Quiz yourself 1/2: "What is the Mask for xx Hosts in Class C?"
Quiz yourself 2/2: "How many Hosts for xx Mask in Class C?"
Increment
64
32
16
8
4
2
1
192 mask
224 mask
240 mask
248 mask
252 mask
254 mask
255 mask
Any Class
Any Class
Any Class
Any Class
Any Class
Class A or B only
Class A or B only
2 bits
3 bits
4 bits
5 bits
6 bits
7 bits
8 bits
Subnets per
2 subnets
6 subnets
14 subnets
30 subnets
62 subnets
126 subnets
254 subnets
192 mask
224 mask
240 mask
248 mask
252 mask
254 mask
255 mask
Inc. = 64
Inc. = 32
Inc. = 16
Inc. = 8
Inc. = 4
Inc. = 2
Inc. = 1
Any Class
Any Class
Any Class
Any Class
Any Class
Class A or B only
Class A or B only
192 mask
224 mask
240 mask
248 mask
252 mask
254 mask *
255 mask *
Class A
Class B
Class C
1-126
128-191
192-223
Network ID 0
Network ID 10
Network ID 110
Subs
32
X
Weighted Values
16
8
X
X
4
X
Hosts
Page 9