Anda di halaman 1dari 15

IP Addressing and Subnetting

Introduction
There are various aspects to IP addressing, including
calculations for constructing an IP address, classes of IP
addresses designated for specific routing purposes, and
public versus private IP addresses. There are also two
different types of IP addresses: IP version 4 (IPv4) and
IP version 6 (IPv6). The 32-bit IPv4 address type is
currently the most common, but the 128-bit IPv6
address is also in use, and will probably become the
more common address type over time. This lesson
describes 32-bit IPv4 addressing, except where IPv6 is
explicitly identified.
An IP address is a numeric identifier assigned to each
machine on an IP network. It designates the specific
location of a device on the network.

Terminology
Bit - A bit is one digit, either a 1 or a 0.
Byte - A byte is 8 bits.
Octet - An octet, made up of 8 bits, is just an ordinary
8-bit binary number.
Network address - This is the designation used in
routing to send packets to a remote network - for
example, 10.0.0.0, 172.16.0.0, and 192.168.1.0.
Broadcast address - The address used by
applications and hosts to send information to all nodes
on a network is called the broadcast address.
Examples include 255.255.255.255, which is all
networks, all nodes; 172.16.255.255, which is all
subnets and hosts on network 172.16.0.0; and
10.255.255.255, which broadcasts to all subnets and
hosts on network 10.0.0.0.

It is a 32 bit dotted decimal number with 4 octets, each octet of 8


bits.
It is divided into two portions, Network and host portion
IP addresses must be unique in a network
32 bits divided into 4 octets
Each octet has a decimal value range of 0 to 255.
The network portion cannot be all 0s nor all 1s
The first octet cannot be 127 (network), this is reserved for
loopback
The host portion cannot be all 0s this defines the network
address
The host portion cannot be all 1s this defines a broadcast in that
particular network
The IP address 255.255.255.255 defines a general broadcast
Although IP addresses are stored as binary numbers, they are
usually displayed in human-readable notations, such as
208.77.188.166 (for IPv4)
The original designers of TCP/IP defined an IP address as a 32-bit
number and this system, now named Internet Protocol Version 4
(IPv4), is still in use today.

One of IPs core functions is to provide logical


addressing for hosts. An IPaddress provides a
hierarchical structure to separate networks. Consider
the following address as an
Example:
158.80.164.3
An IP address is separated into four octets:
First Octet
Second Octet
Third Octet
Fourth Octet
.158
.80
.164
.3
Each octet is 8 bits long, resulting in a 32-bit IP
address. A computer understands an IP address in its
binary form; the above address in binary would look as
follows:
First Octet
Octet

Second Octet Third Octet

Fourth

IP Address Classes
To accommodate different sizes of networks and aid in classifying them, IP
addresses are divided into categories called classes. This topic describes
the IP address classes and the structure of the IP addresses within them.
Assigning IP addresses to classes is known as classfull addressing. The
classes were determined during the early days of the Internet by the
Internet Assigned Numbers Authority (IANA).Each IP address is broken
down into a network ID and the host ID. In addition, a bit or bitsequence at
the start of each address determines the class of the address. The figure
shows threeof the five IP address classes, which are used LAN, MAN and
WAN as follow

Private vs Public Addresses


The rapid growth of the Internet resulted in a shortage
of IPv4 addresses. Inresponse, the powers that be
designated a specific subset of the IPv4 address space
to be private, to temporarily alleviate this problem.
A public address can be routed on the Internet. Thus,
devices that should be Internet accessible (such as web
or email servers) must be configured with public
addresses.A private address is only intended for use
within an organization, and cannever be routed on the
internet. Three private addressing ranges were
allocated, one for each IPv4 class:
Class A - 10.0.0.0 10.255.255.255
Class B - 172.16.0.0 172.31.255.255
Class C - 192.168.0.0 192.168.255.255

What is Subnet Mask?


An IP address has two components, the network part and the host part.
Really, IP address is a combination of IP address and Subnet mask and the
purpose of subnet mask is to identify which part of an IP address is the
network part and which part is the host part. Subnet mask is also a 32 bit
number where all the bits of the network part are represented as "1" and
all the bits of the host part are represented as "0".
If we take an example for a Class C network, 192.168.10.0, the address
part and the subnet mask can be represented as below:
Table: Subnet Mask Example
For a Class C IP address, the first three octets are used to represent the
Network part and the last octet is used to represent the host part. From
the above table, we can see all "1" in the network part and all "0" in the
host part. When this subnet mask is converted to a decimal, it will become
255.2555.255.0.
Component

Binary

Decimal

Address Part

11000000.10101000.00001010.00
000000

192.168.10.0

Subnet Mask

11111111.11111111.11111111.00
00000

255.255.255.0

What is CIDR?
Classless Inter-Domain Routing (CIDR) merges or
combine network addresses of sameclass into one single address
to reduce the size of the routing table. It is done on core router to
reduce the size of routing table. It is implemented by ISP
(internet service providers).CIDR is simplified method of
representing a subnet mask. CIDR identifies the number of binary
bits set to a 1 (or on) in a subnet mask, preceded by a slash.
Consider the following subnet mask: 255.255.255.240
Looking
at
the
above
subnet
mask
in
binary:11111111.11111111.11111111.11110000
The first 28 bits of the above subnet mask are set to 1. To
represent this in CIDR notation: /28
Consider this next example:
192.168.11.1 255.255.255.0
The above address/subnet mask can be represented as
follows using CIDR:192.168.11.1 /24

CIDR

Subnet Mask

Wildcard Mask

No of IPs

/32

255.255.255.255

0.0.0.0

/31

255.255.255.254

0.0.0.1

/30

255.255.255.252

0.0.0.3

/29

255.255.255.248

0.0.0.7

/28

255.255.255.240

0.0.0.15

16

/27

255.255.255.224

0.0.0.31

32

/26

255.255.255.192

0.0.0.63

64

/27

255.255.255.128

0.0.0.127

128

/24

255.255.255.0

0.0.0.255

256

/23

255.255.254.0

0.0.1.255

512

/22

255.255.252.0

0.0.3.255

1,024

/21

255.255.248.0

0.0.7.255

2,048

/20

255.255.240.0

0.0.15.255

4,096

/19
/18
/17
/16
/15
/14
/13
/12
/11
/10
/9
/8
/7
/6
/5
/4
/3
/2
/1

255.255.224.0
255.255.192.0
255.255.128.0
255.255.0.0
255.254.0.0
255.252.0.0
255.248.0.0
255.240.0.0
255.224.0.0
255.192.0.0
255.128.0.0
255.0.0.0
255.0.0.0
255.0.0.0
255.0.0.0
255.0.0.0
255.0.0.0
255.0.0.0
255.0.0.0

/0

0.0.0.0

0.0.31.255
0.0.63.255
0.0.127.255
0.0.255.255
0.1.255.255
0.3.255.255
0.7.255.255
0.15.255.255
0.31.255.255
0.63.255.255
0.127.255.255
0.255.255.255
1.255.255.255
3.255.255.255
7.255.255.255
15.255.255.255
31.255.255.255
63.255.255.255
127.255.255.25
5
255.255.255.25

8,192
16,384
32,768
65,536
131,072
262,144
524,288
1,048,576
2,097,152
4,194,304
8,388,608
16,777,216
33,554,432
67,108,864
134,217,728
268,435,456
536,870,912
1,073,741,824
2,147,483,648
4,294,967,296

Subnetting
It is the process of breaking down an IP
network into smaller sub-networks called
subnets.
It is essentially the modification of a single IP
network to create two or more logically visible
sub-networks.
It changes the subnet mask of the local
network number to produce an even number
of smaller network numbers, each with a
corresponding range of IP addresses.

4.0.0.0. How many subnets and hosts-per-subnet


you can create with a subnet mask of
255.255.255.0?
Solution
First of all you have to specify which class this
network belongs to. According to Table 1, it belongs
to class A (simply, class A ranges from 1 to 126)
and its default subnet mask is 255.0.0.0. Therefore
if we use a subnet mask of 255.255.255.0, it means
we borrowed 16 bits (to convert from 0 to 1).
255.0.0.0 = 1111 1111.0000 0000.0000
0000.0000
0000
255.255.255.0 = 1111 1111.1111 1111.1111
1111.0000 0000
Now use our above formulas to find the
answers:
The number of newly created subnets = 216 =
65536 (with 16 is the borrowed bits)
The number of hosts per subnet = 28 2 = 254

Exercise 2
Your company has just been assigned the network 130.0.0.0.
How many subnets and hosts-per-subnet you can create with a
subnet mask of 255.255.128.0?
Solution
130.0.0.0 Belongs to class B with the default subnet mask of
255.255.0.0. But is the subnet mask of 255.255.128.0 strange?
Ok, lets write all subnet masks in binary:
255.255.128.0 = 1111 1111.1111 1111.1000 0000.0000
0000
This is a valid subnet because all bit 1s and 0s are
successive. Comparing to the default subnet mask, we
borrowed only 1 bit:
255.255.0.0 = 1111 1111.1111 1111.0000 0000.0000
0000
Therefore:
The number of newly created subnets = 21 = 2 (with 1 is the
borrowed
bits)
The number of hosts per subnet = 215 2 = 32766 (with 15 is
the bit 0s left in the 255.255.128.0 subnet mask)

Exercise 3
Your company has just been assigned the network 198.23.16.0/28.
How many subnets and hosts-per-subnet you can create with a
subnet mask of 255.255.255.252?
Solution
In this exercise, your company was given a subnetted network
from the beginning and it is not using the default subnet mask. So
we will compare two subnet masks above:
/28 = 1111 1111.1111 1111.1111 1111.1111 0000
(=255.255.255.240)
255.255.255.252 = 1111 1111.1111 1111.1111 1111.1111 1100
(= /30)
In this case we borrowed 2 bits. Therefore:
? The number of newly created subnets = 22 = 4 (with 2 is the
borrowed bits)
? The number of hosts per subnet = 22 2 = 2 (with 2 is the bit
0?s left in the 255.255.255.252 subnet mask)
Because two subnet masks (/28 & /30) only affect the 4th octet so
we dont care about the first three octets. In the 4th octet we are
allowed to change 2 bits (in the green box) of the IP address to