IP Addressing & Subnetting
IP Addressing
Subnetting
CIDR
VLSM
IP Addresses
• An IP address is an address used 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.
• 32 binary bits are broken into four octets (1 octet = 8 bits)
• Dotted decimal format (for example, 172.16.81.100)
IP Address Classes
• Class A: The first octet is the network portion. Octets 2, 3, and 4 are
for subnets/hosts
• Class B: The first two octets are the network portion. Octets 3 and 4
are for subnets/hosts
• Class C: The first three octets are the network portion. Octet 4 is for
subnets/hosts
Network Masks
• Distinguishes which portion of the address identifies the network
and which portion of the address identifies the node.
• Default masks:
Class A: 255.0.0.0
Class B: 255.255.0.0
Class C: 255.255.255.0
Private Address Range
Address Class Reserved Address Space
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
Public and Private IPv4 Addresses
Public Private
• Required by devices and • Not routable on the
hosts that connect directly Internet
to the Internet • 10.0.0.0/8
• 172.16.0.0/12
• Must be globally unique • 192.168.0.0./16
• Routable on the Internet • Can be assigned locally
• Must be assigned by by an organization
IANA/RIR • Must be translated to
access the Internet
Binary Notation
01110101 10010101 00011101 11101010
Figure 4-1
Dotted-decimal notation
Example 1
Change the following IP address from
binary notation to dotted-decimal notation.
10000001 00001011 00001011 11101111
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
Example 2
Change the following IP address from
dotted-decimal notation to binary
notation:
111.56.45.78
Solution
01101111 00111000 00101101 01001110
Example 3
Find the error in the following IP Address
111.56.045.78
Solution
There are no leading zeroes in
Dotted-decimal notation (045)
Example 3 (continued)
Find the error in the following IP Address
75.45.301.14
Solution
In decimal notation each number <= 255
301 is out of the range
Subnetting
• Subnetting is the process of dividing an IP space into manageable
segments of same sizes
• Creates multiple logical networks that exist within a single Class A,
B, or C network.
• If you do not subnet, you will only be able to use one network from
your Class A, B, or C network, which is unrealistic
• Each data link on a network must have a unique network ID, with
every node on that link being a member of the same network
Benefits of Subnetting
1) Reduced network traffic
2) Optimized network performance
3) Simplified management
4) Facilitated spanning of large geographical distances
How to create subnets
Determine the number of required network IDs:
One for each subnet
One for each wide area network connection
Determine the number of required host IDs per subnet:
One for each TCP/IP host
One for each router interface
Based on the above requirements, create the following:
One subnet mask for your entire network
A unique subnet ID for each physical segment
A range of host IDs for each subnet
Subnetting a Class A/B/C Address
• How many subnets does the chosen subnet mask produce?
• How many valid hosts per subnet are available?
• What are the valid subnets?
• What’s the broadcast address of each subnet?
• What are the valid hosts in each subnet?
Practice Example #1C: 255.255.255.128 (/25)
Network 192.168.1.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.
What are the valid hosts? These are the numbers between the subnet and
broadcast address
• Example 1
• 192.168.1.0/25 255.255.255.128
• 21= 2 Networks
• 27– 2 Hosts
Subnet Subnet 1 Subnet 2
Network ID 192.168.1.0 192.168.1.128
First host address 192.168.1.1 192.168.1.129
Last host address 192.168.1.126 192.168.1.254
Broadcast ID 192.168.1.127 192.168.1.255
Example 2
192.168.1.0/26 255.255.255.192
22= 4 Networks
26– 2 Hosts
Subnet Subnet 1 Subnet 2 Subnet 3 Subnet 4
Network ID 0 64 128 192
First address 1 65 129 193
Last address 62 126 190 254
Broadcast ID 63 127 191 255
Example 3
192.168.1.0/27 subnet mask ?
Practice Exercise
VLSM
• VLSM is a process of dividing an IP space into the subnets of different
sizes without wasting IP addresses. When we perform subnetting, all
subnets have the same number of hosts, this is known as FLSM ( Fixed
length subnet mask).
•
• In FLSM all subnets use same subnet mask, this lead to inefficiencies.
In real life scenario, some subnets may require large number of host
addresses while other may require only few addresses.
Example
Assume that you are a network administrator at BrainTechnologis.
Company have three departments connected with wan links.
• Development department have 74 computers.
• Production department have 52 computers.
• Administrative department have 28 computers.
• All departments are connected with each other via wan link.
• Each wan link requires two IP addresses.
• First choice with a example class B address space
• 172.168.1.0/23
• Subnetting of this address space would give us 128 subnets and 512
hosts in each subnet. Our network requires only 6 subnets and 160
addresses.
• Every IP address add more dollars in company bill. You would have to
pay for 65356 addresses while you need only 160 addresses. Would
you consider this address space for company?
• Second choice with two example class C address spaces
• 192.168.1.0/25
• 192.168.2.0/26
• Subnetting of first address 192.168.1.0/25 would give us 2 subnets
and 128 hosts in each subnet.
• Subnetting of second address 192.168.2.0/26 would give us 4 subnets
and 64 hosts in each subnet.
• Collectively we are getting 6 subnets and 512 hosts from these two
address spaces. We are still wasting more than 300 IP address, and
we would have to purchase two address spaces.
Variable Length Subnet Mask
• Variable Length Subnet Mask (VLSM) extends classic subnetting.
• VLSM is a process of breaking down subnets into the smaller subnets,
according to the need of individual networks. In above example
company have requirement of 6 subnets and 160 host addresses.
With VSLM you can fulfill this requirement with single class C address
space.
• VLSM Subnetting
• In VLSM Subnetting, we do subnetting of subnets according the
network requirement.
Steps for VLSM Subnetting
• Find the largest segment. Segment which need largest number of hosts
address.
• Do subnetting to fulfill the requirement of largest segment.
• Assign the appropriate subnet mask for the largest segment.
• For second largest segments, take one of these newly created subnets
and apply a different, more appropriate, subnet mask to it.
• Assign the appropriate subnet mask for the second largest segment.
• Repeat this process until the last network.
VLSM Example
• Now you know the steps of VLSM Subnetting. Let's understand it with
above example. Our company requires 6 subnets and 160 hosts.
• Step 1 :- Oder all segments according the hosts requirement (Largest
to smallest).
Subnet Segment Hosts
1 Development 74
2 Production 52
3 Administrative 28
4 Wan link 1 2
5 Wan link 2 2
6 Wan link 3 2
• Step 2 :- Do subnetting for largest segment. Our largest segment
needs 74 host addresses. /25 provide us two subnets with 128 hosts
in each subnet.
• 192.168.1.0/25
Subnet Subnet 1 Subnet 2
Network ID 192.168.1.0 192.168.1.128
First host address 192.168.1.1 192.168.1.129
Last host address 192.168.1.126 192.168.1.254
Broadcast ID 192.168.1.127 192.168.1.255
• Step 3 :- Assign subnet mask to the largest segment. As you can see in
above table, subnet 1 fulfill our largest segment requirement. Assign
it to our segment.
Segment Development
Requirement 74
CIDR /25
Subnet mask 255.255.255.128
Network ID 192.168.1.0
First hosts 192.168.1.1
Last hosts 192.168.1.126
Broadcast ID 192.168.1.127
• Step 4 :- Do subnetting for second largest segment from next available
subnet. Next segment requires 52 host addresses. Subnetting of /25 has
given us two subnets with 128 hosts in each, from that we have assigned
first subnet to development segment. Second segment is available, we
would do subnetting of this.
• /26 provide us 4 subnets with 64 hosts in each subnet
• 192.168.1.0/26
Subnet Subnet 1 Subnet 2 Subnet 3 Subnet 4
Network ID 0 64 128 192
First address 1 65 129 193
Last address 62 126 190 254
Broadcast ID 63 127 191 255
• We cannot use subnet 1 and subnet 2 ( address from 0 to 127 ) as
they are already assigned to development department. We can assign
subnet 3 to our production department.
Segment Production
Requirement 52
CIDR /26
Subnet mask 255.255.255.192
Network ID 192.168.1.128
First hosts 192.168.1.129
Last hosts 192.168.1.190
Broadcast ID 192.168.1.191
• Step 5 :- Our next segment requires 28 hosts. From above subnetting
we have subnet 3 and subnet 4 available. Do subnetting for the
requirement of 28 hosts.
• 192.168.1.0/27
Subnet Sub 1 Sub 2 Sub 3 Sub 4 Sub 5 Sub 6 Sub 7 Sub 8
Net ID 0 32 64 96 128 160 192 224
First Host 1 33 65 95 129 161 193 225
LastHost 30 62 94 126 158 190 222 254
Broadcast
31 63 95 127 159 191 223 255
ID
Subnets 1 to 6 [ address from 0 to 191] are already occupied by
previous segments. We can assign subnet 7 to this segment.
Segment Administrative
Requirement 28
CIDR /27
Subnet mask 255.255.255.224
Network ID 192.168.1.192
First hosts 192.168.1.193
Last hosts 192.168.1.222
Broadcast ID 192.168.1.223
• Step 6 :- Our last three segments require 2 hosts per subnet. Do
subnetting for these.
• 192.168.1.0/30
• Valid subnets are:-
• 0,4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64,68,72,76,80,84,88,9
2,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,156
,160,164,168,172,176,180,184,188,192,196,200,204,208,212,216,220
,224,228,232,236,240,244,248,252,256
• From these subnets, subnet 1 to subnet 56 ( Address from 0 - 220) are
already assigned to previous segments. We can use 224,228, and 232
for wan links.
Subnet Subnet 57 Subnet 58 Subnet 59
Network ID 224 228 232
First host 225 229 233
Last host 226 230 234
Broadcast ID 227 231 235
Assign these subnets to wan links.
Wan Link 1
Segments Wan Link 1
Requirement 2
CIDR /30
Subnet mask 255.255.255.252
Network ID 192.168.1.224
First hosts 192.168.1.225
Last hosts 192.168.1.226
Broadcast ID 192.168.1.227
Wan Link 2
Segments Wan Link 2
Requirement 2
CIDR /30
Subnet mask 255.255.255.252
Network ID 192.168.1.228
First hosts 192.168.1.229
Last hosts 192.168.1.230
Broadcast ID 192.168.1.231
Wan link 3
Segments Wan Link 3
Requirement 2
CIDR /30
Subnet mask 255.255.255.252
Network ID 192.168.1.232
First hosts 192.168.1.233
Last hosts 192.168.1.234
Broadcast ID 192.168.1.235
• We have assigned IP addresses to all segments, still we have 20
addresses available. This is the magic of VLSM.
CIDR
• Classless Interdomain Routing
• Improve address space utilization
• Routing scalability in the Internet
• For example, if an ISP owns network 172.16.0.0/16, then the ISP can
offer 172.16.1.0/24, 172.16.2.0/24,and so on to customers. Yet, when
advertising to other providers, the ISP only needs to advertise
172.16.0.0/16
The TCP/IP Protocol Suite
TCP/IP Protocol Suite
Application HTTP FTP SMTP
DNS POP3 SNMP
Transport TCP UDP
ARP IGMP
Internet IPv4 ICMP
IPv6
Mobile
Network Interface Ethernet Wi-Fi broadband
Protocols in the TCP/IP Suite
OSI TCP/IP TCP/IP Protocol Suite
Application
Presentation Application
Session
Transport Transport TCP UDP
Network Internet ARP
IPv4
IGMP
ICMP IPv6
Data Link Network Mobile
Interface Ethernet Wi-Fi
Physical broadband
TCP/IP Applications
Some common application layer protocols:
• HTTP
• HTTPS
• FTP
• RDP
• SMB
• SMTP
• POP3
What Is a Socket?
A socket is a combination of an IP address, a transport
protocol, and a port
TCP/IP Protocol Suite
HTTP (80) SMTP (25)
HTTPS (443) DNS (53)
POP3 (110) FTP (21)
TCP/UDP
IPv4 IPv6
SOMNOG5