packet switching networksportal.unimap.edu.my/portal/page/portal30/lecture notes/kejuruteraan... ·...

52
PACKET SWITCHING NETWORKS OVERVIEW: NETWORK LAYER, FORWARDING VS. ROUTING, ROUTING IN PACKET NETWORKS, STATIC VS. DYNAMIC ROUTING, SHORTEST PATH ROUTING

Upload: others

Post on 12-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

PACKET SWITCHING

NETWORKS

OVERVIEW: NETWORK LAYER, FORWARDING VS. ROUTING, ROUTING IN PACKET

NETWORKS, STATIC VS. DYNAMIC ROUTING, SHORTEST PATH ROUTING

Page 2: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

The most complex layers in the protocol stack, overview of network layer

and its services it can provide.

Examine two broad approaches towards structuring network-layer packet

delivery, the datagram and the virtual-circuit model.

Forwarding and routing – forwarding involves the transfer of a packet from

an incoming link to an outgoing link within a single router. Routing involves

all of a network’s routers, whose collective interactions via routing

protocols determine the paths that packets take on their trip from source

to destination node.

Page 3: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

NETWORK LAYER

THE MOST COMPLEX LAYER

Requires the coordinated actions of multiple geographically distributed network

elements (switches & routers)

Must be able to deal with very large scales

Billions of users (people & communicating devices)

Biggest Challenges

Addressing: where should information be directed to?.

Routing: what path should be used to get information there?.

Page 4: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

FORWARDING AND ROUTING

To move packets from a sending host to a receiving host. To do so, 2

important network-layer functions can be identified:

Forwarding - When a packet arrives at router’s input link, the router must move

the packet to the appropriate output link. Refers to the router-local action of

transferring a packet from an input link interface to the appropriate output link

interface.

Routing – the network layer must determine the route or path taken by packets

as they flow from a sender to receiver. The algorithms that calculate these paths

are referred to as routing algorithms.

Page 5: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Key Role of Routing

How to get packet from here to there?

Decentralized nature of Internet makes routing a major challenge

Interior gateway protocols (IGPs) are used to determine routes within a domain

Exterior gateway protocols (EGPs) are used to determine routes across domains

Routes must be consistent & produce stable flows

Scalability required to accommodate growth

Hierarchical structure of IP addresses essential to keeping size of routing tables manageable

Page 6: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Routing Protocol

IGPs determine routes within a domain

EGPs determine routes between domain

Page 7: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

FORWARDING TABLE

Every router forwards a packet by examining the value of a field in the

arriving packet’s header, and then using this header value to index into

the router’s forwarding table.

The value stored in the forwarding table entry for that header indicates the

router’s outgoing link interface to which that packet is to be forwarded.

The header value could be the destination address of the packet or an

indication of the connection to which the packet belongs.

Page 8: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

NETWORK LAYER: SERVICES

Guaranteed Delivery - This service guarantees that the packet will eventually arrive at its destination

Guaranteed delivery with bounded delay – This service not only guarantees delivery of the packet, but delivery within a specified host-to-host delay bound.

In order packet delivery – guarantees that packets arrive at the destination in the order that they were sent

Guaranteed minimal bandwidth – emulates the behavior of a transmission link of a specified bit rate

Guaranteed maximum jitter – guarantees that the amount of time between the transmission of two successive packets at the sender is equal to the amount of time between their receipt at the destination.

Security services – encrypt the payloads of all datagrams being sent to the destination host.

Page 9: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

VIRTUAL CIRCUIT AND DATAGRAM

NETWORKS

Network layer provides either a host-to-host connectionless service or a

host-to-host connection service but not both.

Connection service at the network layer called virtual-circuit (VC)

networks.

Connectionless service at the network layer called datagram networks.

Page 10: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

VIRTUAL CIRCUITS

A VC consists of (1) a path between the source and destination, (2) VC numbers, one

number for each link along the path and (3) entries in the forwarding table in each

router along the path.

A packet belonging to a virtual circuit will carry a VC number in its header. Because a

virtual circuit may have a different VC number on each link, each intervening router

must replace the VC number of each traversing packet with a new VC number. The

new VC number is obtained from the forwarding table.

Page 11: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

VIRTUAL CIRCUIT NETWORKS

Page 12: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

VIRTUAL CIRCUIT NETWORK

WHY A PACKET DOES NOT KEEP THE SAME VC NUMBER ON EACH OF THE

LINKS ALONG ITS ROUTE?.

Replacing the number from link to link reduces the length of the VC field in the packet header.

VC setup is considerably simplified by permitting a different numbers at each link along the path of the VC.

Routers must maintain connection state information.

Each time a new connection is established across a router, a new connection

entry must be added to the router’s forwarding table.

Each time a connection is released, an entry must be removed from the table.

Page 13: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

VIRTUAL CIRCUIT NETWORK

3 PHASES IN VIRTUAL CIRCUIT.

VC SETUP - network layer determine the path between sender and receiver that is the series of links and routers through which all packets of the VC will travel. Also determines the VC number for each link along the path. adds an entry in the forwarding table in each router along the path. May along reserve resources i.e. bandwidth.

Data Transfer – once the VC has been established, packets can begin to flow along the VC.

VC teardown – when senders or receivers informs the network layer of its desire to terminate the vc. Inform to call terminations and update the forwarding tables in each of the packet routers on the path to indicate that the VC no longer exists.

Page 14: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

VIRTUAL CIRCUIT SETUP

Page 15: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

DATAGRAM NETWORKS

Each time an end systems wants to send a packet, it stamps the packet with the address of the destination end system and then pops the packet into the network.

Each packet is transmitted from source to destination, it passes through a series of routers.

Each of these routers uses the packet’s destination address to forward the packet.

Each outer has a forwarding table that maps destination addresses to link interfaces, when a packet arrives at the router, the router uses the packet’s destination address to look up the appropriate output link interface in the forwarding table.

Page 16: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

DATAGRAM NETWORK

Page 17: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Each packet is treated as a separate entity and contains a header with

the full information about the intended recipient.

The intermediate nodes examine the header of a packet and select an

appropriate link to an intermediate node which is nearer the destination.

The packets do not follow pre-established route, and the routers do not

require prior knowledge of the routes that will be used.

The forwarding tables are modified by the routing algorithms., which

typically update a forwarding table every one-to-five minutes or so.

Thus, a series of packet sent from one end system to another system may

follow different paths through the network and may arrive out of order

Page 18: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

1

2

3

4

5

6

Node

(switch or router)

Routing in Packet Networks

Major components of the network layer and is concerned with the problem of determining feasible paths (or routes) for packets to follow each source to each destination

Three possible (loop free) routes from 1 to 6:

1-3-6, 1-4-5-6, 1-2-5-6

Which is “best”?

Min delay? Min hop? Max bandwidth? Min cost? Max reliability?

Kuala Lumpur

Kangar

Page 19: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

GOOD ROUTING ALGORITHM

Rapid and accurate delivery of packets - must operate correctly, must be

able to find a path to the correct destination if it exists. Should not take an

unreasonably long time to find the path to the destination.

Adaptability to changes in network topology resulting from node or link failures – must be able to adapt and reconfigure the paths automatically

when equipment fails

Adaptability to varying source-destination traffic loads – traffic loads are quantities that are changing dynamically, would be able to adjust the

paths based on the current traffic loads.

Page 20: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

GOOD ROUTING ALGORITHM

Ability to route packets away from temporarily congested links – should avoid heavily congested links. Desirable to balance the load on each link/path.

Ability to determine the connectivity of the network - to find optimal paths, the routing system needs to know the connectivity or reliability information.

Ability to avoid routing loops – should avoid persistent routing loops even in the presence of distributed routing system

Low overhead – obtains the connectivity information by exchanging control messages with other routing system. Represent an overhead on bandwidth usage that should be minimized.

Page 21: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

ROUTING ALOGRITHM CLASSIFICATION:

Static vs Dynamic Routing

Static Routing

Precomputed based on the network topology, link capabilities and other information.

Performed offline by a dedicated host.

When the computation is completed, the paths are loaded to the routing table and remain fixed for a relatively long period of time.

Suffice if the network is small, the traffic load dos not change appreciably, or the network topology is relatively fixed.

Disadvantages: inability to react rapidly to network failures.

Dynamic Routing

Each node continuously learns the

state of the network by communicating

with its neighbors.

Automated

Change in a network topology is

eventually propagated to all nodes.

Each node can compute the best

paths to desired destination.

Calculates routes based on received

updated network state information.

Page 22: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

CENTRALICED VS. DISTRIBUTED

CENTRALIZED ROUTING

Computes all paths and then upload this information to the nodes in the network.

DISTRIBUTED ROUTING

By means of message exchanges and perform their own routing computations.

Scale better than centralized algorithms but are more likely to produce inconsistent results. – loops can develop.

If A thinks that the best path to Z is through B and B thinks that the best path to Z is through A, then packets destined for Z that have the misfortune of arriving at A or B then it will stuck in a loop between A and B.

Page 23: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

ROUTING TABLES

Once the routing algorithm has determined the set of paths, the path

information is stored in the routing table so that each node knows how to

forward packets.

With VC, the routing table translates each incoming VCI to an outgoing

and VCI and identifies the output port to which to forward a packet based

on the incoming VCI of the packet.

With datagram packet, the routing table identifies the next hop to which

to forward a packet based on the destination address of the packet.

Page 24: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its
Page 25: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its
Page 26: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

SPECIALIZED ROUTING

FLOODING

Calls for a packet switch to forward an incoming packet to all ports except the one packets was received from.

Effective routing approach when the information in the routing tables is not available, such as during system startup, or when survivability is required.

Needs to be controlled so that packets are not generated excessively.

Mechanism to reduce resource consumption

1. Time-to-live (TTL) – when source sends a packet TTL is initially set to some numbers. Each node decrements the TTL by one before flooding the packet.

Each nodes adds its identifier to the header of the packet before it floods the packet.- discards the packet if it already contains the identifier of the node.

Same with 2nd method. By discard old packets. Each packet from a given source is identified with a unique sequence number. When a node receives a packet, the node records the source address and the sequence number of the packets.

Page 27: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

1

2

3

4

5

6

Flooding is initiated from Node 1: Hop 1 transmissions

Page 28: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

1

2

3

4

5

6

Flooding is initiated from Node 1: Hop 2 transmissions

Page 29: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

1

2

3

4

5

6

Flooding is initiated from Node 1: Hop 3 transmissions

Page 30: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

DEFLECTING ROUTING

Requires the network to provide multiple paths for each source-destination

pair.

Each node first tries to forward a packet to the preferred port. If the

preferred port is busy or congested, the packet is deflected to another

port.

Disadvantages: node can be bufferless, since packets do not have to wait

for a specific port to become available. Takes its own alternative paths,

deflection routing cannot guarantee in-sequence delivery of packets.

Page 31: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its
Page 32: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

SHORTEST PATH ROUTING

Page 33: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Shortest Paths & Routing

Many possible paths connect any given source and to any given

destination

Routing involves the selection of the path to be used to accomplish a

given transfer

Typically it is possible to attach a cost or distance to a link connecting

two nodes

Routing can then be posed as a shortest path problem Many routing

algorithms are based on variants of shortest path algorithms, which try to

find shortest path based on some cost criterion

Page 34: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Routing Metrics/Costs

Means for measuring desirability of a path

Path Length = sum of costs or distances

Possible metrics/costs

Hop count: rough measure of resources used

Reliability: link availability; BER

Delay: sum of delays along path; complex & dynamic

Bandwidth: “available capacity” in a path

Load: Link & router utilization along path

Cost: $$$Kangar

Jitra

Kuala Perlis

Alor Setar

Page 35: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Shortest Path Approaches

Distance Vector Protocols

Neighbors exchange list of distances to destinations

Best next-hop determined for each destination

Bellman-Ford algorithm /Ford-Fulkerson (distributed) shortest path algorithm

Link State Protocols

Link state information flooded to all routers

Routers have complete topology information

Shortest path (& hence next hop) calculated

Dijkstra (centralized) shortest path algorithm

Page 36: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

KL 392

KL 596

Distance Vector ProtocolDo you know the way to Kuala Lumpur?

Page 37: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Bellman-Ford Algorithm

Now consider parallel computations for all destinations d

Initialization

Each node has 1 row for each destination d

Distance of node d to itself is zero: Dd(d)=0

Distance of other node j to d is infinite: Dj(d)= , for j d

Next node nj = -1 since not yet defined

Send Step

Send new distance vector to immediate neighbors across local link

Receive Step

For each destination d, find the next hop that gives the minimum distance to d,

Minj { Cij+ Dj(d) } Replace old (nj, Di(d)) by new (nj*, Dj*(d)) if new next node or distance found

Go to send step

Iteration Node j

Initial (-1, )

Page 38: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

HOW TO REACH TO NODE 6

(DESTINATION) TO NODE 2.

Assume someone tell us that

shortest distance to node 6 is from

node 1, 4 or 5.

Page 39: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Iteration Node 1 Node 2 Node 3 Node 4 Node 5

Initial (-1, ) (-1, ) (-1, ) (-1, ) (-1, )

1

2

3

31

5

46

2

2

3

4

2

1

1

2

3

5

KL

Table entry @ node

1 for dest KL

Table entry @ node

3 for dest KL

Bellman-Ford -Find the set of shortest paths from all nodes to

destination node 6.

InitializationEach node has 1 row for each destination dDistance of node d to itself is zero: Dd(d)=0Distance of other node j to d is infinite: Dj(d)= , for j dNext node nj = -1 since not yet defined

0

Page 40: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Iteration Node 1 Node 2 Node 3 Node 4 Node 5

Initial (-1, ) (-1, ) (-1, ) (-1, ) (-1, )

1 (-1, ) (-1, ) (6,1) (-1, ) (6,2)

2

3

KL

D6=0

D3=D6+1

n3=6

31

5

4

6

2

2

3

4

2

1

1

2

3

5

D6=0D5=D6+2

n5=6

0

2

1

Immediate neighbors for node 6

: node 3 and node 5

Page 41: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Iteration Node 1 Node 2 Node 3 Node 4 Node 5

Initial (-1, ) (-1, ) (-1, ) (-1, ) (-1, )

1 (-1, ) (-1, ) (6, 1) (-1, ) (6,2)

2 (3,3) (5,6) (6, 1) (3,3) (6,2)

3

KL

31

5

46

2

2

3

4

2

1

1

2

3

50

1

2

3

3

6

Immediate neighbors for

node 3 : node 1 and node 4 & node 5 : node 2 and node 4

Page 42: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Iteration Node 1 Node 2 Node 3 Node 4 Node 5

Initial (-1, ) (-1, ) (-1, ) (-1, ) (-1, )

1 (-1, ) (-1, ) (6, 1) (-1, ) (6,2)

2 (3,3) (5,6) (6, 1) (3,3) (6,2)

3 (3,3) (4,4) (6, 1) (3,3) (6,2)

KL

31

5

46

2

2

3

4

2

1

1

2

3

50

1

26

3

3

4

Immediate neighbors for

node 2 : node 1 , node 4, node 5

Page 43: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

6

4

5

2

3

1

3

10

72

1

3

2

5

2

EXERCISE: Use the Bellman-Ford algorithm to

find the set of shortest paths from all nodes

to destination node 6.

Page 44: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

B

A

C

S

D

E

3

104

2 2

6

5

2

EXERCISE: Use the Bellman-Ford algorithm to

find the set of shortest paths from all nodes

to destination node S

Page 45: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Link-State Algorithm

Basic idea: two step procedure

Each source node gets a map of all nodes and link metrics (link state) of the entire network

Find the shortest path on the map from the source node to all destination nodes

Broadcast of link-state information

Every node i in the network broadcasts to every other node in the network:

ID’s of its neighbors: Ni=set of neighbors of i

Distances to its neighbors: {Cij | j Ni}

Flooding is a popular method of broadcasting packets

Page 46: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

DIJKSTRA ALGORITM

Shortest paths from a source node to all other nodes in a network

More efficient than the Bellman-form but requires each link cost to be positive.

Principles:

To progressively identify the closest nodes from the source node in order of increasing path cost.

Rules:

N = {S} DS = 0 ‘s is distance zero from itself’

Find the closest node by comparing the costs

Add the lowest cost to the N.

Page 47: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Dijkstra’s algorithm

N: set of nodes for which shortest path already found

Initialization: (Start with source node s)

N = {s}, Ds = 0, “s is distance zero from itself”

Dj=Csj for all j s, distances of directly-connected neighbors

Step A: (Find next closest node i)

Find i N such that

Di = min Dj for j N

Add i to N

If N contains all the nodes, stop

Step B: (update minimum costs)

For each node j N

Dj = min (Dj, Di+Cij)

Go to Step A

Minimum distance from s to

j through node i in N

Page 48: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Execution of Dijkstra’s algorithm Use the Dijkstra algorithm to find the set of shortest paths from node 4

to other nodes

31

5

46

2

2

3

4

2

1

1

2

3

5

Iteration N D1 D2 D3 D5 D6

Initial

1

2

3

4

5

{4} 5 1 2 3 ∞

{2,4} 14 32 ∞{2,3,4} 4 1 2 33

{2,3,4,5} 1 2 3 34

{2,3,4,5,6} 1 2 3 34

{1,2,3,4,5,6} 1 2 3 34

Page 49: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Exercise

31

5

46

2

2

3

4

2

1

1

2

3

5

Shortest Path and the routing table entries.

Page 50: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Link-State Routing

Page 51: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

Link State vs Distance Vector

Distance Vector Routing(Bellman-Ford Algorithm)

Neighboring routers exchange routing tables that state the set of known distance to other destinations.

Using Bellman-Ford algorithm, router determine best path

If better path is obtained, router send it to others

Link State Routing (Dijkstra Algorithm)

Each router flood information about the state of the links that connect it to its neighbors.

Allows each router to construct a map of the entire network and derive routing table using Dijkstra algorithm

If the link state change, the router that detect the change flood the information to the others.

Link-State routing converge faster than Distance Vector Routing

Page 52: PACKET SWITCHING NETWORKSportal.unimap.edu.my/portal/page/portal30/Lecture Notes/KEJURUTERAAN... · The most complex layers in the protocol stack, overview of network layer and its

ASSIGNMENT 3/Homework 2: Due Date 9th December 2016

2. Use the Dijkstra algorithm to find the set of shortest

paths from node 4 to other nodes

1. Use the Bellman-Form algorithm to find the set of

shortest paths to destination 2.