Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Lecture 06
1. 1
IP Subnetting and
Addressing
Indian Institute of Technology Kharagpur
Prof Indranil Sengupta
Computer Science and Engineering
Indian Institute of Technology
Kharagpur
Lecture 6: IP Subnetting and Addressing
On completion, the student will be able to:
1. Explain the concept of IP subnets, and subnet
masks.
2. Compare the benefits of using subnets against
multiple address classes.
3. Explain the concept of variable length subnet
mask (VLSM) with example.
4. Explain how classless inter-domain routing
(CIDR) helps in better address assignment.
2. 2
IP Subnetting
IP Subnet
• Basic concept:
A subset of a class A, B or C network.
• IP addresses that do not use subnets
consists of
a network portion, and
a host portion.
Represents a static two-level hierarchical
addressing model.
3. 3
IP Subnet (contd.)
• IP subnets introduces a third level of
hierarchy.
a network portion
a subnet portion
a host portion
Allow more efficient (and structured)
utilization of the addresses.
Uses network masks.
Natural Masks
• Network mask 255.0.0.0 is applied to
a class A network 10.0.0.0.
In binary, the mask is a series of
contiguous 1’s followed by a series of
contiguous 0’s.
11111111 00000000 00000000 00000000
Network
portion
Host
portion
4. 4
Natural Masks (contd.)
• Provide a mechanism to split the IP
address 10.0.0.20 into
a network portion of 10, and
a host portion of 20.
Decimal Binary
IP address:10.0.0.20 00001010 00000000 00000000 00010100
Mask: 255.0.0.0 11111111 00000000 00000000 00000000
Network Host
Natural Masks (contd.)
• Class A, B and C addresses
Have fixed division of network and host
portions.
Can be expressed as masks.
Called natural masks.
• Natural Masks
Class A :: 255.0.0.0
Class B :: 255.255.0.0
Class C :: 255.255.255.0
5. 5
Creating Subnets using Masks
• Masks are very flexible.
Using masks, networks can be divided
into smaller subnets.
• How?
By extending the network portion of the
address into the host portion.
• Advantage gained:
We can create a large number of subnets
from one network.
Can have less number of hosts per
network.
Example: Subnets
• Network mask 255.255.0.0 is applied
to a class A network 10.0.0.0.
This divides the IP address 10.5.0.20
into
a network portion of 10,
a subnet portion of 5, and
a host portion of 20.
The 255.255.0.0 mask borrows a portion
of the host space, and applies it to
network space.
6. 6
Subnets (contd.)
• What happens?
Initially it was a single large Class A
network (224-2 hosts).
We have now split the network into
256 subnets.
From 10.0.0.0 to 10.255.0.0.
The hosts pet subnet decreases to
65,534.
Subnets (contd.)
Decimal Binary
IP address: 10.5.0.20 00001010 00000101 00000000 00010100
Mask: 255.255.0.0 11111111 11111111 00000000 00000000
Network Subnet Host
7. 7
Default Mask and Subnet mask
AND
AND
Default Mask
255.255.0.0
Subnet Mask
255.255.192.0
IP Address
144.16.72.57
IP Address
144.16.72.57
Network Address
144.16.0.0
Network Address
144.16.64.0
192: 1100 0000
72: 0100 1000
Subnets vrs Multiple Address Classes
• Subnets
Management of subnets is done by
local network administrator.
Single entry in external router tables.
• Multiple Address Classes
Multiple entries in external router tables.
Additional overhead on the backbone
(external) routers.
9. 9
Example: VLSM
• Suppose we are assigned a Class C
network 192.203.17.0.
To be divided into three subnets.
Corresponding to three departments.
With 110, 45 and 50 hosts respectively.
D1
(110)
D2
(45)
D3
(50)
The Example (contd.)
• Available subnet options
The network mask will be the Class C
natural mask 255.255.255.0
Subnet masks of the form 255.255.255.X
Can be used to divide the network
into more subnets.
10. 10
4641111 1100252
8321111 1000248
16161111 0000240
3281110 0000224
6441100 0000192
12821000 0000128
No. of
Hosts
No. of
Subnets
X (in
binary)
X
• Cannot satisfy the requirements.
The Subnet Options
The VLSM Option
• Basic concept:
Use the mask 255.255.255.128 to divide
the network address into two subnets
with 128 hosts each.
192.203.17.0 (.0 to .127)
192.203.17.0 (.128 to .255)
11. 11
The VLSM Option (contd.)
Next subnet the second .128 subnet
using a mask of 255.255.255.192.
Creates two subnets, 64 hosts each
192.213.17.128 (.128 to .191)
192.213.17.128 (.192 to .255)
The VLSM Option (contd.)
192.203.17.0
192.203.17.0 (.0 to .127) 192.203.17.0 (.128 to .255)
192.213.17.128 (.128 to .191)
192.213.17.128 (.192 to .255)
Mask:
255.255.255.128
Mask:
255.255.255.192
12. 12
HIDDEN SLIDE
Interface 1 :: 128 hosts
Network number: 192.203.17.0
Network mask: 255.255.255.128
Address: 192.203.17.0 -- .127
Interface 2 :: 64 hosts
Network number: 192.203.17.128
Network mask: 255.255.255.192
Address: 192.203.17.128 -- .191
Interface 3 :: 64 hosts
Network number: 192.203.17.192
Network mask: 255.255.255.192
Address: 192.203.17.192 -- .255
Running out of IP addresses
• Growing demand for IP addresses.
Severe strain on the classful model.
Due to wastage of address space.
• Measures taken:
Creative allocation of IP addresses.
Classless Inter-Domain Routing (CIDR).
Private IP addresses, and Network
Address Translation (NAT).
IP version 6 (IPv6).
13. 13
CIDR: Introduction
• The size of the global routing tables
have grown very fast in recent years.
Caused routers to become saturated.
• CIDR is a new concept to manage IP
networks.
Classless Inter Domain Routing.
No concept of class A, B, C networks.
Reduces sizes of routing tables.
Basic Idea Behind CIDR
• An IP address is represented by a
prefix, which is the IP address of the
network.
• It is followed by a slash, followed by
a number M.
M: number of leftmost contiguous bits
to be used for the network mask.
Example: 144.16.192.57 / 18
14. 14
CIDR: An Important Rule
• The number of addresses in each
block must be a power of 2.
• The beginning address in each block
must be divisible by the number of
addresses in the block.
A block that contains 16 addresses
cannot have beginning address as
144.16.223.36.
But the address 144.16.192.64 is
possible.
Example: CIDR
• An organization is allotted a block with
beginning address:
144.16.192.24 / 29
What is the range of the block?
Start addr: 10010000 00011000 11000000 00011000
End addr: 10010000 00011000 11000000 00011111
There are 8 addresses in the block.
15. 15
Recent Trend
• Move on to CIDR addressing.
Existing classful networks can also be
represented using this notation.
Class A: W.X.Y.Z / 8
Class B: W.X.Y.Z / 16
Class C: W.X.Y.Z / 24
• Recent routers support CIDR.
16. 16
SOLUTIONS TO QUIZ
QUESTIONS ON
LECTURE 5
Quiz Solutions on Lecture 5
1. What does the port number in a TCP
connection specify?
It specifies the communicating
processes on the two end systems.
2. Why is it necessary to have both IP
address and port number in a packet?
IP address identifies the host computer.
Port number identifies a running process
in the host computer.
17. 17
Quiz Solutions on Lecture 5
3. Which of the layers TCP, UDP and IP
provides for reliable communication?
Only TCP provides reliable
communication.
4. Both UDP and IP transmit datagrams. In
what ways are they different?
UDP carries the port numbers of
source and destination, and an
optional checksum, in addition.
Quiz Solutions on Lecture 5
5. What are well-known port numbers?
Port numbers that are assigned to
standard programs and known publicly
are called well-known port numbers.
They lie in the range 1 and 1023.
6. What are ephemeral port numbers?
They are temporary and short-lived port
numbers assigned by client on a per
connection basis. They range from 1024
to 65535.
18. 18
Quiz Solutions on Lecture 5
7. With respect to a transport level
connection, what are the five components
in an association?
a) The protocol (TCP or UDP).
b) Local host IP address (32-bit value).
c) Local port number (16-bit value).
d) Remote host IP address (32-bit value).
e) Remote port number (16-bit value).
Quiz Solutions on Lecture 5
8. Why is the pseudo-header used in
calculating TCP checksum?
To protect TCP from misdelivery from IP.
9. What are the different fields in the pseudo
header?
Source IP address, destination IP address,
protocol, segment length.
19. 19
Quiz Solutions on Lecture 5
10. Suppose that 5000 bytes are transferred over
TCP. The first byte is numbered 20050. What
are the sequence numbers for each segment
if data is sent in four segments with the first
two segments carrying 1000 bytes and the
last two segment carrying 1500 bytes?
Segment 1 20,050 (20,050 to 21,049)
Segment 2 21,050 (21,050 to 22,049)
Segment 3 22,050 (22,050 to 23,549)
Segment 4 23,550 (23,550 to 25,049)
Quiz Solutions on Lecture 5
11. What is the purpose of the PSH flag in the
TCP header?
To “push” TCP data. Typically used to
indicate end of message.
12. What is the purpose of the ACK flag in the
TCP header?
To indicate that the “Acknowledgement”
field is in use.
20. 20
Quiz Solutions on Lecture 5
13. If you are developing a network application
on a reliable LAN environment, which of TCP
or UDP would you prefer, and why?
UDP, because reliability of transmission
need not be worried about. And UDP is
faster than TCP.
QUIZ QUESTIONS ON
LECTURE 6
21. 21
Quiz Questions on Lecture 6
1. For the subnet mask 255.255.192.0, how
many hosts per subnet are possible?
2. In classful addressing, if we are using the
subnet mask 255.255.192.0, which address
class does it correspond to?
3. What is the subnet address if the
destination IP address is 144.16.34.124 and
the subnet mask is 255.255.240.0 ?
4. What is the natural mask for a class C
network?
Quiz Questions on Lecture 6
5. Using simple subnets, is it possible to
divide a network into unequal sized
subnets?
6. For an IP address 10.17.5.122 and subnet
mask 255.255.128.0, what is the subnet
address? How many hosts per subnet
are possible?
7. Among multiple network classes and
subnets, which alternative imposes more
burden on the external router?
22. 22
Quiz Questions on Lecture 6
8. Using VLSM, give a scheme to split a
class C address into four subnets where
the number of hosts required are:
100, 55, 20, 30
9. If the number of hosts required are 100,
50, 50 and 20, can VLSM be used?
10. Can the following be the beginning
addresses in CIDR based addressing?
144.16.192.32/28 188.15.170.55/28
10.17.18.42/28 200.0.100.80/28
Quiz Questions on Lecture 6
11. For a CIDR address of the form W.X.Y.Z/20,
what is the maximum number of hosts
possible in the network?
12. Which of the following can be the starting
address of a CIDR block that contains 512
addresses?
144.16.24.128 144.16.75.0
144.16.24.0 144.16.0.0