IP addressing
Computer Network BIS
IP Addressing
• An IP address is a numeric identifier assigned to each machine on an IP network, designating its specific
location on the network.
• It is a logical address, not a hardware address like the one hard-coded on a network interface card (NIC) for
finding hosts on a local network.
• IP addressing allows communication between hosts on different networks, regardless of their LAN types.
The Hierarchical IP Addressing Scheme
• An IP version 4 or simply IP address consists of 32 bits of information. These bits are divided into four sections,
referred to as octets or bytes, and four octets (bytes) sum up to 32 bits (8 × 4 = 32). You can depict an IP
address using one of three methods:
• Dotted-decimal, as in [Link]
• Binary, as in 10101100.00010000.00011110.00111000
• Hexadecimal, as in AC.10.1E.38
• The 32-bit IP address is a hierarchical address that can handle a large number of addresses, specifically 4.3
billion.
• This is advantageous because it allows for efficient routing. In contrast, a flat-addressing scheme would require
all routers to store the address of every machine on the Internet, which would be impractical.
• To solve this problem, a two- or three-level hierarchical addressing scheme is used, similar to a telephone
number. This scheme designates different sections of the address for network, and host identification.
Network and host Addresses
• The network address, also known as the network number, uniquely identifies each network.
• Every machine on the same network shares this network address as part of its IP address. In the example IP
address [Link], 172.16 is the network address.
• The host address is assigned to and uniquely identifies each machine on a network.
• This part of the address must be unique because it identifies an individual machine, as opposed to a network
which is a group.
• In the example IP address [Link], 30.56 is the host address
IP address classes ( Classful IP addressing)
• The Internet designers created three classes of networks
based on their size.
• Class A networks are for networks with a very large
number of hosts,
• Class C networks are for networks with a small number
of hosts.
• Class B networks fall in between.
• The subdivision of an IP address into a network and
host address is determined by the class designation of
your network.
Class A addresses
• In Class A network addresses, the first byte is used for the network address and the remaining three bytes are
used for host addresses.
• The format of a Class A address is "[Link]". For example, in the IP address [Link], 49
is the network address and 22.102.70 is the host address.
• Class A network addresses are 1 byte long, with the first bit reserved ( Zero) and the remaining 7 bits
available for manipulation or addressing. Therefore, a Class A address must be between 0 and 127 in the first
byte inclusive.
• This allows for a maximum of 128 Class A networks to be created.
• Each of the 7-bit positions can be either a 0 or a 1, resulting in 27 = 128 possible combinations
• Each Class A address has 24 bits allocated for the host address, resulting in 224 = 16,777,216 unique
combinations. However, two addresses are not used ( 1st = Network address and last one = broadcast address )
giving 16,777,214
Class A addresses
Network address and Broadcast address
• In a Class A network address, the network address is represented by all host bits off ([Link]) and the
broadcast address is represented by all host bits on ([Link]).
• The valid hosts range from [Link] to [Link]
•
Class B Addresses
• The network address of a Class B network consists of the first 2 bytes, while the remaining 2 bytes are used
for host addresses.
• Class B network addresses must start with the binary digit 1, then 0, leaving 14 bit positions available to
manipulate and resulting in 16,384 unique Class B network addresses.
•
Class C Address
• In a Class C network address, the first 3 bytes are dedicated to the network portion of the address, with only 1
byte remaining for the host address.
• The first 3 bit positions are always the binary 110, leaving 21 positions and resulting in 221 , or 2,097,152,
possible Class C networks.
• The valid hosts in a Class C network can also be found by identifying the numbers between the network
address and the broadcast address.
Class E and Class D
• Addresses with the first octet of 224 to 255 are reserved for Class D and E networks.
• Class D is used for multicast addresses and Class E for scientific purposes
Private IP address
• Some IP addresses considered Private IP address where it can be used in a private LAN but cannot be used on
the Internet directly as they are not routable .
Types of IP addresses
• Data is transported over a network by three simple methods i.e. Unicast, Broadcast, and Multicast. So let’s
begin to summarize the difference between these three:
• Unicast: from one source to one destination i.e. One-to-One
• Broadcast: from one source to all possible destinations i.e. One-to-All
• Multicast: from one source to multiple destinations stating an interest in receiving the traffic i.e. One-to-
Many
• The range of multicast addresses starts with [Link] and goes through [Link].
• Broadcast messages are meant to reach all hosts on a broadcast domain. These are the network broadcasts that
have all host bits on ( all host bits are 1s).
• The network address of
• [Link] would have a broadcast address of [Link]
IP subnetting
• Why do we need subnetting if we already have different classes ?
• One goal of a subnet is to split a large network into a grouping
of smaller, interconnected networks to help minimize traffic
How to Create Subnets?
• To create subnetworks, you take bits from the host portion of the IP
address and reserve them to define the subnet address.
• This means fewer bits for hosts, so the more subnets, the fewer bits
are left available for defining hosts.
• By this way you can divide a large network into smaller ( isolated )
subnets
•
Subnet Mask
• Subnet mask is associate with IP address to distinguish the network
ID portion of the IP address from the host ID portion of the IP address.
• The network administrator creates a 32-bit subnet mask composed of
1s and 0s.
• The 1s in the subnet mask represent the positions that refer to the
network, or subnet, addresses
Default Subnet Mask
Classless Inter-Domain Routing (CIDR)
• Another term you need to know is Classless Inter-Domain Routing (CIDR). It’s
basically the method that Internet service providers (ISPs) use to allocate a
number of addresses to a company or a home connection.
• They provide addresses in a certain block size; Another term for the use of
different length subnet masks in the network is variable-length subnet masking
(VLSM).
• When you receive a block of addresses from an ISP, what you get will look
something like this: [Link]/28.
• The slash notation (/) means how many bits are turned on (1s) Or the number of
ones in the subnet mask
• Take, for example, a Class A default subnet mask, which is [Link]. This means
that the first byte of the subnet mask is all ones (1s), or 11111111. When referring
to a slash notation, you need to count all the 1s bits to figure out your mask. The
[Link] is considered a /8 because it has 8 bits that are 1s—that is, 8 bits that are
turned on.
• A Class B default mask would be [Link], which is a /16 because 16 bits are
(1s): 11111111.11111111.00000000.00000000.
• A Class C default mask would be [Link], which is a /24 because 24 bits
are (1s): 11111111.11111111. 11111111. 11111111. 11111111. 00000000.
Subnetting Class C
• In a Class C address, only 8 bits are available for defining the hosts. Remember
that subnet bits start at the left and go to the right, without skipping bits.
• Important We can’t use a /31 or /32 because, remember, we have to leave at least 2
host bits for assigning IP addresses to hosts
• Remember the default subnetmask in class C is [Link] OR /24
Last 8 bits in the subnet mask
v v
The 5 questions
• For each subnet we need to answer the following 5 questions
1-How many subnets does the chosen subnet mask produce?
2. How many valid hosts per subnet are available?
4. What are the valid subnets?
5. What’s the broadcast address of each subnet?
6. What are the valid hosts in each subnet?
1- How many subnets does the chosen
subnet mask produce?
• How many subnets?
• For example, for subnet mask [Link] or /26
• OR 11111111. 11111111. 11111111.11000000
Masked Unmasked
bits = 2 bits =6
• 2𝑥 = number of subnets.
• 𝑥 is the number of masked bits , or the 1s. For example, in 11000000,
the number of 1s gives us 22 =4 subnets. In this example, there are 4
subnets.
How many hosts per subnet?
• 2𝑦 – 2 = number of hosts per subnet. y is the number of unmasked bits, or the 0s.
For example, in 11000000, the number of 0s gives us 26 – 2 hosts. In this example,
there are 62 hosts per subnet. You need to subtract 2 for the subnet address and the
broadcast address, which are not valid hosts.
What are the valid subnets?
• What are the valid subnets? OR what is each network ID ( First IP
in the subnet)
• 256 – subnet mask = block size .
• An example would be 256 – 192 = 64. The block size of a 192
mask is always 64 IP per subnet.
• Start counting at zero in blocks of 64 until you reach the subnet
mask value, and these are your four subnets. 0, 64, 128, 192.
What’s the broadcast address for each subnet?
• What’s the broadcast address for each subnet?
• Now here’s the really easy part. Because we counted our subnets
in the last section as 0, 64, 128, and 192, the broadcast address is
always the number right before the next subnet.
• For example, the 0 subnet has a broadcast address of 63 because
the next subnet is 64.
• The 64 subnet has a broadcast address of 127 because the next
subnet is 128. And so on.
• And remember, the broadcast address of the last subnet is always
255.
What are the valid hosts in each subnet ?
• What are the valid hosts in each subnet ?
• Valid hosts are the numbers between the subnets, omitting all
the 0s and all the 1s.
• For example, if 64 is the subnet address and 127 is the
broadcast address, then 65–126 is the valid host range—it’s
always the numbers between the subnet address and the
broadcast address.
Practice Example #1 C: [Link] (/25)
• Practice Example #1 C: Network Address [Link] subnet mask [Link] (/25)
• 1- How many subnets? Because 128 is 1 bit on (10000000), the answer is 21 = 2.
• 2- How many hosts per subnet? We have 7 host bits off (10000000), so the equation is 27 – 2 =
126 hosts.
• 3- What are the valid subnets? 256 – 128 = 128.
• Remember, we’ll start at zero and count in our block size, so our subnets are 0, 128.
• So we have two subnets with network ID= [Link] and a92.168.10.128
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. For the 0 subnet, the next subnet is 128, so
the broadcast address of the 0 subnet is 127. and for subnet 128 is 255
So the broadcast addresses are [Link] and [Link]
Practical Example # 1
5- What are the valid hosts? These are the numbers ( Ips)between the subnet and broadcast address.
The easiest way to find the hosts is to write out the subnet address and the broadcast address.
This way, the valid hosts are obvious.
The following table shows the 0 and 128 subnets, the valid host ranges of each, and the broadcast address of
both subnets:
Practical Example #2
• In this second example, we’re going to subnet the network address [Link] using the subnet
mask [Link]. or [Link] /26
• We need to answer the five questions
1-How many subnets? Because 192 is 2 bits on (11000000), the answer is 22 = 4 subnets.
2-How many hosts per subnet? We have 6 host bits off (11000000), so the equation is 26 – 2 = 62 hosts.
3-What are the valid subnets? 256 – 192 = 64. Remember, we start at zero and count in our block size,
so our subnets are 0, 64, 128, and 192.
1- [Link], 2- [Link] 3- [Link] 4- [Link]
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. So the 4 broadcast addresses are
1- [Link], 2- [Link] 3- [Link] 4- [Link]
5- What are the valid hosts for each subnet
Subnet 1 valid host range ( [Link] to [Link])
Practical Example 4
• Practice Example #4C: [Link] with mask [Link] ([Link] /28)
• 1-How many subnets? 240 is 11110000 so the number of masked bits = 4 . And the number of subnets are
24 = 16.
2- Number of hosts per subnets. We have 4 unmasked bits ( 4 host bits) so the number of host per subnet equals
24 – 2 = 16 − 2 = 14.
3- Valid subnets ( subnet ID) ? 256 – 240 = 16.
• So the subnet ID are [Link], 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192,
• 208, 224, 240.
4-The broadcast IP are [Link], 31, 47, 63, 97, 95, 111, 127, 143, 159, 175, 191,
• 207, 223, 239,255.
5- valid hosts
Test your mind
• Network [Link] [Link] ( [Link]/27)
• Answer the 5 questions in 10 minutes.
What about this mask [Link] or
/30
• This mask gives you 2 useable IP ( hosts) for every subnet which is the
lowest feasible number of hosts per network.
• Widly used in point to pint interfaces ( connecting two routers for
example)
Subnetting Class B Addresses
• What are the possible subnet
• mask used to subnet class B addresses
• We know the Class B network address has 16 bits
available for host addressing.
• This means we can use up to 14 bits for
subnetting (because we have to leave at least
2 bits for host addressing by other words you
cannot use /31 or /32 subnet mask ).
Class B example no. 1
• IP : [Link] Mask: [Link] (/17)
• [Link] = Network address
• [Link] = Subnet mask
• We need to answer the 5 questions
• 1- number of subnets = 21 = 2
• 2- number of hosts per network = 215 − 2 = 32,766 host
• 3- Valid subnets = 256-128 = 128 so we have two subnets 0, 128
OR [Link] and [Link]
Class B example no. 1
• IP : [Link] Mask: [Link] (/17)
• [Link] = Network address
• [Link] = Subnet mask
• We need to answer the 5 questions
• 4- Broadcast address for each subnet 5- valid hosts
• The following table shows the two subnets available, the valid host range, and the broadcast address of each:
• Subnet [Link] [Link]
• First host [Link] [Link]
• Last host [Link] [Link]
• Broadcast [Link] [Link]
Class B example 2
• IP : [Link] Mask: [Link] (/18)
Class B example 4
Another examples