Chapter 7
Introduction to IP Addressing and
Subnetting
Internet protocol(IP)
• The Internet Protocol (IP) is a protocol, or set of rules, for routing and
addressing packets of data so that they can travel across networks and
arrive at the correct destination.
• An IP address is a unique address that identifies a device on the internet
or a local network and represent dotted-decimal notation.
• When data is received or sent the message is divided into chunks called
packets.
• Each packet contains both the sender's internet address and the receiver's
address.
• Generally, there are two notations in which IP address is written, dotted
decimal notation and hexadecimal notation.
IP Address
IP address
What is an IP address?
• An IP address (internet protocol address) is a numerical
representation that uniquely identifies a specific interface on the
network.
• An IP address is an address used in order to uniquely identify a device
on an IP network.
• The address is made up of 32 binary bits, which can be divisible into a
network portion and host portion with the help of a subnet mask.
• There are two versions of IP in use today: IPv4 and IPv6. IPv4(Internet
Protocol version 4) and IPv6(Internet Protocol version 6).
IP Address
The octets numbered as follows depicting dotted decimal notation of
IP Address:
IPv4 and IPv6
• Addresses in IPv4 are 32-bits long. This allows for a maximum of
4,294,967,296 (232) unique addresses.
• Addresses in IPv6 are 128-bits, which allows for 3.4 x 1038 (2128) unique
addresses.
• The original IPv4 protocol is still used today on both the internet, and
many corporate networks.
• An IPv4 address is typically expressed in dotted-decimal notation,
with every eight bits (octet) represented by a number from 0-255,
each separated by a dot.
…IPv4 and IPv6
• For example, the address 168.212.226.204 represents the 32-bit
binary number 10101000.11010100.11100010.11001100.
• IPv4 addresses are composed of two parts.
• The first numbers in the address specify the network, while the latter
numbers specify the specific host.
Example 1
Change the following IP address from binary
notation to dotted-decimal notation.
10000001 00001011 00001011 11101111
Solution
129.11.11.239
Example 2
Change the following IP address from
dotted-decimal notation to binary
notation:
111.56.45.78
Solution
01101111 00111000 00101101 01001110
IP address classes
• IPv4 address space was broken into five classes:
• Class A, Class B, Class C, Class D and Class E.
• Class A
• In a Class A network, the first eight bits, or the first dotted decimal, is
the network part of the address, with the remaining part of the
address being the host part of the address. There are 128 possible
Class A networks.
IP Address classes
Class A
IP address belonging to class A are assigned to the networks that
contain a large number of hosts.
The network ID is 8 bits long. 27-2= 126 network ID
The host ID is 24 bits long.
The higher order bit of the first octet in class A is always set to 0.
The remaining 7 bits in first octet are used to determine network ID.
Thus, the first octet ranges from 1 – 127, i.e.
Class A …
The 24 bits of host ID are used to determine the host in any network.
The default subnet mask for class A is 255.x.x.x.
Therefore, class A has a total of:
27-2= 126 network ID (Here 2 address is subtracted because 0.0.0.0 and
127.x.y.z are special address.) The IP range 127.x.x.x is reserved for loopback
IP addresses.
224 – 2 = 16,777,214 host ID
Class B
IP address belonging to class B are assigned to the networks that
ranges from medium-sized to large-sized networks.
The network ID is 16 bits long.
The host ID is 16 bits long.
The higher order bits of the first octet of IP addresses of class B are
always set to 10.
The remaining 14 bits are used to determine network ID.
Class B …
Thus, the first octet ranges from 128 – 191, i.e. or 128.0.0.0 to 191.255.0.0
The 16 bits of host ID is used to determine the host in any network. The
default sub-net mask for class B is 255.255.x.x.
Class B has a total of:
214 = 16384 network address
216 – 2 = 65534 host address
Class C
• IP address belonging to class C are assigned to the networks that
makes the first 24 bits of the address the network address and the
remainder as the host address.
• Class C network addresses range from 192.0.0.0 to 223.255.255.0.
The higher order bits of the first octet of IP addresses of class B are
always set to 110.
The remaining 21 bits are used to determine network ID.
Class D
• Class D addresses are used for multicasting applications.
• Class D addresses have their first three bits set to “1” and their fourth
bit set to “0”.
• Class D addresses are 32-bit network addresses, meaning that all the
values within the range of 224.0.0.0 – 239.255.255.255 are used to
uniquely identify multicast groups.
• There are no host addresses within the Class D address space, since
all the hosts within a group share the group’s IP address for receiver
purposes.
Class E
• Class E networks are defined by having the first four network address
bits as 1.
• That encompasses addresses from 240.0.0.0 to 255.255.255.255.
• Note: Class D and Class E used for multicast and experimental uses
Subnet Mask
• Every device has an IP address with two pieces: the client or host
address and the server network address.
• The subnet mask splits the IP address into the host and network
addresses, thereby defining which part of the IP address belongs to
the device and which part belongs to the network.
• A subnet mask is a 32-bit number created by setting host bits to all 0s
and setting network bits to all 1s.
• Subnet mask separates network bits from host bits
• Routers read subnet masks left to right, bit for bit
– Bits set to 1 are part of the network ID
– Bits set to 0 are part of the host ID
Example: calculate NetId and HostId
• Given 8.20.15.1/ 255.0.0.0
• 8.20.15.1 = 00001000.00010100.00001111.00000001
• 255.0.0.0 = 11111111.00000000.00000000.00000000
• Any address bits which have corresponding mask bits set to 1
represent the network ID.
• Any address bits that have corresponding mask bits set to 0 represent
the node ID.
Example 9
What is the subnetwork address if the
destination address is 200.45.34.56 and the
subnet mask is 255.255.240.0?
Solution
11001000 00101101 00100010 00111000
11111111 11111111 11110000 00000000
11001000 00101101 00100000 00000000
The subnetwork address is 200.45.32.0.
IP Address Classes and Subnet Masks
• A Class A subnet mask reflects the network portion in the first octet
and leaves octets 2, 3, and 4 for the network manager to divide into
hosts and subnets as needed.
• Class A default subnet mask is 255.0.0.0.
• A Class B subnet mask claims the first two octets for the network,
leaving the remaining part of the address, the 16 bits of octets 3 and
4, for the subnet and host part.
• Class B default subnet mask is 255. 255.0.0.
…IP Address Classes and Subnet Masks
• In a Class C subnet mask, the network portion is the first three octets
with the hosts and subnets in just the remaining 8 bits of octet 4.
• Class C: 255.255.255.0
• The benefits of subnetting include:
Reduced network traffic
Optimized network performance
Simplified management
Facilitated spanning of large geographical distances
Calculate new subnet mask
• Step to Calculate new subnet mask:
1. Determine the class of IP network.
2. Determine the default subnet mask or prefix for the class of address.
3. Determine how many host bits were borrowed or given to the
network.
4. Calculate the new subnet mask and prefix. To calculate the new subnet
mask, start with the first binary 0 in the default subnet mask and
change it to a binary 1. Continue doing this, moving left to right, for
the number of bits borrowed.
Default subnet mask and new subnet mask
Practice Example #1: 255.255.255.128/ 25
Network 192.168.10.0
• How many subnets? Since 128 is 1 bit on (10000000), the answer
would be 21= 2.
• How many hosts per subnet? We have 7 host bits off (10000000), so
the equation would be 27– 2 = 126 hosts.
• 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.
• 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 zero subnet, the next subnet is
128, so the broadcast of the 0 subnet is 127.
Practice Example #2: 255.255.255.224/ 27
Network 192.168.10.0
How many subnets? 224 is 11100000, so our equation would be 23 =
8.
How many hosts? 25– 2 = 30.
What are the valid subnets? 256 – 224 = 32. We just start at zero
and count to the subnet mask value in blocks (increments) of 32: 0,
32, 64, 96, 128, 160, 192, and 224.
What’s the broadcast address for each subnet (always the number
right before the next subnet)?
What are the valid hosts (the numbers between the subnet number
and the broadcast address)?
Practice Example #2: 255.255.255.224
THE END!