Unit-1 2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 121

ACN

Unit-1
Network Layer

Dr. Vijeta Khare


2

Network Layer
▪ Design issues
▪ Routing
▪ Congestion
▪ Internetworking
▪ Internet Protocols
▪ Multimedia or QoS
3

Design issues
▪ Goal of layer: get packets from source host to destination host
✔ Routing: should know about topology of subnet
✔ Congestion: should avoid overloading some communication lines and
routers
✔ Quality of service: offer the appropriate service
✔ Internetworking: deal with network differences, if source and destination
are connected to different networks
4

Design issues
▪ Store-and-forward packet switching
✔ Equipment of: carrier <> customer
✔ Algorithm at router
▪ Receive packet
▪ Check packet (e.g. checksum)
▪ Forward packet
5

Design issues: services


▪ Interface
✔ Important: = interface between carrier and customer
✔ Designed with following goals in mind:
▪ Services should be independent of the subnet technology
▪ Transport layer should be shielded from the number, type, topology of the
subnets
▪ Network addresses should use a uniform numbering plan, even across LANs and
WANs
▪ Connections?
✔ Connection-oriented <> Connectionless!
6

Design issues: services


▪ Connection-oriented <> Connectionless
✔ PTTs: connection-oriented
▪ 100 years of experience with the world-wide telephone system
▪ Connection time 🞆 billing!
✔ Internet
▪ Subnets are inherently unreliable
✔ Real issue: where to put the complexity as some/many applications
require reliable transfer (~ connection-oriented service)
▪ Network layer
▪ Transport layer
7

Design issues: services


▪ Connection-oriented <> Connectionless (cont.)
✔ In favour of connectionless service
▪ Computing power is cheap: hosts can handle the complexity
▪ Subnet is a large, long lasting investment: keep it simple
▪ For some applications speedy delivery (low, constant delay) is important
✔ In favour of connection-oriented service
▪ Users want a reliable trouble-free service
▪ Some services are easier to provide on top of connection-oriented service
✔ Examples
▪ ATM: connection oriented
▪ IP: connection-less
▪ IP on top of ATM
8

Design issues: services

Network
Layer
9

Design: internal organisation


▪ Virtual circuits
✔ Routes chosen at connection time
✔ Connection identified by a virtual circuit number (VCn)
✔ Primary service of subnet is connection-oriented

4
Transport 7 Transport
Network Network
Data Link Data Link
Physical Physical
Routing problem: map
[Incoming line, VCn]
🞆[outgoing line, VCn]
10

Design: internal organisation


▪ Virtual circuits
11

Design: internal organisation


▪ Datagram subnet
✔ Each packet is routed independently
✔ Subnet has more work to do
✔ More robust, easier to adapt to failures and congestion

Transport Transport
Network Network
Data Link Data Link
Physical Physical
Routing problem: map
Destination address
🞆 Outgoing line
12

Design: internal organisation


▪ Datagram subnet
13

Design: internal organisation


▪ Datagram subnet

Change of routing table


14

Design: internal organisation


Issue Datagram subnet VC subnet

Circuit setup Not needed required

Addressing Full addresses (source + Short VC number in each


destination) in each packet packet
State information No state held in subnet State held for each VC

Routing Done for each packet Route chosen at connection


independently setup
Effect of router None, except for packet All VCs passing failed router
failures losses are terminated
Congestion control difficult Easy if enough buffers can be
allocated in advance
15

Design: internal organisation


Type of subnet
Service to upper layer Datagram Virtual Circuit

Connectionless UDP UDP


IP IP
ATM
Connection-oriented TCP ATM AAL1
IP ATM
16

Network Layer
▪ Design issues
▪ Routing
▪ Congestion
▪ Internetworking
▪ Internet Protocols
▪ Multimedia or Qos
Routing and Forwarding
routing algorithm routing algorithm determines
end-end-path through network

local forwarding table forwarding table determines


header value output link local forwarding at this router
0100 3
0101 2
0111 2
1001 1

value in arriving
packet’s header
0111 1

3 2
18
Routing Algorithms
▪ Properties
▪ Flooding
▪ Shortest Path Routing
▪ Distance Vector Routing Most important
▪ Link State routing algorithms!
▪ Path Vector Routing
▪ Broadcast routing
▪ Multicast routing
▪ Routing for mobile hosts
▪ Routing in Ad Hoc Networks
▪ Node Lookup in Peer-to-Peer Networks
19
20

Routing algorithms
▪ Desirable properties
✔ Correctness
✔ Simplicity } all algorithms
✔ Robustness: able to cope with
▪ changes in topology, load
▪ hardware and software failures ⎫ hard to achieve
✔ Stability ⎬
▪ Converge to equilibrium
✔ Fairness

✔ Optimality
} conflicting
21

Routing algorithms
▪ Desirable properties (cont.)
✔ Fairness
Conflict!
✔ Optimality
22

Routing algorithms
▪ Taxonomy
✔ Non adaptive
▪ Routing decisions computed in advance, off-line and downloaded
✔ Adaptive
▪ To changes in
▪ Topology
▪ Load
▪ Get information
▪ Locally
▪ From adjacent routers
▪ From all routers
Routing: flooding
▪ Every packet is sent out on every outgoing line except the one it
arrived at
▪ Sometimes useful
✔ Robust algorithm: e.g. military applications
✔ Broadcast
✔ Comparison purposes: always shortest path
▪ Selective flooding
✔ Use only those lines that are going approximately in right direction
✔ Still working?

23
Routing: flooding
▪ Every packet is sent out on every outgoing line except the one it
arrived at

24
Routing: flooding
▪ Every packet is sent out on every outgoing line except the one it
arrived at

25
Routing: Flooding
▪ Every packet is sent out on every outgoing line except the one it
arrived at

26
Routing: flooding
▪ Every packet is sent out on every outgoing line except the one it
arrived at

27
Routing: flooding
▪ Every packet is sent out on every outgoing line except the one it
arrived at
▪ Duplicates!! How to limit?
✔ Hop counter
▪ Decrement in each router
▪ Discard packet if counter is 0
▪ Initialisation?
✔ Sequence number in packet
▪ Avoid sending the same packet a second time
▪ Keep in each router per source a list of packets already seen
▪ Useful?

28
Figure 22.13 Popular routing protocols

22.29
Routing: Shortest path
▪ All routing algorithms are conceptually finding shortest path in graph
▪ In computer networks, the shortest path algorithms aim to find the optimal
paths between the network nodes so that routing cost is minimized. They are
direct applications of the shortest path algorithms proposed in graph theory.
▪ Some common shortest path algorithms are −
✔ Bellman Ford’s Algorithm : distance vector routing
✔ Dijkstra’s Algorithm: Link state routing

▪ Network is represented in the form of :


✔ Graph
▪ Node = router
▪ Arc = communication line
✔ Metric
▪ Number of hops
▪ Geographic distance
▪ Mean queueing and transmission delay

30
Routing: shortest path
(Example from a to H)
Initial node

Elements of algorithm:
• Mark all nodes as free: 🞆
• Mark initial node as selected: ●
• repeat till destination is selected:
• Label all free nodes reachable from selected nodes with shortest
distance to a selected node
• Select free node with shortest distance to a selected node and mark
it as selected

31
Routing: shortest path

32
Routing: link state
Overview of algorithm:

▪ Each router must


1. Discover its neighbours and learn their network addresses
2. Measure the delay or cost to each of its neighbours
3. Construct a packet with these distances
4. Send this packet to all other routers
5. Compute the shortest path to every other router through Dijkstra’s
Algorithm.
▪ Also known as Dijkstra’s Algorithm.

33
Routing: link state
1. Learning about neighbours:
✔ Upon boot of router
▪ Send HELLO packet on each point-to-point line
▪ Routers are supposed to send reply with a globally unique name
✔ LAN model

2. Measuring line cost


✔ Measure round-trip delay of HELLO Packet and its reply
✔ Take load into account? Arguments both ways

34
Routing: link state
3. Building link state packets
✔ Packet containing:
□ When to build?
▪ Identity of sender
• periodically
▪ Sequence number + age
▪ For each neighbour: name + distance • when significant events occur

35
Routing: link state
4. Distributing link state packets
▪ Flooding +
▪ Sequence number (in each packet) to limit duplicates
▪ Age (Time to live) is to remove flooding problem

5. Computing new routes:


✔ With a full set of link state packets, a router can:
▪ Construct the entire subnet graph
▪ Run Dijkstra’s algorithm to compute the shortest path to each destination
✔ Problems for large subnets
▪ Memory to store data
▪ Compute time

36
Dijkstra’s Algorithm(Link State Routing Algorithm)
▪ It computes the least-cost path from one node (source node) to all
other nodes in the network.
▪ Its iterative and after the kth least-cost paths are known to k
destination nodes.
▪ Notation:
✔ c(x,y): link cost from node x to y; = ∞ if not direct neighbours
✔ D(v): current value of cost of path from source to destination v
✔ p(v): predecessor node along path from source to v
✔ N': set of nodes whose least cost path definitively known
Dijkstra’s Algorithm
1 Initialization:
2 N' = {u}
3 for all nodes v
4 if v adjacent to u
5 then D(v) = c(u,v)
6 else D(v) = ∞
7
8 Loop
9 find w not in N' such that D(w) is a minimum
10 add w to N'
11 update D(v) for all v adjacent to w and not in N' :
12 D(v) = min( D(v), D(w) + c(w,v) )
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N'
Dijkstra’s Algorithm – Example:1
D(v) D(w) D(x) D(y) D(z)
Step N' p(v) p(w) p(x) p(y) p(z)
0 u 7,u 3,u 5,u ∞ ∞
1 uw 6,w 5,u 11,w ∞
2 uwx 6,w 11,w 14,x
3 uwxv 10,v 14,x
x
4 uwxvy 12,y 9
5 uwxvyz
5 7
1 Initialization:
4
2 N' = {u} 8
3 for all nodes v
4 if v adjacent to u 3
5 then D(v) = c(u,v) u w y z
6 else D(v) = ∞ 2
7
8 Loop 3
9 find w not in N' such that D(w) is a minimum 7 4
10 add w to N'
11 update D(v) for all v adjacent to w and not in N' :
12 D(v) = min( D(v), D(w) + c(w,v) ) v
13 /* new cost to v is either old cost to v or known
14 shortest path cost to w plus cost from w to v */
15 until all nodes in N'
5

v 3 w
2 5
u 2 1 z
3
1 2
x 1
y

▪ Source Node: u
Dijkstra’s Algorithm – Example:2
Step N' D(v),p(v) D(w),p(w) D(x),p(x) D(y),p(y) D(z),p(z)
0 u 2,u 5,u 1,u ∞ ∞
1 ux 2,u 4,x 2,x ∞
2 uxy 2,u 3,y 4,y
3 uxyv 3,y 4,y
4 uxyvw 4,y
5 uxyvwz

v 3 w
2 5
u 2 1 z
3
1 2
x 1
y
Routing: distance vector
▪ Algorithm
✔ At each step within a router:
▪ Get routing tables from neighbours (Every 30 to 90 sec)
▪ Compute distance to neighbours:
▪ Compute new routing table
✔ Characteristics:
▪ Iterative
▪ Asynchronous
▪ Distributed

▪ It is distributed in that each node receives some information from one or more of its
directly attached neighbours, performs a calculation, and then distributes the results
of its calculation back to its neighbours.
▪ It is iterative. so, process continues on until no more information is exchanged
between neighbours.
▪ The algorithm is asynchronous. It does not require all of the nodes to operate with
each other.
42
Routing: distance vector
Routing table for A
To cost via
A 0 -
B 12 B
C 25 B
D 40 B
E 14 E
F 23 E
G 18 B
H 17 J
I 21 E
J 9 J
K 24 J
L 29 J
43
Routing: distance vector
▪ Adaptive algorithm
✔ Exchange of info only with neighbours
▪ Data to be available in each router
✔ Routing table: per destination
▪ Distance
▪ Outgoing line
✔ Distance to all neighbours

44
Routing: distance vector
Routing table for A
To cost via
A 0 -
B 12 B
C 25 B
D 40 B
E 14 E
F 23 E
G 18 B
H 17 J
I 21 E
J 9 J
K 24 J
L 29 J
46
Routing: distance vector
Routing tables from

JA=8
JI=10
JH=12
JK=6
47
Find route to J to G
Routing: distance vector

Better?
● Keep 4 tables (one for each neighbour)
● Use shortest path

48
Routing: distance vector
▪ Distributed algorithm
✔ Triggers:
▪ Change in delay to neighbour
▪ Receive new table from neighbour
✔ Update local tables
✔ If changed: forward routing tables to neighbours

Problems – Count to infinity problem which can be solved by splitting


horizon.
– Good news spread fast and bad news spread slowly.
– Persistent looping problem i.e. loop will be there forever.

49
Routing: distance vector

Good news:
● A comes up again

Only distances to A

Faster not possible!!!

50
Routing: distance vector
Bad news:
● A goes down

B receives:
● Distance ∞ from A
● Distance 2 from C
New distance from B to A: 3 via C

51
Routing: distance vector
Bad news:
● A goes down

C still
● believes its distance to A is 2
LOOP!!! ● routes via B
B routes its packets for A via C

52
Routing: distance vector
Bad news:
● A goes down

Loops!!
Slow!!

∞ = 5?

53
Difference: LS and DV Routing Algorithm
Distance Vector Protocol Link State Protocol
Entire routing table is sent as an update Updates are incremental & entire routing table is
not sent as update
Distance vector protocol send periodic Updates are triggered not periodic
update at every 30 or 90 second
Update are broadcasted Updates are multicasted

Updates are sent to directly connected Update are sent to entire network & to just
neighbour only directly connected neighbour
Routers don't have end to end visibility Routers have visibility of entire network of that
of entire network. area only.
It is prone to routing loops No routing loops
Figure 22.13 Popular routing protocols

22.55
Path Vector Routing
▪ Both LSR and DVR are intradomain routing algorithm, which works
on single network
▪ Path vector is a inter network routing Algorithm.
▪ Internet is divided into Autonomous Systems
✔ Distinct regions of administrative control
✔ Routers/links managed by a single “institution”
✔ Service provider, company, university, …
▪ Hierarchy of Autonomous Systems
✔ Large, tier-1 provider with a nationwide backbone
✔ Medium-sized regional provider with smaller backbone
✔ Small network run by a single company or university
▪ Interaction between Autonomous Systems
✔ Internal topology is not shared between ASes
✔ … but, neighboring ASes interact to coordinate routing
Interdomain Routing
▪ AS-level topology
✔ Destinations are IP prefixes (e.g., 12.0.0.0/8)
✔ Nodes are Autonomous Systems (ASes)
✔ Edges are links and business relationships

4
3

2
7 6

1
Web server
Client 57
Path-Vector Routing
▪ Extension of distance-vector routing
✔ Support flexible routing policies
✔ Avoid count-to-infinity problem
▪ Key idea: advertise the entire path
✔ Distance vector: send distance metric per dest d
✔ Path vector: send the entire path for each dest d

“d: path (2,1)” “d: path (1)”


3
2 1
data traffic data traffic
d 58
Destination Path
A1 AS1
.
.
A3 AS1
B1 AS1-AS2
B2 AS1-AS2
C1 AS1-AS3
Destination Path C2 AS1-AS3
A1 AS1 C3 AS1-AS3
A2 AS1
Figure 22.30 Initial routing tables in path vector routing
Figure 22.31 Stabilized tables for three autonomous systems
Faster Loop Detection
▪ Node can easily detect a loop
✔ Look for its own node identifier in the path
✔ E.g., node 1 sees itself in the path “3, 2, 1”
▪ Node can simply discard paths with loops
✔ E.g., node 1 simply discards the advertisement

“d: path (2,1)” “d: path (1)”


3
2 1

“d: path (3,2,1)”


62
Flexible Policies
▪ Each node can apply local policies
✔ Path selection: Which path to use?
✔ Path export: Which paths to advertise?
▪ Examples
✔ Node 2 may prefer the path “2, 3, 1” over “2, 1”
✔ Node 1 may not let node 3 hear the path “1, 2”
2 3 2 3

1 1
63
Network Layer Routing
The four network transmission types are as follows:
▪ Unicast,
▪ Broadcast,
▪ Multicast,
▪ Anycast
Broadcast Routing
▪ Host need to send messages to many or all other hosts.
▪ For example
✔ A service distributing weather reports
✔ Stock market updates
✔ Live radio programs
▪ In Short, Sending a packet to all destinations simultaneously is called
broadcasting.
▪ First broadcasting method that simply send a distinct packet to each
destination.
▪ So, it waste of bandwidth, but it also requires the source to have a
complete list of all destinations.
▪ In practice this may be the only possibility, but it is the least desirable of
the methods.
Broadcast Routing – Cont…
▪ Flooding is Second method. Although flooding is for ordinary
point-to-point communication, for broadcasting it might rate
serious consideration, especially if none of the methods are
applicable.
▪ The problem with flooding as a broadcast technique is the same
problem it has as a point-to-point routing algorithm.
▪ It generates too many packets and consumes too much
bandwidth.
▪ A third algorithm is Multi Destination Routing.
▪ If this method is used, each packet contains either a list of
destinations or a bit map indicating the desired destinations.
Broadcast Routing – Cont…
▪ When a packet arrives at a router, the router checks all the destinations
to determine the set of output lines that will be needed.
▪ The router generates a new copy of the packet for each output line to
be used and includes in each packet only those destinations that are to
use the line.
▪ A fourth broadcast algorithm makes explicit use of the sink tree for the
router initiating the broadcast-or any other convenient spanning tree
for that matter.
▪ A spanning tree is a subset of the subnet that includes all the routers
but contains no loops.
▪ If each router knows which of its lines belong to the spanning tree, it
can copy an incoming broadcast packet onto all the spanning tree lines
except the one it arrived on.
Multicast Routing
▪ Sending a message to a group is called multicasting, and its routing
algorithm is called multicast routing.
▪ Multicasting requires group management. Need to create and destroy
groups, and to allow processes to join and leave groups.
▪ To do multicast routing, each router computes a spanning tree covering
all other routers.
▪ For example, in Figure (a) we have two groups, 1 and 2.
▪ Some routers are attached to hosts that belong to one or both of these
groups, as indicated in the figure.
Multicast Routing – Cont…
▪ A spanning tree for the leftmost router is shown in Figure (b).
▪ When a process sends a multicast packet to a group, the first router
examines its spanning tree and prunes it, removing all lines that do not
lead to hosts that are members of the group.
▪ In our example, Figure (c) shows the pruned spanning tree for group 1.
▪ Figure(d) shows the pruned spanning tree for group 2. Multicast packets
are forwarded only along the appropriate spanning tree.
Anycast Routing

▪ Anycast, also known as IP anycast, is a networking technique that allows


for multiple machines to share the same IP address.
▪ Based on the location of the user request, the routers send it to the
machine in the network that is closest.
✔ Multiple service instances announce they share the same IP address.
✔ When the user's browser makes a request, the router receives that request and
simply chooses the route with the shortest distance to the nearest server based
on the AS path.
▪ Using anycast, the route is optimized due to it always selecting the best
path. In the case that a server is down, the BGP will simply find the next
best path and route the request there.
Comparison between RIP OSPF and BGP
RIP OSPF BGP
RIP is intra domain OSPF is also intra domain It is inter domain routing
routing protocol used routing protocol used protocol used between
with in the autonomous with in the autonomous the autonomous system
system system
RIP is used for Small OSPF is used in large The BGP protocol is used
networks with maximum autonomous system with for very large-scale
number of hops 16 no limitation networks
RIP uses Distance Vector OSPF uses Link State BGP uses Path Vector
RIP send entire routing OSPF send multicast Hello BGP send Open packet to
update to all directly packet to the neighbours, the neighbours to create
connected interface to create session session
RIP use Bellman ford OSPF use Dijikstra BGP use Path-Vector
Algorithm Algorithm Routing
IP Addressing - Example
▪ IP address: It is 32-bit 223.1.1.1

identifier for host, router 223.1.2.1


interface 223.1.1.2

▪ Interface: It is a connection 223.1.1.4 223.1.2.9

between host/router and


physical link. 223.1.1.3
223.1.3.27
223.1.2.2
✔ A router’s typically have multiple
interfaces
✔ A host typically has one or two
223.1.3.1 223.1.3.2
interfaces
▪ IP addresses associated with
each interface.
223.1.1.1 = 11011111 00000001 00000001 00000001

223 1 1 1
72
IP Address
▪ IP addresses are useful in identifying a specific host in a network.
▪ IP addresses are 32 bit numbers which are divided into 4 octets.
Each octet represents 8 bit binary number.
▪ Below is an example of an IP address:

10101100 00010000 11111110 00000001

172 16 254 1

IP addresses are divided into 2 parts:


Network ID & Host ID
<NID> <HID> = IP Address
Classification of IP Addresses (Classful Addressing)
Class: A
0
7 Bit 24 Bit
Fix Network ID Host ID
Class: B
1 0
Fix 14 Bit 16 Bit
Network ID Host ID
Class: C
1 1 0
Fix 21 Bit 8 Bit
Network ID Host ID
Class: D
1 1 1 0
Fix
Class: E Multicast address
1 1 1 1
Fix Reserved address
Class A: Range(0.0.0.0 to 127.255.255.255) Dotted decimal notation
0
7 Bit 24 Bit
Network ID Host ID
▪ Only 126 addresses are used for network address.
▪ All 0’s and 1’s in Network-ID are dedicated for special IP address.
So, total number of IP address in class A can be represented:
0.0.0.0 Special IP Address
00000001.0.0.1
1.0.0.2
1.0.0.3
. 224 – 2 are Host IP
.
.
126.255.255.254
127.255.255.255 Special IP Address – Loopback
Class B: Range (128.0.0.0 to 191.255.255.255)
1 0
Fix 14 Bit 16 Bit
Network ID Host ID

128.0.0.0 Special IP Address


10000001.0.0.1
130.0.0.2
130.0.0.3
. 216 – 2 are Host IP
.
.
190.255.255.254
10111111.255.255.255 Special IP Address – Loopback
Class C: Range(192.0.0.0 to 223.255.255.255)
1 1 0
Fix 21 Bit 8 Bit
Network ID Host ID

192.0.0.0 Special IP Address


11000001.0.0.1
194.0.0.2
194.0.0.3
. 28 – 2 are Host IP
.
.
222.255.255.254
11011111.255.255.255 Special IP Address – Loopback
Class D: Range (224.0.0.0 to 239.255.255.255)
▪ Very first four bits of the first octet in Class D IP addresses are set
to 1110, giving a range of:

▪ Class D has IP address rage from 224.0.0.0 to 239.255.255.255.


▪ Class D is reserved for Multicasting.
▪ In multicasting data is not destined for a particular host, that is
why there is no need to extract host address from the IP address,
and Class D does not have any subnet mask.
Class E: (240.0.0.0 to 255.255.255.255)
▪ This IP Class is reserved for experimental purposes only for R&D or
Study.
▪ IP addresses in this class ranges from 240.0.0.0 to
255.255.255.254.
▪ Like Class D, this class too is not equipped with any subnet mask.
Type of addresses in IPv4 Network
▪ Network address - The address by which we refer to the network.
✔ E.g.: 10.0.0.0

▪ Broadcast address - A special address used to send data to all


hosts in the network.
✔ The broadcast address uses the highest address in the network range.

✔ E.g.: 10.0.0.255

▪ Host addresses - The addresses assigned to the end devices in the


network.
✔ E.g.: 10.0.0.1
Type of addresses – Cont…
Assignment
1. Change the following IP addresses from dotted-decimal notation to binary notation.
a. 114.34.2.8
b. 129.14.6.8

2. Change the following IP addresses from binary notation to dotted-decimal notation.


a. 01111111 11110000 01100111 01111101
b. 10101111 11000000 11111000 00011101

3. Find the class of the following IP addresses.


a. 11110111 11110011 10000111 11011101
b. 10101111 11000000 11110000 00011101

4. Find the netid and the hostid of the following IP addresses.


a. 114.34.2.8
b. 132.56.8.6
Masking Example To extract network and
83host network

▪ Extract network:
IP Address: 10110101 11011101 01010100 01110010
Mask: & 11111111 11111111 00000000 00000000
Result: 10110101 11011101 00000000 00000000

◻ Extract host:
IP Address: 10110101 11011101 01010100 01110010
Subnet Mask: & ~(11111111 11111111 00000000 00000000)
Result: 00000000 00000000 01010100 01110010
Subnets
84 ▪ Problem: need to break up large A and B classes
▪ Solution: add another layer to the hierarchy
✔ From the outside, appears to be a single network
▪ Only 1 entry in routing tables
✔ Internally, manage multiple subnetworks
▪ Split the address range using a subnet mask

Pfx Ntwk Subnet Host


Subnet Mask: 11111111 11111111 11000000 00000000
Subnet Example
85

▪ Extract network:
IP Address: 10110101 11011101 01010100 01110010
Subnet Mask: & 11111111 11111111 11000000 00000000
Result: 10110101 11011101 01000000 00000000

◻ Extract host:
IP Address: 10110101 11011101 01010100 01110010
Subnet Mask: & ~(11111111 11111111 11000000 00000000)
Result: 00000000 00000000 00010100 01110010
Classless Inter-Domain Routing(CIDR)
▪ CIDR is a slash notation of subnet mask. CIDR tells us number of
on bits in a network address.
subnet host
part part
11001000 00010111 00010000 00000000
200.23.16.0/23
▪ A single IP address can be used to designate many unique IP
addresses with CIDR.
▪ A CIDR IP address looks like a normal IP address except that it ends
with a slash followed by a number, called the IP network prefix.
▪ CIDR addresses reduce the size of routing tables and make more IP
addresses available within organizations.
Subnetting
▪ Subnetting take places when we extend the default subnet mask.
▪ We cannot perform subnetting with default subnet mask and
every classes have default subnet mask.
▪ Now find the host bits borrowed to create subnets and convert
them in decimal.
▪ For example find the subnet mask of address 188.25.45.48/20 ?
1. Class B, Default Subnet mask: 255.255.0.0
2. Borrowed 4 bit from host part so mask is now:
11111111 11111111 11110000 00000000
255 255 240 0
How many subnets from given subnet mask?
▪ To calculate the number of subnets provided by given subnet mask
we use 2N , where N = number of bits borrowed from host bits to
create subnets.
▪ For example in 192.168.1.0/27, N is 3.
▪ By looking at address we can determined that this address is
belong to class C and default subnet mask 255.255.255.0 [/24 in
CIDR].
▪ In given address we borrowed 27 - 24 = 3 host bits to create
subnets.
▪ Now 23 = 8, so our answer is 8 (number of subnets ).
What are the total hosts?
▪ Total hosts are the hosts available per subnet
▪ To calculate total hosts use formula 2H = Total hosts
▪ H is the number of host bits
▪ For example in address 192.168.1.0/26
▪ We have 32 - 26
1. [Total bits in IP address - Bits consumed by network address] = 6
2. Total hosts per subnet would be 26 = 64
IP Addressing Summary
Size Default subn
Size
Leadin of networ Number Total et CIDR
of rest Addresses Start
Class g k of addresses End address mask in dot- notatio
bit per network address
bits number networks in class decimal n
field
bit field notation

16,777,21 2,147,483,64 127.255.255.25


Class A 0 8 24 128 (27) 0.0.0.0 255.0.0.0 /8
6 (224) 8 (231) 5

16,384 65,536 1,073,741,82 191.255.255.25


Class B 10 16 16 128.0.0.0 255.255.0.0 /16
(214) (216) 4 (230) 5

2,097,15 536,870,912 223.255.255.25 255.255.255.


Class C 110 24 8 256 (28) 192.0.0.0 /24
2 (221) 29
(2 ) 5 0

Class D not
not not not 268,435,456 239.255.255.25 not
(multicas 1110 define 224.0.0.0 not defined
defined defined defined (228) 5 defined
t) d

Class E not
not not not 268,435,456 255.255.255.25 not
(reserved 1111 define 240.0.0.0 not defined
defined defined defined (228) 5 defined
) d
Assignment
1. In a block of addresses, we know the IP address of one host is 25.34.12.56/16. What are
the first address (network address) and the last address (limited broadcast address) in this
block?

2. Find the range of addresses in the following blocks (For both network and host).
a. 123.56.77.32/29
b. 200.17.21.128/27

3. Write the following masks in slash notation (In).


a. 255.255.255.0
b. 255.0.0.0
21-1 ADDRESS MAPPING

The delivery of a packet to a host or a router requires


two levels of addressing: logical and physical. We need
to be able to map a logical address to its corresponding
physical address and vice versa. This can be done by
using either static or dynamic mapping.

Topics discussed in this section:


Mapping Logical to Physical Address
Mapping Physical to Logical Address

21.92
Figure 21.1 Mapping Logical to Physical Address
ARP (address resolution protocol)

21.93
Note

ARP can be useful if the ARP reply is


cached (kept in cache memory for a
while).

21.94
Mapping Physical to Logical
Address: RARP
■ A diskless station just booted.
■ An organization does not have enough IP
addresses to assign to each station.

21.95
Reverse Address Resolution
Protocol (ARP)
■ A machine can use the physical address to get
the logical address using RARP.
■ A RARP messages is created and broadcast on
the local network.
■ The machine on the local network that knows
the logical address will respond with a RARP
reply.
■ Broadcasting is done at data link layer.
■ Broadcast requests does not pass the
boundaries of a network.

21.96
Internet Control Message Protocol (ICMP)

• The IP (Internet Protocol) relies on several other protocols to


perform necessary control and routing functions:
• Control functions (ICMP): [**ping and traceroute**]
• Multicast signaling (IGMP)
• Setting up routing tables (RIP, OSPF, BGP, PIM, …)

97
Overview

• The Internet Control Message Protocol (ICMP) is a


helper protocol that supports IP with facility for
– Error reporting
– Simple queries

• ICMP messages are encapsulated as IP datagrams:

98
ICMP message format

4 byte header:
• Type (1 byte): type of ICMP message (Error reporting or
Query)
• Code (1 byte): subtype of ICMP message
• Checksum (2 bytes): similar to IP header checksum.
Checksum is calculated over entire ICMP message
If there is no additional data, there are 4 bytes set to zero.
🡪 each ICMP messages is at least 8 bytes long
99
ICMP Query message

ICMP query:
• Request sent by host to a router or host
• Reply sent back to querying host

100
ICMP Error message

• ICMP error messages report error conditions


• Typically sent when a datagram is discarded
• Error message is often passed from ICMP to the
application program

101
ICMP Error message

• ICMP error messages include the complete IP header and


the first 8 bytes of the payload (typically: UDP, TCP)

102
Frequent ICMP Error message

Type Code Description

3 0–15 Destination Notification that an IP datagram could not be


unreachable forwarded and was dropped. The code field
contains an explanation.
5 0–3 Redirect Informs about an alternative route for the
datagram and should result in a routing table
update. The code field explains the reason for
the route change.
11 0, 1 Time Sent when the TTL field has reached zero
exceeded (Code 0) or when there is a timeout for the
reassembly of segments (Code 1)
12 0, 1 Parameter Sent when the IP header is invalid (Code 0) or
problem when an IP header option is missing (Code 1)

103
Some subtypes of the “Destination Unreachable”

Code Description Reason for Sending


0 Network No routing table entry is available for the destination
Unreachable network.
1 Host Destination host should be directly reachable, but
Unreachable does not respond to ARP Requests.
2 Protocol The protocol in the protocol field of the IP header is
Unreachable not supported at the destination.
3 Port The transport protocol at the destination host cannot
Unreachable pass the datagram to an application.
4 Fragmentation IP datagram must be fragmented, but the DF bit in the
Needed IP header is set.
and DF Bit Set

104
IGMP

• The Internet Group Management Protocol (IGMP) is a protocol that allows


several devices to share one IP address so they can all receive the same
data.
• IGMP is a network layer protocol used to set up multicasting on networks
that use the Internet Protocol version 4
• Applications:
• Streaming – Multicast routing protocol are used for audio and video
streaming over the network i.e., either one-to-many or many-to-many.
• Gaming – Internet group management protocol is often used in simulation
games which has multiple users over the network such as online games.
• Web Conferencing tools – Video conferencing is a new method to meet
people from your own convenience and IGMP connects to the users for
conferencing and transfers the message/data packets efficiently.
How does IGMP work?

• Computers and other devices connected to a network use IGMP when


they want to join a multicast group.
• A router that supports IGMP listens to IGMP transmissions from devices in
order to figure out which devices belong to which multicast groups.
• IGMP uses IP addresses that are set aside for multicasting.
• Multicast IP addresses are in the range between 224.0.0.0 and
239.255.255.255. (In contrast, anycast networks can use any regular IP
address.)
• Each multicast group shares one of these IP addresses.
• When a router receives a series of packets directed at the shared IP
address, it will duplicate those packets, sending copies to all members of
the multicast group.

106
107
Working:

• IGMP works on devices that are capable of handling multicast groups and dynamic
multicasting.
• These devices allows the host to join or leave the membership in the multicast
group.
• These devices also allows to add and remove clients from the group.
• This communication protocol is operated between host and local multicast router.
• When a multicast group is created, the multicast group address is in range of class
D (224-239) IP addresses and is forwarded as destination IP address in the
packet.

108
Note

DHCP provides static and dynamic


address allocation that can be
manual or automatic.

21.109
Dynamic Host Configuration Protocol -
DHCP
• Dynamic Host Configuration Protocol is a protocol for
assigning dynamic IP addresses to devices on a network.
DHCP
223.1.1.0/24
server
223.1.1.1 223.1.2.1

223.1.1.2 arriving DHCP


223.1.1.4 223.1.2.9
client needs
address in this
223.1.1.3 223.1.3.27
223.1.2.2 network

223.1.2.0/24

223.1.3.1 223.1.3.2

223.1.3.0/24
DHCP – Cont…

• With dynamic addressing, a device can have a different IP


address every time it connects to the network.
• In some systems, the device's IP address can even change
while it is still connected.
• It allows reuse of addresses (only hold address while
connected “on”).
• It also support mobile users who want to join network.
DHCP Client Server Interaction
DHCP server: 223.1.2.5 DHCP discover arriving
client
src : 0.0.0.0, 68
Broadcast: is there a
dest.: 255.255.255.255,67
DHCPyiaddr:
server 0.0.0.0
out there?
transaction ID: 654

DHCP offer
src: 223.1.2.5, 67
Broadcast: I’m a DHCP
dest: 255.255.255.255, 68
server!
yiaddrr:Here’s an IP
223.1.2.4
transaction ID:
address you can use654
lifetime: 3600 secs
DHCP request
src: 0.0.0.0, 68
dest:: 255.255.255.255, 67
Broadcast: OK. I’ll take
yiaddrr: 223.1.2.4
that IP address!
transaction ID: 655
lifetime: 3600 secs

DHCP ACK
src: 223.1.2.5, 67
dest: 255.255.255.255,
Broadcast: 68
OK. You’ve
yiaddrr: 223.1.2.4
got that IPID:
transaction address!
655
lifetime: 3600 secs
113

Congestion

When too much traffic is offered, congestion sets in and


performance degrades sharply.
114

General Principles of Congestion Control

1. Monitor the system .


– detect when and where congestion occurs.
2. Pass information to where action can be taken.
3. Adjust system operation to correct the problem.
4. One of the main causes of congestion is that
traffic is often bursty.
5. Also affect Quality of service
115

Congestion Control in Virtual-Circuit Subnets

(a) A congested subnet. (b) A redrawn subnet,


eliminates congestion and a virtual circuit from A to
B.
116

Buffering

Smoothing the output stream by buffering packets.


117

The Leaky Bucket Algorithm

(a) A leaky bucket with water. (b) a leaky bucket with packets.

A simple leaky bucket algorithm can be implemented using FIFO queue. A FIFO
queue holds the packets.
118

The Token Bucket Algorithm

5-34

(a) Before. (b) After.


9/12/2023 Tanenbaum Chapter
• Step 1 − In regular intervals tokens are thrown into the bucket
f.
• Step 2 − The bucket has a maximum capacity f.
• Step 3 − If the packet is ready, then a token is removed from
the bucket, and the packet is sent.
• Step 4 − Suppose, if there is no token in the bucket, the
packet cannot be sent.

119
Sr no. Token Bucket Leaky Bucket
1 Token bucket is token dependent. Leaky bucket is token independent.

2 Block diagram token bucket. Block diagram of leaky bucket.

3 If bucket is full token are discarded but not the If bucket is full packet or data is discarded.
packet.

4 Token bucket allows for large bursts to be sent faster Leaky bucket sends the packets at an average rate.
by speeding up the output.

5 Token bucket allows saving up of tokens (permission) Leaky bucket does not allow saving a constant rate is
to send large bursts. maintained.

6 Packets can only Transmitted when there are Packet are transmitted continuously.
enough token.

7 It save token. It is does not save token.

120
Thank You

You might also like