TCP/IP Addressing and Subnetting An Excerpt From: A Technical Introduction To TCP/IP Internals
TCP/IP Addressing and Subnetting An Excerpt From: A Technical Introduction To TCP/IP Internals
Subnetting
an excerpt from:
A Technical Introduction to
TCP/IP Internals
Presentation Copyright 1995 TGV Software, Inc.
IP Addressing Roadmap
Format of IP Addresses
Traditional Class Networks
Network Masks
Subnetting
Supernetting
Special IP Addresses
Slide 2
IP Addresses
All IP interfaces have IP addresses
Each IP interface must have its own unique
IP address
Internally, this is represented as a 32-bit
number of 0s and 1s
IP addresses consist of two parts
network identification
host identification
Slide 3
Slide 4
2-31 bits
Host Part
Slide 5
Representing IP Addresses
There are several ways the IP address can
be represented
32 bit number of 0s and 1s
10100001 00101100 11000000 00000001
hexadecimal representation
9D.2C.BC.01
Slide 6
0
10
1 10
Slide 8
Class A Address
Network = 8 bits
Host = 24 bits
Class B Address
Network = 16 bits
Host = 16 bits
Class C Address
Network = 24 bits
Host = 8 bits
Assigning Network
Numbers
Network numbers imply some space for
hosts
Network numbers are assigned by your Internet
Service Provider, who got them from the
InterNIC (Network Information Center)
Network Mask
Identifies how many bits of the IP address
the host may use
The mask contains a 1 bit for every bit in the
network portion of the address
The mask contains a 0 bit for every bit in the
host portion of the address
Every host on a network must have the
same network mask
May also be called the Subnet Mask
Slide 11
Class A
gatekeeper.dec.com
16.1.0.2
128-191
00000000 00000000
Class B
hq.tgv.com
161.44.128.70
192-223
00000000
Class C
www.digital.com
204.123.2.49
Network Portion
Slide 12
Host Portion
Slide 15
255.255.0.0
/16
255.255.128.0
/17
255.255.192.0
/18
255.255.224.0
/19
255.255.240.0
/20
255.255.248.0
/21
255.255.252.0
/22
255.255.254.0
/23
255.255.255.0
/24
255.255.255.128
/25
255.255.255.192
/26
255.255.255.224
/27
255.255.255.240
/28
255.255.255.248
/29
255.255.255.252
/30
128
64
32
16
Simple Network
Example
Network address
Network mask
Host numbers
192.195.240.0
255.255.255.0 or /24
192.195.240.1 - 192.195.240.254
Slide 16
Example:
Slide 17
192.195.240.4
255.255.255.0 (/24)
Slide 18
IP Subnetworks
Allows the host part of IP address to be
further split
Arbitrary bit position divides subnet and host
Transparent outside of local network
Must be agreed upon by all hosts in local
network
Allows additional layer of hierarchy to be
built into a single IP network number
Helps reduce address space waste
Slide 19
Slide 20
Subnet a B into Cs
Original network number was 128.196.0.0
Original network mask was 255.255.0.0
Subnet with network mask 255.255.255.0
This gives 256 networks of 254 hosts each
128.196.0.1 through 128.196.0.254
128.196.1.1 through 128.196.1.254
128.196.255.1 through 128.196.255.254
Slide 21
Slide 22
Slide 24
Example of Subnetting
Physical topology of two physical LANs
(ethernets) separated by a router
The router (host) must know which interface
to select
Each interface must be on a different IP
network
Router
Slide 25
Subnet Example
We could assign each its own, like
192.195.240.0 and 192.195.241.0
wastes lots of IP addresses if < 510 hosts
However
We cant use a subnetwork of all 0 bits
some routers cant handle that
cant distinguish between route to both nets and route to subnet 0
Slide 28
Slide 29
Subnetting 192.195.240.0
First three octets are: 192.195.240.xxx
net
num
net num in
binary
num in b-cast
decimal address
00 000000
.0
.63
.1 through .62
01 000000
.64
.127
10 000000
.128
.191
11 000000
.192
.255
Slide 30
host
range
Further Subnetting
Lets say we have need for multiple physical
networks, like 10 or so, each of which will
have a few systems on it
Internet
R
R
R
R
Slide 31
Example of subnetting a
network to a /27
Original network number: 192.245.12.0/24
First three octets of everything: 192.245.12.xxx
net
num
net num in
binary
num in b-cast
host
decimal address range
000 00000
.0
.31
.1 to .30
001 00000
010 00000
011 00000
.224
.255
.225 to .254
4
5
6
7
Slide 34
111 00000
A little binary-to-decimal
conversion table
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0010
0010
0010
0010
0010
0010
0010
0010
0010
0010
0010
0010
0010
0010
0010
0010
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
0100
0100
0100
0100
0100
0100
0100
0100
0100
0100
0100
0100
0100
0100
0100
0100
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
0110
0110
0110
0110
0110
0110
0110
0110
0110
0110
0110
0110
0110
0110
0110
0110
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
1010
1010
1010
1010
1010
1010
1010
1010
1010
1010
1010
1010
1010
1010
1010
1010
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
1100
1100
1100
1100
1100
1100
1100
1100
1100
1100
1100
1100
1100
1100
1100
1100
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
1110
1110
1110
1110
1110
1110
1110
1110
1110
1110
1110
1110
1110
1110
1110
1110
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
0001
0001
0001
0001
0001
0001
0001
0001
0001
0001
0001
0001
0001
0001
0001
0001
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
0011
0011
0011
0011
0011
0011
0011
0011
0011
0011
0011
0011
0011
0011
0011
0011
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
0101
0101
0101
0101
0101
0101
0101
0101
0101
0101
0101
0101
0101
0101
0101
0101
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0111
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
1001
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
1011
1011
1011
1011
1011
1011
1011
1011
1011
1011
1011
1011
1011
1011
1011
1011
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
1101
1101
1101
1101
1101
1101
1101
1101
1101
1101
1101
1101
1101
1101
1101
1101
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
Slide 35
Example of subnetting a
network to a /27
Original network number: 192.245.12.0/24
First three octets of everything: 192.245.12.xxx
Slide 36
net
num
net num in
binary
num in b-cast
host
decimal address range
000 00000
.0
.31
.1 to .30
001 00000
.32
.63
.33 to .62
010 00000
.64
.95
.65 to .94
011 00000
.96
.127
.97 to .126
100 00000
.128
.159
.129 to .158
101 00000
.160
.191
.161 to .190
110 00000
.192
.223
.193 to .222
111 00000
.224
.255
.225 to .254
Supernets
Supernetting takes multiple logical networks
and makes one new logical network
Combine multiple Class-C networks for one
physical network
More than 256 hosts on a cable
Slide 38
Supernet Example
Assigned network numbers of 204.17.32.0
and 204.17.33.0
A supernet mask of 255.255.254.0 would
address both nets on the same physical wire
204.17.32.0
= 11001100.00010001.00100000.00000000
204.17.33.0
= 11001100.00010001.00100001.00000000
255.255.254.0 = 11111111.11111111.11111110.00000000
Slide 39
Special IP Addresses
A number of IP addresses are considered
special by the RFCs and most
implementations
These are mostly for broadcast and
loopback purposes
Well use the notation { xxx, yyy } to indicate
the network and host part
xxx = network part
yyy = host part
Slide 40
{ 0 , 0 } and { 0 , <host> }
{0,0} means this host, on this network
Written also as 0.0.0.0
Never used except in testing or booting
BOOTP uses 0.0.0.0 to indicate me
{ -1 , -1 } and
{ <this net> , -1 }
{-1 , -1} is the everywhere broadcast
address
Usually written as 255.255.255.255
Does not go outside of your local network
{<this net>, -1} is the broadcast to all hosts
in your local net
Very commonly used
For example, 192.245.12.0/24 broadcast is
192.245.12.255
Slide 42
{ 127 , <anything> }
Any address with the first octet 127
Typically used as 127.0.0.1
A Class A network number which is reserved
for loopback purposes
You may never use Net 127, even if you
want to
Slide 43
Slide 44
IP Addressing
Key Concepts
IP Addresses are 32 bit numbers
represented as a dotted quad
Network numbers are assigned by the
Internic or Internet access provider
Host numbers are assigned by the network
manager
Network masks identify which part of the IP
address is the network portion
TCP/IP References
TCP/IP Illustrated, Volume 1, The Protocols,
W. Richard Stevens, Addison-Wesley
Publishing Company, 1994
Interconnections: Bridges and Routers,
Radia Perlman, Addison-Wesley Publishing
Company, 1992
The Simple Book, An Introduction to Internet
Management, Marshall T. Rose, PTR
Prentice-Hall, Inc, 1994
Slide 46
IP Addressing
Questions ?