Unit 1
Unit 1
Program: B.Tech
Course Code: TCS703
Course Name: Computer Networks -II
SYLLABUS
Unit - I
Routing Algorithms: Introduction, global vs decentralized routing, The Link State(LS) Routing
Algorithm, The Distance Vector (DV) Routing Algorithm, Hierarchical Routing, Routing in the
Internet: RIP, OSPF, BGP; Introduction to Broadcast and Multicast Routing
Unit - II
Link Layer and Local Area Networks: Introduction to Link Layer and its services, Where Link Layer is
implemented?, Error detection and correction techniques: Parity checks, Checksumming, CRC;
Multiple Access protocols: Channel Partitioning, Random Access (Slotted Aloha, Aloha, CSMA),
Taking Turns; Link Layer Addressing: MAC addresses, ARP, Ethernet, CSMA/CD, Ethernet
Technologies, Link Layer Switches, Switches vs Routers, VLANS
Unit – III
Multimedia Networking: Introduction, Streaming Stored Audio and Video, Real Time Streaming
Protocol(RTSP), Making the Best of the Best Effort Services, Protocols for Real Time Interactive
Applications: RTP, RTCP, SIP, H.323; Providing multiple classes of service.
Unit – IV
Generalized forwarding and SDN Match , Action, Open flow, SDN Control Plane , SDN controller and
SDN control Application , Open flow protocol, Data and control plane Interaction , SDN : PAST and
FUTURE.
Unit – V
Network Programming: Sockets-Address structures, TCP sockets, creating sockets, bind, listen,
accept, fork and exec function, close function; TCP client server: Echo server, normal startup,
terminate and signal handling, server process termination, crashing and rebooting of server, host
shutdown; Elementary UDP sockets: UDP echo server, lack of flow control with UDP
Routing
Packet go from source to destination via
routers.
Router consults the routing table.
Routing table can be static [does not
change automatically] or dynamic
[changes automatically].
Routing protocols are needed to create
the routing tables dynamically.
A routing protocol is a combination of
rules and procedures that lets routers in
the internet inform one another of
changes. It allows routers to share
whatever they know about the internet
or their neighborhood.
3
4
Unicasting
6
Autonomous systems
8
Routing Information Protocol
(RIP)
RIP is based on Distance vector routing.
Distance vector routing
Sharing knowledge about the entire autonomous system:
Each router periodically shares its knowledge about the
entire autonomous system with its neighbours.
Sharing only with neighbours through all its interfaces.
Sharing at regular intervals: 30 seconds.
Routing table
Has one entry for each destination network of which the
router is aware.
Each entry has destination network address, the shortest
distance to reach the destination in hop count, and next
router to which the packet should be delivered to reach
its final destination.
Hop count is the number of networks that a packet
encounters to reach its final destination.
9
Table 21.1 A distance vector routing table
Hop Next
Destination Other information
Count Router
163.5.0.0 7 172.6.23.4
197.5.13.0 5 176.3.6.17
189.45.0.0 4 200.5.1.6
115.0.0.0 6 131.4.7.19
10
RIP Updating Algorithm
Receive: a response RIP message
1. Add one hop to the hop count for each advertised
destination.
2. Repeat the following steps for each advertised destination:
1. If (destination not in the routing table)
1. Add the advertised information to the table.
2. Else
1. If (next-hop field is the same)
1. Replace entry in the table with the advertised one.
2. Else
1. If (advertised hop count smaller than one in the
table)
1. Replace entry in the routing table.
3. Return.
11
Example of updating a routing table
12
Initial routing tables in a small autonomous system
15
Autonomous System
16
Areas in an Autonomous System
Area is a collection of networks, hosts, and routers
all contained within an autonomous system.
Routers inside an area flood the area with routing
information.
Area border routers: Summarize the information
about the area and send it to other routers.
Backbone area [Primary area]: All the areas inside
an autonomous system must be connected to the
backbone. Routers in this area are called as
backbone routers. This area identification number is
0.
If, due to some problem, the connectivity between a
backbone and an area is broken, a virtual link
between routers must be created by the
administration to allow continuity of the functions of
the backbone as the primary area. 17
OSPF
Metric
Administrator can assign the cost to each route.
Based on type of service (minimum delay, maximum
throughput, and so on)
Link state routing
Sharing knowledge about the neighbourhood: Each router
sends the state of its neighbourhood to every other router in
the area.
Sharing with every other router: By flooding, a process
whereby a router sends its information to all its neighbours
(through all its output ports). Each neighbour sends the
packet to all its neighbours, and so on. Every router that
receives the packet sends copies to each of its neighbours.
Eventually, every router (without exception) has received a
copy of the same information.
Sharing when there is a change; Only to its neighbours.
Each router should have the exact topology of the internet at
every moment.
From this topology, a router can calculate the shortest path
between itself and each network. 18
Types of Links
Point-to-point
Connects two routers without any other
router or host in between.
Directly connected routers using serial line.
Only one neighbour.
19
Transient link
A network with several routers attached to it.
Each router has many neighbours.
Lot of advertisements about their neighbours.
One of the routers in the network has two duties: true
router and designated router because we can not connect
each router to every other router through one single
network. Each router has only one neighbour, the
designated router (network). On the other hand, the
designated router (network) has five neighbours.
Designated router represents a network. There exists a
metric between each node to the designated router but
there is no metric from the designated router to any other
node.
20
Stub Link
Stub
A network that is connected to only one router.
The data packets enter the network through this single
router and leave the network through this same router.
Virtual
When the link between two routers is broken, the
administration may create a virtual link between them,
using a longer path that probably goes through several
routers.
21
Example of an internet & Graphical representation
22
Types of LSAs
23
Network link
24
Summary link to network
26
External link
Dijkstra Algorithm
1. Start with the local node (router): the root of the tree.
2. Assign a cost of 0 to this node and make it the first permanent node.
3. Examine each neighbor node of the node that was the last
permanent node.
4. Assign a cumulative cost to each node and make it tentative.
5. Among the list of tentative nodes
1. Find the node with the smallest cumulative cost and make it
permanent.
2. If a node can be reached from more than one direction
1. Select the direction with the shortest cumulative cost.
6. Repeat steps 3 to 5 until every node becomes permanent.
28
Shortest-path calculation
The number next to each node represents the cumulative cost from
the root node.
Note that if a network can be reached through two directions with
two cumulative costs, the direction with the smaller cumulative
cost is kept, and the other one is deleted.
29
Shortest-path calculation
30
Table 21.2 Link state routing table for router A
N1 5 C
N2 7 D
N3 10 B
N4 11 D
N5 15 C
31
BGP
Border Gateway Protocol
Inter-autonomous system routing protocol.
BGP is based on a routing method called path
vector routing.
Why D.V and L.S are not good enough?
In D.V:
Sometimes we don’t want the route with
smallest hop count as the preferred route
[like, avoiding non-secure routes].
D.V routing information provides only the hop
count and not the path that leads to that
destination.
A router that receives a distance vector
advertisement packet may be fooled if the
shortest path is actually calculated through
the receiving router itself.
32
Why D.V and L.S are not good
enough?
Link State routing
Internet is too big for this routing method
To use link state routing for the whole
internet would require each router to have a
huge link state database.
It would also take a long time for each
router to calculate its routing table using the
Dijkstra algorithm
Path Vector routing
Each entry in the routing table contains the
destination network, the next router, and
the path to reach the destination.
The path is usually defined as an ordered list
of autonomous systems that a packet should
travel through to reach the destination.
33
Table 21.3 Path vector routing table
34
Path Vector Messages
38
Multicast Routing
One to many; Source is unicast address,
but the destination is a group address
(Class D)
When a router receives a packet, it may
forward it through several of its ports
Router may discard the packet if it is not
in the multicast path.
Flooding: A router forwards a packet out of
all its port except the one from which the
packet came. Flooding provides
broadcasting, but it also creates loops. A
router will receive the same packet over
and over from different ports. Several
copies of the same packet are circulated,
creating traffic jams.
39
Multicasting
40
IGMP
Internet Group Management Protocol
Group Management
IGMP is not a multicasting routing protocol
membership.
In any network, there are one or more
41
Figure 21.24 IGMP message types
42
Figure 21.25 IGMP message format
43
Table 21.4 IGMP type field
Type Value
44
Figure 21.26 IGMP operation
IGMP operates locally.
A multicast router connected to a network has a list of multicast addresses
of the groups for which the router distributes packets to groups with at least
one loyal member in that network.
For each group, there is one router which has the duty of distributing the
multicast packets destined for that group.
A host or multicast router can have membership in a group. When a host
has membership, it means that one of its processes (an application
program) receives multicast packets from some group. When a router has
membership, it means that a network connected to one of its other
interfaces receives these multicast packets.
In both cases, the host and the router keep a list of groupids and relay their
interest to the distributing router.
47
Figure 21.28 Leave report
49
Figure 21.29 General query message
No Response
50
Delayed Response
When a host or router receives a query message, it
does not respond immediately; it delays the
response.
Each host or router uses a random number to create
a timer, which expires between 1 and 10 seconds.
The expiration time can be in steps in 1s or less.
Each group in the list has its own timer.
Each host or router waits until its timer has expired
before sending a membership report message.
As the membership report is a broadcast, the waiting
host or router receives the report and knows that
there is no need for duplication of report message by
many hosts.
51
Multicast Trees
Objectives of Multicasting are
Each member of the group should receive one, and only one, copy
of the multicast packet. Receipt of multiple copies is not allowed.
Nonmembers must not receive a copy.
There must be no loops in routing; that is, a packet must not visit a
router more than once.
The path traveled from the source to each destination must be
optimal (the shortest path).
Source-Based Tree
A single tree is made for each combination of source and group.
MOSPF, DVMRP, PIM-DM.
Group-Shared Tree
Each group in the system shares the same tree.
Tree changes when the group changes but remains the same
when the group remains the same.
Group determines the tree and not the source.
Approaches to find multicast tree: Steiner tree [only theoretical],
rendezvous-point tree.
CBT, PIM-SP
52
MBONE
Only a small fraction of Internet routers are multicast
routers.
A multicast router may not find another multicast router
in the neighborhood to forward the multicast packet.
Tunneling helps to connect the multicast routers
logically. Routers enclosed in broken circles are capable
of multicasting. To enable multicasting, we make a
multicast backbone (MBONE) out of these isolated
routers, using the concept of tunneling.
53
Figure 21.32 MBONE
54
Figure 21.33 Multicast routing protocols
DVMRP
Source-based routing protocol
Formation of shortest-path tree
No router knows the complete route for a particular
destination. Each router knows from which port to
send out a unicast packet on the destination address.
Optimal tree is determined while the packet travels.
When a router receives a packet, the router forwards
the packet through some of the ports, based on the
source address, and contributes to the formation of
the tree; the rest of the tree is made by other down-
stream routers.
55
This protocol should accomplish the following:
Must prevent the formation of loops
Must prevent duplications; no network receives more
than one copy. In addition, the path traveled by a
copy is the shortest path from the source to the
destination.
Must provide for dynamic membership.
Reverse Path Forwarding
A router forwards the copy that has traveled the
shortest path from the source to the router.
To find if the packet has traveled the shortest path,
RPF uses the unicast routing table of RIP.
It pretends that it needs to send a packet to the
source and finds if the port given by the routing table
is the same from which the packet has arrived.
56
Figure 21.34 Reverse path forwarding
60
MOSPF
Multicast Open Shortest Path First
Uses multicast link state routing to create
source-based trees.
First, the tree is a least-cost tree (using a
metric) instead of a shortest-path tree.
Second, the tree is made all at once instead of
gradually (the tree is said to be premade,
prepruned, and ready to be used).
Least-Cost Trees
Each router knows the entire topology of the
network.
Each router uses Dijkstra’ algorithm to create a least-
cost trees that has the router as the root and the rest
of the routers as nodes of the tree.
Least cost trees in MOSPF is different for each router.
61
Figure 21.37 Unicast tree and multicast tree
62
Solution to the problems
Add a new link state update packet to associate the
unicast address of a host with the group address or
addresses the host is sponsoring. It is called a group
membership LSA.
We make a tree that contains all the hosts belonging to
a group, but we use the unicast address of the host in
the calculation.
Link state packets can also solve the second problem
if they are sent whenever there is a change in the
membership.
The router can calculate the least-cost trees on
demand (when it receives the first multicast packet).
In addition, the tree can be saved in the cache
memory for future use by the same source-group
pair. MOSPF is a data-driven protocol.
63
CBT
Core-Based Tree
Group-shared protocol that uses a core as the root of the tree.
Autonomous system is divided into regions, and a core (center
router or rendezvous router) is chosen for each region.
Formation of tree
After rendezvous router is selected, every router is informed of
the unicast address of the selected router.
All routers sends a unicast join message that passes through all
routers that are located between sender and rendezvous router.
Each intermediate router extracts the necessary information from
the message, such as the unicast address of the sender and the
port through which the packet has arrived, and forwards the
message to the next router in the path.
When the rendezvous router has received all join messages from
every member of the group, the tree is formed. Now every router
knows its upstream and downstream router.
64
Figure 21.38 Shared-group tree with rendezvous router
65
DVMRP and CBT
MOSPF
Tree is made from the Tree is made from the
root leaves
The tree is first made There is no tree in the
(broadcasting) and then beginning; the joining
pruned. (grafting) gradually
makes the tree.
66
Figure 21.39 Sending a multicast packet to the rendezvous router
67
PIM (Protocol Independent Multicast)
PIM-DM & PIM-SM are two independent
multicast routing protocols, which are unicast-
protocol-dependent.
PIM-DM (Dense Mode)
Unicast protocol dependent
Used when there is a possibility that each router is
involved in multicasting
Use of broadcast is justified because almost all routers
are involved in the process.
Source-based routing protocol that uses RPF and
pruning/grafting strategies for multicasting
Operation is like DVMRP but unicast protocol
independent.
It assumes that the autonomous system is using a
unicast protocol and each router has a table that can
find the outgoing port that has an optimal path to a
destination. This unicast protocol can be a distance
vector protocol (RIP) or link state protocol (OSPF).
68
PIM-SM (Sparse mode)
Used when there is a slight possibility that each router
is involved in multicasting.
Use of protocol that broadcasts is not justified.
Protocol like CBT that uses a group-shared tree is
more appropriate.
A group-shared routing protocol that has a
rendezvous point (RP) as the source of the tree.
Like CBT but does not require acknowledgement from
a join message. In addition, it creates a backup set of
RPs for each region to cover RP failures.
PIM-SM can switch from group-shared tree to source-
based tree strategy if necessary. This can happen if
there is a dense area of activity far from the RP.
Multicasting is applied in distributed databases,
information dissemination, distance learning,
and particularly multimedia communications.
69