83
1 School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks CMPT 765/408: Computer Networks Networking Basics I Networking Basics I Instructor: Dr. Mohamed Hefeeda Instructor: Dr. Mohamed Hefeeda

School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

Embed Size (px)

DESCRIPTION

School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks Networking Basics I Instructor: Dr. Mohamed Hefeeda. Course Objectives. Understand principles of designing and operating computer networks structure and protocols of the Internet - PowerPoint PPT Presentation

Citation preview

Page 1: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

1

School of Computing Science

Simon Fraser University

CMPT 765/408: Computer NetworksCMPT 765/408: Computer Networks

Networking Basics INetworking Basics I

Instructor: Dr. Mohamed HefeedaInstructor: Dr. Mohamed Hefeeda

Page 2: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

2

Course Objectives

Understand principles of designing and operating computer

networks structure and protocols of the Internet services that can/cannot be offered by the Internet

Know how to analytically analyze performance of a

system/protocol implement network protocols and applications

And, more importantly, … Have fun!

Page 3: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

3

Course Info

Most of the course will be lectures given by the instructor

Last 2-3 weeks, each student presents a paper on one of the current hot topics

Course web page

http://nsl.cs.surrey.sfu.ca/teaching/06/765/

Or access it from my web page:

http://www.cs.sfu.ca/~mhefeeda

Page 4: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

4

Course Info: Textbooks and References

All are on reserve in SFU Surrey Library Kurose and Rose, Computer Networking:  A top-

down Approach Featuring the Internet, 2005 Background materials Chapters 6 and 7: Wireless and Multimedia Networking

Hassan and Jain, High Performance TCP/IP Networking, 2004 

Several chapters on analyzing TCP/IP in different environments

Stallings, High-speed Networks and Internets: Performance and Quality of Service, 2002

Three chapters on (basics of) probability and queuing

Papers: will be posted on the course web page

Page 5: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

5

Course Info: Grading

Homework: 20% 3 – 4 problem sets

Projects: 35% 4 projects; group of two students

Class participation: 10% Ask and answer questions Present one chapter/paper

Final exam: 35% Comprehensive

Page 6: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

6

Course Info: Topics

Internet Architecture and Services TCP/IP Protocol Suit Inter- and Intra-domain Routing Protocols Introduction to Performance Modeling and Evaluation Introduction to Simulation and Measurement of Networked

Systems TCP/IP Performance Modeling in Different Environments Quality of Service Support in the Internet Wireless Networks Multimedia Networking Overlays and Peer-to-Peer Computing Hot Topics

Mesh networks, sensor networks, P2P, denial of service attacks, security in wireless networks, …, you choose/propose

Page 7: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

7

Basic Networking Concepts

Page 8: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

8

Review of Basic Networking Concepts

Internet structure Protocol layering and encapsulation Internet services and socket programming Network Layer

Network types: Circuit switching, Packet switching Addressing, Forwarding, Routing

Transport layer Reliability and congestion control TCP, UDP

Link Layer Multiple Access Protocols Ethernet

Page 9: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

9

The Internet

Millions of hosts (end systems) Inter-connected, running

network apps

Diverse communication links fiber, copper, radio, satellite

Routers forward packets

Internet: “network of networks”

loosely hierarchical Public, versus private intranet

local ISP

companynetwork

regional ISP

router workstation

servermobile

Page 10: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

10

Internet structure: network of networks

roughly hierarchical at center: “tier-1” ISPs (e.g., MCI, Sprint, AT&T, Cable and

Wireless), national/international coverage treat each other as equals

Tier 1 ISP

Tier 1 ISP

Tier 1 ISP

Tier-1 providers interconnect (peer) privately

NAP

Tier-1 providers also interconnect at public network access points (NAPs)

Page 11: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

11

Tier-1 ISP: e.g., Sprint

Sprint US backbone network

Seattle

Atlanta

Chicago

Roachdale

Stockton

San Jose

Anaheim

Fort Worth

Orlando

Kansas City

CheyenneNew York

PennsaukenRelay

Wash. DC

Tacoma

DS3 (45 Mbps)OC3 (155 Mbps)OC12 (622 Mbps)OC48 (2.4 Gbps)

to/from customers

peering

to/from backbone

….

………POP: point-of-presence

Page 12: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

12

Internet structure: Tier-2 ISPs

“Tier-2” ISPs: smaller (often regional) ISPs Connect to one or more tier-1 ISPs, possibly other tier-2 ISPs

Tier 1 ISP

Tier 1 ISP

Tier 1 ISP

NAP

Tier-2 ISPTier-2 ISP

Tier-2 ISP Tier-2 ISP

Tier-2 ISP

Tier-2 ISP pays tier-1 ISP for connectivity to rest of Internet

Tier-2 ISP is customer oftier-1 provider

Tier-2 ISPs also peer privately with each other, interconnect at NAP

Page 13: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

13

Internet structure: Tier-3 ISPs

“Tier-3” ISPs and local ISPs last hop (“access”) network (closest to end systems)

Tier 1 ISP

Tier 1 ISP

Tier 1 ISP

NAP

Tier-2 ISPTier-2 ISP

Tier-2 ISP Tier-2 ISP

Tier-2 ISP

localISPlocal

ISPlocalISP

localISP

localISP Tier 3

ISP

localISP

localISP

localISP

Local and tier- 3 ISPs are customers ofhigher tier ISPsconnecting them to rest of Internet

Page 14: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

14

Internet structure: packet journey

a packet passes through many networks!

Tier 1 ISP

Tier 1 ISP

Tier 1 ISP

NAP

Tier-2 ISPTier-2 ISP

Tier-2 ISP Tier-2 ISP

Tier-2 ISP

localISPlocal

ISPlocalISP

localISP

localISP Tier 3

ISP

localISP

localISP

localISP

Page 15: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

15

Review of Basic Networking Concepts

Internet structure Protocol layering and encapsulation Internet services and socket programming Network Layer

Network types: Circuit switching, Packet switching Addressing, Forwarding, Routing

Transport layer Reliability and congestion control TCP, UDP

Link Layer Multiple Access Protocols Ethernet

Page 16: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

16

Protocol Layers

Networks are complex! many “pieces”:

hosts routers links of various

media applications protocols hardware, software

Question: Is there any hope of organizing structure of

network?

Or at least our discussion of networks?

Page 17: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

17

ticket (purchase)

baggage (check)

gates (load)

runway (takeoff)

airplane routing

departureairport

arrivalairport

intermediate air-trafficcontrol centers

airplane routing airplane routing

ticket (complain)

baggage (claim

gates (unload)

runway (land)

airplane routing

ticket

baggage

gate

takeoff/landing

airplane routing

Layering of Airline Functionality

Layers: each layer implements a service via its own internal-layer actions relying on services provided by layer below

Page 18: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

18

Why layering?

Dealing with complex systems: explicit structure allows identification,

relationship of complex system’s pieces modularization eases maintenance, updating

of systemchange of implementation of layer’s service

transparent to rest of systeme.g., change in gate procedure doesn’t

affect rest of system What is the downside of layering?

Page 19: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

19

Internet protocol stack

application: supporting network applications

FTP, SMTP, HTTP

transport: host-host data transfer TCP, UDP

network: routing of datagrams from source to destination

IP, routing protocols

link: data transfer between neighboring network elements

PPP, Ethernet

physical: bits “on the wire”

application

transport

network

link

physical

Page 20: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

20

datagram

frame HtHnHl M

HtHn M

segment Ht M

message M

HtHnHl M

HtHn M

Ht M

M

application

transportnetwork

linkphysical

application

transportnetwork

linkphysical

linkphysical

networklink

physical

HtHnHl M

HtHn M

HtHnHl M

HtHn M

HtHnHl M HtHnHl M

source

destination

router

switch

Encapsulation

Page 21: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

21

Review of Basic Networking Concepts

Internet structure Protocol layering and encapsulation Internet services and socket programming Network Layer

Network types: Circuit switching, Packet switching Addressing, Forwarding, Routing

Transport layer Reliability and congestion control TCP, UDP

Link Layer Multiple Access Protocols Ethernet

Page 22: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

22

Internet Services

View the Internet as a communication infrastructure that provides services to apps

Web, email, games, e-commerce, file sharing, …

Two communication services Connectionless unreliable Connection-oriented reliable

Page 23: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

23

Internet Services

Connection-oriented Prepare for data

transfer ahead of time

establish connection set up state in the two communicating hosts

Usually comes with reliability, flow and congestion control

TCP: Transmission Control Protocol

Connectionless No connection set up,

simply send

Faster, less overhead

No reliability, flow control, or congestion control

UDP: User Datagram Protocol

How can we access these services?

Page 24: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

24

Network (Socket) Programming

Process sends/receives messages to/from its socket

Socket analogous to door sending process shoves

message out door sending process relies

on transport infrastructure on other side of door which brings message to socket at receiving process

process

TCP withbuffers,variables

socket

host orserver

process

TCP withbuffers,variables

socket

host orserver

Internet

controlledby OS

controlled byapp developer

Socket is the interface (API) between application and transport layer

Page 25: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

25

Review of Basic Networking Concepts

Internet structure Protocol layering and encapsulation Internet services and socket programming Network Layer

Network types: Circuit switching, Packet switching Addressing, Forwarding, Routing

Transport layer Reliability and congestion control TCP, UDP

Link Layer Multiple Access Protocols Ethernet

Page 26: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

26

The Network Core

Mesh of interconnected routers

The fundamental question: how is data transferred through net?

circuit switching: dedicated circuit per call: telephone net

packet-switching: data sent thru net in discrete “chunks”

Page 27: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

27

Network Core: Circuit Switching

Network resources (e.g., bandwidth) divided into “pieces” using

Frequency division multiplexing (FDM) Time division multiplexing (TDM)

Pieces allocated to “calls” (connections) guaranteed performance

Resource piece idle if not used by owning call no sharing

Connection setup is required Examples

(Traditional) Telephone network

Page 28: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

28

Circuit Switching: Dedicated Circuits

Page 29: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

29

Network Core: Packet Switching

each end-end data stream divided into packets

packets from different users share network resources

each packet uses full link bandwidth

resources used as needed store and forward: packets

move one hop at a time Node receives complete

packet before forwarding

resource contention: aggregate resource

demand can exceed amount available

congestion: packets queue, wait for link use

Bandwidth division into “pieces”

Dedicated allocation

Resource reservation

Page 30: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

30

Packet Switching: Statistical Multiplexing

Sequence of A & B packets does not have fixed pattern, shared on demand statistical multiplexing

In contrast, in TDM each host gets same slot in revolving TDM frame

A

B

C10 Mb/sEthernet

1.5 Mb/s

D E

statistical multiplexing

queue of packetswaiting for output

link

Page 31: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

31

Packet Switching: Efficiency

1 Mb/s link each user:

100 kb/s when “active” active 10% of time

circuit-switching: 10 users

packet switching: with 35 users,

probability > 10 active less than 0 .0004

Packet switching allows more users to use network!

N users

1 Mbps link

Q: how did we get value 0.0004?

Page 32: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

32

Packet Switching

Advantages no call setup simpler resource sharing (statistical multiplexing)

• better resource utilization • more users or faster transfer (a single user can use

entire bw)• Well suited for bursty traffic (typical in data

networks)

Disadvantages Congestion may occur

• packet delay and loss• need protocols to control congestion and ensure

reliable data transfer

Page 33: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

33

Packet Switching: Two Classes

Datagram network Example: The Internet

Virtual-circuit network Examples: ATM (Asynchronous Transfer Mode), frame

relay, X.25

Page 34: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

34

Packet-switched Datagram Networks

no call setup at network layer routers: no state about end-to-end connections

no network-level concept of “connection” packets forwarded using destination host address

packets between same source-dest pair may take different paths

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

1. Send data 2. Receive data

Page 35: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

35

Packet-switched VC Networks

Source-to-dest path behaves much like telephone circuit” performance-wise

connection setup, teardown for each call before data can flow

each packet carries VC identifier (not destination address) every router on source-dest path maintains state for each

passing connection link, router resources (bandwidth, buffers) may be

allocated to VC Examples:

ATM (Asynchronous Transfer Mode), frame relay, X.25

Page 36: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

36

VC Networks: Connection Setup

Signaling protocols are used to setup, maintain, and teardown VCs

Note: not widely used in the current Internet

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

1. Initiate call 2. incoming call

3. Accept call4. Call connected5. Data flow begins 6. Receive data

Page 37: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

37

Network Taxonomy

Telecommunicationnetworks

Circuit-switchednetworks

FDM TDM

Packet-switchednetworks

Networkswith VCs

DatagramNetworks

Page 38: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

38

Review of Basic Networking Concepts

Internet structure Protocol layering and encapsulation Internet services and socket programming Network Layer

Network types: Circuit switching, Packet switching Addressing, Forwarding, Routing

Transport layer Reliability and congestion control TCP, UDP

Link Layer Multiple Access Protocols Ethernet

Page 39: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

39

Network Layer

Network layer protocols in every host and router

Network layer’s goal transport data from

sending host to receiving host

We focus on datagram networks (Internet)

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

application

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

Page 40: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

40

Network Layer in the Internet

forwardingtable

Host, router network layer functions:

Routing protocols•path selection•RIP, OSPF, BGP

IP protocol•addressing conventions•datagram format•packet handling conventions

ICMP protocol•error reporting•router “signaling”

Transport layer: TCP, UDP

Link layer

physical layer

Networklayer

Page 41: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

41

1

23

0111

value in arrivingpacket’s header

routing algorithm

local forwarding tableheader value output link

0100010101111001

3221

Routing vs. Forwarding

Routing

determine route taken by packets from source to destination

Routing algorithms, e.g., RIP, OSPF, BGP

Forwarding move packets from

router’s input to appropriate output

use forwarding table populated by routing algorithm

E.g., IP forwarding function

Page 42: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

42

IP Datagram Format

ver length

32 bits

data (variable length,typically a TCP

or UDP segment)

16-bit identifier

Internet checksum

time tolive

32 bit source IP address

IP protocol versionnumber

header length (bytes)

max numberremaining hops

(decremented at each router)

forfragmentation/reassembly

total datagramlength (bytes)

upper layer protocolto deliver payload to

head.len

type ofservice

Provides some QoS flgsfragment

offsetupper layer

32 bit destination IP address

Options (if any) E.g. timestamp,record routetaken, specifylist of routers to visit.

IP ver 4.0

Page 43: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

43

IP Addressing: Introduction

IP address: 32-bit identifier for each host, router network

interface Represented in Dotted-decimal notation

11011111 00000001 00000001 00000001

223 1 11

223.1.1.1

Page 44: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

44

IP Addressing

223.1.1.1

223.1.1.2

223.1.1.3

223.1.1.4 223.1.2.9

223.1.2.2

223.1.2.1

223.1.3.2223.1.3.1

223.1.3.27

Network interface: connection between host/router and physical link routers typically have multiple interfaces host typically has one interface Unique IP addresses associated with each interface

How do we assign IPs?

Divide network into subnets,each has a common ID

Page 45: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

45

Subnets223.1.1.0/24

223.1.2.0/24

223.1.3.0/24

Subnet is: a group of devices that can

reach each other without intervening router

identified by high order bits of IP addresses

11011111 00000001 00000001 00000001

223.1.1.0/24

Subnet ID Host ID

/24: # bits in subnet portion of address, subnet mask

Page 46: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

46

Subnets

How many subnets?

6 subnets

Recipe: detach each interface

from its host or router, creating isolated networks

Each isolated network is a subnet

223.1.1.1

223.1.1.3

223.1.1.4

223.1.2.2223.1.2.1

223.1.2.6

223.1.3.2223.1.3.1

223.1.3.27

223.1.1.2

223.1.7.0

223.1.7.1223.1.8.0223.1.8.1

223.1.9.1

223.1.9.2

Page 47: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

47

IP Addressing: CIDR

CIDR: Classless InterDomain Routing subnet portion of address of arbitrary length address format: a.b.c.d/x, where x is # bits in subnet portion of

address

Old Classful Addressing: Subnet length had to be /8 (class A), /16 (class B), /24 (class C)

Why CIDR? Finer control over address allocation reduce waste of

addresses Ex: company with 2000 machines would have to get class B,

wasting 63,000+ addresses

11001000 00010111 00010000 00000000

subnetpart

hostpart

200.23.16.0/23

Page 48: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

48

IP Addresses: How to Get One?

Q: How does host get IP address?

hard-coded by system admin in a file WIN: control-panel->network->configuration->tcp/ip-

>properties UNIX: /etc/rc.config

DHCP: Dynamic Host Configuration Protocol: dynamically get address from as server

“plug-and-play”

Page 49: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

49

IP Addresses: How to Get One?

Q: How does network get subnet part of IP addr?

A: gets allocated portion of its provider ISP’s address space

ISP's block 11001000 00010111 00010000 00000000 200.23.16.0/20

Organization 0 11001000 00010111 00010000 00000000 200.23.16.0/23 Organization 1 11001000 00010111 00010010 00000000 200.23.18.0/23 Organization 2 11001000 00010111 00010100 00000000 200.23.20.0/23 ... ….. …. ….

Organization 7 11001000 00010111 00011110 00000000 200.23.30.0/23

ISPs get their address space from ICANN

ICANN: Internet Corporation for Assigned Names and Numbers allocates addresses, manages DNS and assigns domain names

Page 50: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

50

Hierarchical Addressing: Route Aggregation

“Send me anythingwith addresses beginning 200.23.16.0/20”

200.23.16.0/23

200.23.18.0/23

200.23.30.0/23

Fly-By-Night-ISP

Organization 0

Organization 7Internet

Organization 1

ISPs-R-Us“Send me anythingwith addresses beginning 199.31.0.0/16”

200.23.20.0/23Organization 2

...

...

Hierarchical addressing allows efficient advertisement of routing information:

Page 51: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

51

Review of Basic Networking Concepts

Internet structure Protocol layering and encapsulation Internet services and socket programming Network Layer

Network types: Circuit switching, Packet switching Addressing, Forwarding, Routing

Transport layer Reliability and congestion control TCP, UDP

Link Layer Multiple Access Protocols Ethernet

Page 52: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

52

Graph Abstraction

u

yx

wv

z

2

2

13

1

1

2

53

5

Routing algorithm: find the least-cost path

Graph: G = (N,E) N = set of routers = {u, v, w, x, y,

z } E = set of links ={(u,v), (u,x), (v,x),

(v,w), (x,w), (x,y), (w,y), (w,z), (y,z)} cost of link (x1, x2):

Metric value, e.g., c(w,z) = 5 could be 1 (typical), or inversely related to bandwidth, or inversely related to congestion

Page 53: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

53

Classification of Routing Algorithms

Global or local information?

Global: all routers have complete topology, link cost info “link state” algorithms

Local: each router knows physically-connected neighbors, link

costs to neighbors “distance vector” algorithms

Page 54: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

54

A Link-State Routing Algorithm

Dijkstra’s algorithm

net topology, link costs known to all nodes accomplished via “link state broadcast” all nodes have same info

computes least cost paths from one node (source) to all other nodes

gives forwarding table for that node

Page 55: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

55

A Link-State Routing Algorithm

Notation: c(x,y): link cost from node x to y;

c(x,y) = ∞ if not direct neighbors

D(v): current value of cost of path from source to dest. v

p(v): predecessor node along path from source to v

N': set of nodes whose least cost path definitively known

Page 56: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

56

Dijsktra’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'

Page 57: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

57

Dijkstra’s algorithm: example

Step012345

N'u

uxuxy

uxyvuxyvw

uxyvwz

D(v),p(v)2,u2,u2,u

D(w),p(w)5,u4,x3,y3,y

D(x),p(x)1,u

D(y),p(y)∞

2,x

D(z),p(z)∞ ∞

4,y4,y4,y

u

yx

wv

z2

2

13

1

1

2

53

5

Page 58: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

58

Dijkstra’s algorithm: example (2)

u

yx

wv

z

Resulting shortest-path tree from u:

vx

y

w

z

(u,v)(u,x)

(u,x)

(u,x)

(u,x)

destination link

Resulting forwarding table in u:

Page 59: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

59

Distance Vector Algorithm

Bellman-Ford Equation (dynamic programming)

Define

dx(y) := cost of least-cost path from x to y

Then

dx(y) = min {c(x,v) + dv(y) }

where min is taken over all neighbors v of x

v

Page 60: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

60

Bellman-Ford example

u

yx

wv

z2

2

13

1

1

2

53

5

u has 3 neighbors: v, x, w and

dv(z) = 5, dx(z) = 3, dw(z) = 3

B-F equation says:du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) } = min {2 + 5, 1 + 3, 5 + 3} = 4How would you use BF equation

to construct shortest paths?

Determine du(z)

Page 61: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

61

Distance Vector Algorithm: Idea

Basic idea: Each node periodically sends its own distance vector

estimate to neighbors When a node x receives new DV estimate from

neighbor, it updates its own DV using B-F equation:

Dx(y) ← minv{c(x,v) + Dv(y)} for each node y ∊ N

Under minor, natural conditions, the estimate Dx(y) converge to the actual least cost dx(y)

Page 62: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

62

Distance Vector Algorithm: Notes

Dx(y) = estimate of least cost from x to y Distance vector: Dx = [Dx(y): y є N ]

Node x knows cost to each neighbor v: c(x,v)

Node x maintains Dx = [Dx(y): y є N ]

Node x also maintains its neighbors’ distance vectors, that is:

x maintains Dv = [Dv(y): y є N ] for every neighbor v

Page 63: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

63

Distance Vector Algorithm

Iterative Continues until no more info is

exchanged Each iteration caused by:

• local link cost change • DV update message from neighbor

Asynchronous Nodes do not operate in lockstep

Distributed Each node receives info only from

its directly attached neighbors NO Global info

wait for (change in local link cost or msg from neighbor)

recompute estimates

if DV to any dest has changed, notify neighbors

Each node:

Page 64: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

64

x y z

xyz

0 2 7

∞ ∞ ∞∞ ∞ ∞

from

cost to

from

from

x y z

xyz

0 2 3

from

cost tox y z

xyz

0 2 3

from

cost to

x y z

xyz

∞ ∞

∞ ∞ ∞

cost tox y z

xyz

0 2 7

from

cost to

x y z

xyz

0 2 3

from

cost to

x y z

xyz

0 2 3

from

cost tox y z

xyz

0 2 7

from

cost to

x y z

xyz

∞ ∞ ∞7 1 0

cost to

∞2 0 1

∞ ∞ ∞

2 0 17 1 0

2 0 17 1 0

2 0 13 1 0

2 0 13 1 0

2 0 1

3 1 0

2 0 1

3 1 0

time

x z12

7

y

node x table

node y table

node z table

Dx(y) = min{c(x,y) + Dy(y), c(x,z) + Dz(y)} = min{2+0 , 7+1} = 2

Dx(z) = min{c(x,y) + Dy(z), c(x,z) + Dz(z)} = min{2+1 , 7+0} = 3

Example

Page 65: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

65

Distance Vector: link cost changes

Link cost decreased: node detects local link cost change updates routing info, recalculates

distance vector if DV changes, notify neighbors

“goodnews travelsfast”

x z14

50

y1

At time t0, y detects the link-cost change, updates its DV, and informs its neighbors.

At time t1, z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV.

At time t2, y receives z’s update and updates its distance table. y’s least costs do not change and hence y does not send any message to z.

Page 66: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

66

Distance Vector: link cost changes

Link cost increased: t0: y detects change, updates its cost to x to be

6. Why? Because z previously told y that “I can reach x with

cost of 5.” 6 = min {60+0, 1+5}

Now we have a routing loop! Pkts destined to x from y go back and forth

between y and z forever (or until loop is broken)

t1: z gets the update from y. z updates its cost to x to be??

7 = min {50+0, 1+6}

Algorithm will take 44 iterations to stabilize This is called “count to infinity” problem!

Solutions?

x z14

50

y60

“Badnews travelsslow”

Page 67: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

67

Distance Vector: link cost changes

Poisoned reverse:

If z routes through y to get to x:

Then z tells y that its (z’s) distance to x is infinity (so y won’t route to x via z)

Will this completely solve count to infinity problem?

No! Loops involving three or more nodes will not be detected

x z14

50

y60

Page 68: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

68

Comparison of LS and DV algorithms

Message complexity LS: with n nodes, E links,

O(nE) msgs sent DV: exchange between

neighbors only But send entire table

Speed of Convergence LS: O(n2) algorithm requires

O(nE) msgs may have oscillations

DV: convergence time varies may be routing loops count-to-infinity problem

Robustness: what happens if router malfunctions?

LS: node can advertise incorrect link cost

each node computes only its own table some degree of robustness

DV: node can advertise incorrect path cost

each node’s table used by others error propagates thru network

In The Internet:

LS: OSPF (recent, more features)

DV: RIP (old, small nets)

Page 69: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

69

Hierarchical Routing

scale: with 200 million destinations:

can’t store all dest’s in routing tables!

routing table exchange would swamp links!

administrative autonomy internet = network of

networks each network admin may

want to control routing in its own network

Our routing study thus far - idealization all routers identical network “flat” … not true in practice

Page 70: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

70

Hierarchical Routing

aggregate routers into regions, “autonomous systems” (AS)

routers in same AS run same routing protocol “intra-AS” routing protocol routers in different AS can run different intra-AS routing

protocol

Gateway router Direct link to router in another AS

Page 71: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

71

3b

1d

3a

1c2aAS3

AS1

AS21a

2c2b

1b

Intra-ASRouting algorithm

Inter-ASRouting algorithm

Forwardingtable

3c

Interconnected ASes

Forwarding table is configured by both intra- and inter-AS routing algorithm

Intra-AS sets entries for internal dests

Inter-AS & Intra-As sets entries for external dests

Page 72: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

72

3b

1d

3a

1c2aAS3

AS1

AS21a

2c2b

1b

3c

Inter-AS tasks

Suppose router in AS1 receives datagram for which dest is outside of AS1

Router should forward packet towards one of the gateway routers, but which one?

AS1 needs:

1. to learn which dests are reachable through AS2 and which through AS3

2. to propagate this reachability info to all routers in AS1

Job of inter-AS routing!

Page 73: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

73

Learn from inter-AS protocol that subnet x is reachable via multiple gateways

Use routing infofrom intra-AS

protocol to determine

costs of least-cost paths to each

of the gateways

Hot potato routing:Choose the

gatewaythat has the

smallest least cost

Determine fromforwarding table the interface I that leads

to least-cost gateway.

Example: Choosing among multiple ASes

Now suppose AS1 learns from the inter-AS protocol that subnet x is reachable from AS3 and from AS2

To configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x

Hot potato routing: send packet towards closest of two routers

Page 74: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

74

Internet inter-AS routing: BGP

BGP (Border Gateway Protocol): the de facto standard

BGP provides each AS a means to:1. Obtain subnet reachability information from

neighboring ASes2. Propagate the reachability information to all routers

internal to the AS3. Determine “good” routes to subnets based on

reachability information and policy

BGP allows a subnet to advertise its existence to rest of the Internet: “I am here”

Page 75: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

75

BGP basics

Pairs of routers (BGP peers) exchange routing info over semi-permanent TCP connections: BGP sessions

Note: BGP sessions do not correspond to physical links When AS2 advertises a prefix to AS1, AS2 is promising it will

forward any datagrams destined to that prefix towards the prefix

AS2 can aggregate prefixes in its advertisement

3b

1d

3a

1c2aAS3

AS1

AS21a

2c

2b

1b

3c

eBGP session

iBGP session

Page 76: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

76

Distributing reachability info

With eBGP session between 3a and 1c, AS3 sends prefix reachability info to AS1

1c can then use iBGP to distribute this new prefix reach info to all routers in AS1

1b can then re-advertise the new reachability info to AS2 over the 1b-to-2a eBGP session

When router learns about a new prefix, it creates an entry for the prefix in its forwarding table.

3b

1d

3a

1c2aAS3

AS1

AS21a

2c

2b

1b

3c

eBGP session

iBGP session

Page 77: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

77

Path attributes & BGP routes

When advertising a prefix, advert. includes BGP attributes

prefix + attributes = “route”

Two important attributes: AS-PATH: contains ASes on the path to the prefix NEXT-HOP: Indicates the specific internal-AS router

to next-hop AS. (There may be multiple links from current AS to next-hop-AS.)

When gateway router receives route advert., uses import policy to accept/decline

Page 78: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

78

BGP messages

BGP messages exchanged using TCP

BGP messages: OPEN: opens TCP connection to peer and authenticates

sender UPDATE: advertises new path (or withdraws old) KEEPALIVE keeps connection alive in absence of

UPDATES; also ACKs OPEN request NOTIFICATION: reports errors in previous msg; also

used to close connection

Page 79: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

79

BGP Route Selection

Router may learn about more than 1 route to some prefix. Router must select a route

Elimination rules:1. Local preference value: policy decision

(Routes are assigned values by AS administrator based on import policy)

2. Shortest AS-PATH 3. Closest NEXT-HOP router: hot potato routing4. Additional criteria

Page 80: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

80

BGP Routing: Route Advertising

Figure 4.5-BGPnew: a simple BGP scenario

A

B

C

W X

Y

legend:

customer network:

provider network

A,B,C are provider networks X,W,Y are customer (of provider networks) X is dual-homed: attached to two provider networks

X does not want to route traffic from B to C … so X will not advertise to B its route to C

BGP export policy

Page 81: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

81

BGP Routing: Route Advertising (cont’d)

Figure 4.5-BGPnew: a simple BGP scenario

A

B

C

W X

Y

legend:

customer network:

provider network

A advertises to B the path AW B advertises to X (its client) the path BAW

Should B advertise to C the path BAW? No way! B gets no “revenue” for routing CBAW since neither

W nor C are B’s customers

Rule of thumb: a provider wants to route only to/from its customers! (unless there is a mutual peering deal)

Page 82: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

82

Why different Intra- and Inter-AS routing ?

Policy: Inter-AS: admin wants control over how its traffic routed,

who routes through its net. Intra-AS: single admin, so no policy decisions needed

Scale: hierarchical routing saves table size, reduced update traffic

Performance: Intra-AS: can focus on performance Inter-AS: policy may dominate over performance

Page 83: School of Computing Science Simon Fraser University CMPT 765/408: Computer Networks

83

Unicast, multicast, broadcast

Unicast: one source, one destination E.g., web session

Multicast: one source, multiple destinations Subset of all possible destinations E.g., streaming a hockey game to interested fans

Broadcast: one source, all destinations E.g., broadcasting link state info to ALL routers in a

domain in OSPF protocol

Anycast: multiple possible sources, one destination Sources have same (anycast) address Request is forwarded to appropriate source (Still in research phases)