Lecture24 25 Subnetting

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 46

Today we will discuss:

• IP Addressing
• Subnetting

This is probably the most important topic


for the exam. Try to memorize the tables
and numbers where indicated since they will
help immensely on the exam.
IP Addressing Fundamentals:
• If a device wants to communicate using
TCP/IP, it needs an IP address.
• Any device that can send and receive IP
packets is called an IP host.
• IP addresses consist of a 32-bit number,
usually written in dotted-decimal
notation.
IP Address Fundamentals (cont.):
• Each byte (8 bits) of the 32-bit IP address
is converted to its decimal equivalent
(hence, “decimal” of “dotted-decimal
notation”).
• Each of the decimal numbers in an IP
address is called an octet.
– The term octet is just a vendor-neutral term
instead of byte.
IP Address Fundamentals (cont.):
• For example: 168.1.4.25
– The first octet is 168.
– The second octet is 1.
– The third octet is 4.
– The fourth octet is 25.
• The RANGE of decimal numbers in each
octet is between 0 and 255, inclusive. (256
numbers total)
Other IP Terminology
• Bit – a bit is one digit; either a 1 or a 0.
• Byte – a byte is 8 bits.
• Network address – also called the network
number, uniquely identifies each network. Every
machine on the same network shares that
network address as part of its IP address.
• Host address – also referred to as a node
address, is assigned to and uniquely identifies
each machine on a network.
• Broadcast address - sent to all nodes on the network
Binary to Decimal

Conversion
Binary
• The ability to convert from binary to
decimal and back again is very handy
when working with IP addresses.
• The digits used are limited to either a 1
(one) or a 0 (zero).
• Only convert up to 8 bits at a time (an
octet).
Binary (cont.)
• The trick to binary is to learn the decimal
values of each bit for the first 8 bits.
• Start from the left or right and add.
• Just add the decimal values where there is
a 1 (one) present, and you will have the
decimal value of the octet.
• The next slide shows the decimal value of
each bit value.
Binary to Decimal for 204
Binary = 1100 1100 Decimal = 204

128 64 32 16 8 4 2 1
1 1 0 0 1 1 0 0
-----------------------------------------------------------
128 + 64 + 0 + 0 + 8 + 4 + 0 + 0

= 204
Memorize
• Binary 1111 1111 = Decimal 255
• Binary 0000 0000 = Decimal 0
• Know the values 128-64-32-16-8-4-2-1.
• The easiest way to remember it is to start
at 1 and multiply by 2.
• 1 * 2 = 2 * 2 = 4 * 2 = 8 * 2 = 16 * 2 = 32 *
2 = 64 * 2 = 128.
Decimal to Binary
• Convert 212 to binary.
• Do the math.
• Answer: 11010100
Another Binary to Decimal
**Memorization** Chart
(see why this is important in a few slides)
Binary Value Decimal Value
10000000 128
11000000 192
11100000 224
11110000 240
11111000 248
11111100 252
11111110 254
11111111 255
Hierarchical IP Addressing Scheme
• An IP address consists of 32 bits of
information.
• The address is broken into four 8-bit
(1 byte) groups, converting each octet to
decimal values, and separating these
values by dots (dotted decimal notation).
• Example: 172.16.30.56
Hierarchical IP Addressing (cont.)
• Two other ways to represent dotted-
decimal 172.16.30.56 are:
– Binary
• 10101100.00010000.00011110.00111000
– Hexadecimal
• AC.10.1E.38
• See end of presentation for hex conversion notes
and chart.
The Classes of Networks
8 bits 8 bits 8 bits 8 bits

Class A Network Host Host Host

Class B Network Network Host Host

Class C Network Network Network Host

Class D Multicast -- Not On Test

Class E Research -- Not On Test


Classes of Networks
• All addresses in the same class A, B, or C
network have the same numeric value
NETWORK portion of the address. The
rest of the address is called the HOST
portion of the address.
• When written down, network numbers
have all decimal 0s in the host part of the
number.
Classes of Networks (cont.)
• Network number example:
– Class A: byte. 0. 0. 0
– Class B: byte. byte. 0. 0
– Class C: byte. byte. byte. 0
• However, network numbers are not
actually IP addresses because they
cannot be assigned to an interface as an
IP address.
List of All Possible Valid Network
Numbers (memorize)
Class A Class B Class C
First Octet Range 1 to 127* 128 to 191 192 to 223
1.0.0.0
Valid Network 128.1.0.0 – 192.0.1.0 –
--126.0.0 191.254.0.0 223.255.254.0
Numbers
.0
Number of 7-
Networks 2 2 214 - 2 221 - 2
Number of 24
Hosts 2 -2 216 - 2 28 - 2
Details of Classes A, B, & C
• Before starting to design subnets, you should know what it is
that you've been given. Here are three ways of finding out what
class your allocation is in. Use whichever you find easiest.

• Class A addresses begin with 0xxx binary, or 1 to 126


decimal. (127 is loopback)
• Class B addresses begin with 10xx binary, or 128 to 191
decimal.
• Class C addresses begin with 110x binary, or 192 to 223
decimal.

• If the first bit is 0 it is a Class A address


• If the first two bits are 10 it is a Class B address
• If the first three bits are 110 it is a Class C address
Reserved IP Addresses
• Address of all 0s • Means “network
address” or “this
network segment”
• Means “broadcast”
• Address of all 1s
• Reserved for
• Network 127.0.0.1
loopback tests. Allows
local node to send a
test packet to itself
without generating
network traffic.
Private IP Addresses
• These addresses can be used on a private
network, but are not routable on the Internet.
• With these addresses, use Network Address
Translation (NAT) to access the Internet via a
legal IP address.

Reserved address space

Class A 10.0.0.0 thru 10.255.255.255

Class B 172.16.0.0 thru 172.31.255.255

Class C 192.168.0.0 thru 192.168.255.255


SUBNETTING

.
Memorize Powers of 2

21 = 2 25 = 32
22 = 4 26 = 64
23 = 8 27 = 128
24 = 16 28 = 256
Subnet Masks
• A subnet mask is a 32-bit binary number
usually written in dotted-decimal format.
• The 1s in the subnet mask represent the
network (or subnet) part of the IP address.
• The 0s represent the host part.
• Example:
Binary:
11111111.11111111.11111100.00000000
Dotted-decimal: 255.255.252.0 (same number)
Subnet Masks (cont.)
• Slash notation (/) at the end of an IP
address means how many bits are turned
on (1s).
• Ex: 192.168.10.32 /28
Where /28 is subnet mask 255.255.255.240
Default Subnet Mask
• Not all networks need subnets, meaning they
use the default subnet mask.

Class Format Default Mask


A Network.Node.Node.Node 255.0.0.0
B Network.Network.Node.Node 255.255.0.0
C Network.Network.Network.Node 255.255.255.0
Five questions to answer when
calculating:
1) How many subnets does the chosen
subnet mask produce?
2) How many valid hosts per subnet are
available?
3) What are the valid subnets?
4) What’s the broadcast address of each
subnet?
5) What are the valid hosts in each subnet?
Easier than it looks:
1) How many subnets?
2x – 2 = number of subnets.
x is the number of masked bits, or the 1s.
For example, in 11000000, the number
of ones gives us 22 – 2 subnets. In this
example, there are 2 subnets.
Easy (cont.)
2) How many hosts per subnet?
2y – 2 = number of hosts per subnet.
y is the number of unmasked bits, or the
0s. For example, in 11000000, the number
of zeros gives us 26 – 2 hosts. In this
example, there are 62 hosts per subnet.
Easy
3) What are the valid subnets?
256 – subnet mask = block size, or base
number. For example, for subnet mask
255.255.192.0, 256 – 192 = 64. 64 is the
first subnet. The next subnet would be the
base number plus itself, or 64 + 64 = 128,
(the second subnet). You keep adding the
base number to itself until you reach the
value of the subnet mask, which is not a
valid subnet because all subnet bits
would be turned on (1s).
Easy
4) What’s the broadcast address for each
subnet?
The broadcast address is all host bits turned
on, which is the number immediately
preceding the next subnet (example in a
minute).
5) What are the valid hosts?
Valid hosts are the numbers between the
subnets, minus the network (subnet) numbers
and broadcast numbers.
Calculating: Class C, Example 1
Network address = 192.168.10.0
Subnet mask = 255.255.255.192
Just answer the five questions:
1) How many subnets? Since 192 is 2 bits
on (11000000), the answer is 22 – 2 = 2
2) How many hosts per subnet? We have 6
host bits off (11000000), so the equation
would be 26 – 2 = 62 hosts.
Example 1 (cont.)
3) What are the valid subnets?
256-192 = 64, which is the first subnet and
also the block size. Keep adding the block
size to itself until you reach the subnet
mask. 64 + 64 = 128. 128 + 64 = 192,
which is invalid because it is the subnet
mask (all subnet bits turned on). Our two
valid subnets are, then, 64 and 128.
Example 1 (cont.)
4) What’s the broadcast address for each
subnet?
The number right before the value of the
next subnet is all host bits turned on and
equals the broadcast address.
5) What are the valid hosts?
These are the numbers between the
subnet and broadcast address.
Example 1 Final Result
Network = 192.168.10.0 First Last
Mask = 255.255.255.192 subnet subnet
Subnets (do first) 64 128

Hosts (do last) 65 - 126 129 - 190

Broadcast address (do


127 191
second)
Class C Example 2
Network address = 192.168.10.0
Subnet mask = 255.255.255.224
Follow preceding example. Answers:

First Next Next Next Next Last

Subnets 32 64 96 128 160 192


33 65 -- 97 -- 129 -- 161 -- 193 --
Hosts
--62 94 126 158 190 222
Broadcast 63 95 127 159 191 223
Subnetting in Your Head
Host address = 192.168.10.33
Subnet mask = 255.255.255.240
What subnet and broadcast address is the above
IP address a member of?
First, answer question 3 of the big 5:
3) What are the valid subnets?
256 – 240 = 16. 16 + 16 = 32. 32 + 16 = 48. The
host address is between the 32 and 48 subnets.
The subnet is 192.168.10.32, the broadcast
address is 192.168.10.47, and the valid host
range is 192.168.10.33 – 192.168.10.46
Calculating Class B Addresses
Network address = 172.16.0.0
Subnet mask = 255.255.192.0
Answer the five questions:
1) Subnets? 22 – 2 = 2. (192 = 11000000)
2) Hosts? 214 – 2 = 16,382. (6 bits in the third
octet, and 8 in the fourth.)
3) Valid subnets? 256 – 192 = 64.
64 + 64 = 128. (these are the 2 subnets as
stated in question 1.)
Class B Example (cont.)
4) Broadcast address for each subnet?
See table.
5) Valid hosts? See table.

First Next (Last)

Subnets 172.16.64.0 172.16.128.0


172.16.64.1 – 172.16.128.1 –
Hosts
172.16.127.254 172.16.191.254
Broadcast 172.16.127.255 172.16.191.255
Class B, Example 2
Network address = 172.16.0.0
Subnet mask = 255.255.240.0
Follow prior questions. (240 = 11110000)
The table shows first three subnets, valid hosts, and broadcast
addresses in a Class B 255.255.240.0 mask:

First Next Next Etc

Subnets 16.0 32.0 48.0 …


16.1 – 32.1 – 48.1 –
Hosts …
31.254 47.254 63.254
Broadcast 31.255 47.255 63.255 …
Subnetting in Your Head, Class B
Q: What subnet and broadcast address is the
IP address 172.16.10.33 255.255.255.224 a
member of?
A: 256 – 224 = 32. 32 + 32 = 64.
33 is between 32 and 64. However,
remember that in Class B addresses the third
octet is considered part of the subnet, so the
answer would be the 10.32 subnet.
The broadcast is 10.63, since 10.64 is the
next subnet.
In Your Head, Class B Ex. 2
Q: What subnet and broadcast address is
the IP address 172.16.90.66
255.255.255.192 a member of?
A: 256 – 192 = 64. 64 + 64 = 128. The
subnet is 172.16.90.64. The broadcast
must be 172.16.90.127, since 90.128 is
the next subnet.
Subnetting Class A Addresses
• Same procedure as with Class B and
Class C only you must take into account
the 8 additional bits from the second octet.
Class A Example
Network 10.0.0.0
Subnet mask 255.255.0.0 ( /16 = 16 bits on)
1) Subnets? 28 -2 = 254.
2) Hosts? 216 – 2 = 65,534.
3) Valid subnets? 256 – 255 = 1, 2, 3, etc.
(all in the second octet). The subnets
would be 10.0.0.0, 10.2.0.0, 10.3.0.0,
etc., up to 10.254.0.0.
Class A Example (cont.)
4) Broadcast address for each subnet?
10.1.255.255, 10.2.255.255, etc., up to
10.254.255.255.
5) Valid hosts? See table.
First Next … Last
Subnet 10.1.0.0 10.2.0.0 … 10.254.0.0
10.254.0.1
10.1.0.1 – 10.2.0.1 –
Hosts … --10.254.255.2
10.1.255.254 10.2.255.254
54
Broad-
10.1.255.255 10.2.255.255 … 10.254.255.255
cast
Appendix
(will be added shortly)

Hex to Binary to Decimal Conversion


Slash Notation (/) Tables
Boolean/Binary Calculation Method

You might also like