37
1 Introduction to Computer Networks Ilam University By: Dr. Mozafar Bag-Mohammadi Routing

1 Introduction to Computer Networks Ilam University By: Dr. Mozafar Bag-Mohammadi Routing

Embed Size (px)

Citation preview

1

Introduction to Computer Networks

Ilam University

By: Dr. Mozafar Bag-Mohammadi

Routing

2

Routing Process

Question? How to populate the lookup table? Primary solutions:

Build the lookup table Manually? Is it practical? The answer is no.

Flooding- Broadcast to all node except the one we have received the packet. Waste the bandwidth Does not scale well.

3

Overview

Network as a Graph

Problem: Find lowest cost, or shortest, path between two nodes

The process is distributed and this makes it complicated, i.e, it may create loop.

Factors static: topology dynamic: load

4

3

6

21

9

1

1D

A

FE

B

C

4

Distance Vector Each node maintains a set of triples

(Destination, Cost, NextHop) Exchange updates with directly connected

neighbors periodically ( on the order of several seconds) whenever its table changes (called triggered update)

Each update is a list of pairs:(Destination, Cost)

Update local table if receive a “better” route smaller cost came from next-hop

Refresh existing routes; delete if they time out

5

Example

Destination Cost NextHop A 1 A C 1 C D 2 C E 2 A F 2 A G 3 A

D

G

A

F

E

B

C

•Distance of other nodes from Node B.•The cost between two nodes has been assumed 1.•All nodes keep a routing table from themselves.

6

The Bellman-Ford Algorithm

•Bellman-Ford algorithm solve the distance Vector problem in general case.

1. Set: Xo = ( , , ,…, ).

2. Send updates of components of Xn to neighbors

3. Calculate: Xn+1 = F(Xn)

4. If Xn+1 Xn then go to (2)

5. Stop

7

Bellman-Ford AlgorithmExample:Calculate from R8

R5

R3

R7

R8

R6R4R2R1

1 1 4

2

4

2 2 3

23

R3

R2

R5

R7

R4 R6

R8

R1

1 1 4

22

32

42 3

42

3

2

2nd step

8

Bellman-Ford Algorithm

Result:

R8

R6R4R2R1

R3

R5

1 1

42

32

5 4 5 2

42

32

R7

R3

R5R7

R8

R6R4R2R1

1 1 4

222

3

324

6 4 6 2

42 3

3rd step

9

Node Failure F detects that link to G has failed F sets distance to G to infinity and sends update to A A sets distance to G to infinity since it uses F to reach G A receives periodic update from C with 2-hop path to G A sets distance to G to 3 and sends update to F F decides it can reach G in 4 hops via A

D

G

A

F

E

B

C

10

Routing Loops

link from A to E fails A advertises distance of infinity to E B and C advertise a distance of 2 to E B decides it can reach E in 3 hops; advertises this to A A decides it can read E in 4 hops; advertises this to C C decides that it can reach E in 5 hops…

D

G

A

F

E

B

C

11

The count-to-infinity problem

12

Loop-Breaking Heuristics

Set infinity to a reasonably small number. For instance, RIP sets to 16

Split horizon: Don’t announce the distance to the node the distance has been gotten from.

Split horizon with poison reverse: Instead of not announcing the distance put negative numbers.

13

Link State

Strategy send to all nodes (not just neighbors) information

about directly connected links (not entire routing table)

Link State Packet (LSP) id of the node that created the LSP cost of the link to each directly connected neighbor sequence number (SEQNO) time-to-live (TTL) for this packet

14

Reliable flooding store most recent LSP from each node forward LSP to all nodes but one that sent

it generate new LSP periodically

increment SEQNO start SEQNO at 0 when reboot decrement TTL of each stored LSP

discard when TTL=0

Link State (cont.)

15

Route Calculation

Dijkstra’s shortest path algorithm Let

N denotes set of nodes in the graph l (i, j) denotes non-negative cost (weight) for edge (i, j) s denotes this node M denotes the set of nodes incorporated so far C(n) denotes cost of the path from s to node n

M = {s}for each n in N - {s}

C(n) = l(s, n)while (N != M)

M = M union {w} such that C(w)is the minimum for all w in (N - M)for each n in (N - M)

C(n) = MIN(C(n), C (w) + l(w, n ))

16

Shortest Path Routing: Dijkstra Algorithm

17

Subnetting Add another level to address/routing hierarchy:

subnet Subnet masks define variable partition of host part Subnets visible only within site

Network number Host number

Class B address

Subnet mask (255.255.0.0)

Subnetted address

1111111111111111111 0000000000000000

Network number Host IDSubnet ID

18

Subnet Example

Forwarding table at router R1Subnet # Subnet Mask Next Hop

128.96.34.0 255.255.255.128 interface 0

128.96.34.128 255.255.255.128 interface 1

128.96.33.0 255.255.255.0 R2

Subnet mask: 255.255.255.128.Subnet number: 128.96.34.0

128.96.34.15 128.96.34.1

H1R1

128.96.34.130Subnet mask: 255.255.255.128Subnet number: 128.96.34.128

128.96.34.129128.96.34.139

R2H2

128.96.33.1128.96.33.14

Subnet mask: 255.255.255.0Subnet number: 128.96.33.0

H3

111….1.0xxx….x

Net hostSubnet

19

Supernetting

Assign block of contiguous network numbers to nearby networks

Called CIDR: Classless Inter-Domain Routing Represent blocks with a single pair

(first_network_address, count) Restrict block sizes to powers of 2 Use a bit mask (CIDR mask) to identify block size All routers must understand CIDR addressing

20

Route Propagation Know a smarter router

hosts know local router local routers know site routers site routers know core router core routers know everything

Autonomous System (AS) corresponds to an administrative domain examples: University, company, backbone network assign each AS a 16-bit number

Two-level route propagation hierarchy interior gateway protocol (each AS selects its own) exterior gateway protocol (Internet-wide standard)

21

Architecture of Routing Protocols

IGP

IGP IGP

EGPEGP

EGP

AS 701

AS 6431 AS 7018

Interior Gateway Protocols (IGP) : inside autonomous systems

Exterior Gateway Protocols (EGP) : between autonomous systems

OSPF, IS-IS,RIP, EIGRP, ... BGPMetric Based Policy Based

UUNet

AT&T Common BackboneAT&T Research

22

Interior Gateway Protocols

RIP: Route Information Protocol developed for XNS distributed with Unix distance-vector algorithm based on hop-count

OSPF: Open Shortest Path First recent Internet standard uses link-state algorithm supports load balancing supports authentication

23

The Most Common Routing Protocols

Routing protocols exchange network reachability information between routers.

IP (and ICMP)

TCP UDP

BGP RIP

OSPF EIGRPIS-IS

Cisco proprietary

24

BGP-4 BGP = Border Gateway Protocol

Is a Policy-Based routing protocol

Is the de facto EGP of today’s global Internet

Relatively simple protocol, but configuration is complex and the

entire world can see, and be impacted by, your mistakes.

• 1989 : BGP-1 [RFC 1105]

– Replacement for EGP (1984, RFC 904)

• 1990 : BGP-2 [RFC 1163]

• 1991 : BGP-3 [RFC 1267]

• 1995 : BGP-4 [RFC 1771]

– Support for Classless Interdomain Routing (CIDR)

25

BGP-4: Border Gateway Protocol AS Types

stub AS: has a single connection to one other AS carries local traffic only

multihomed AS: has connections to more than one AS refuses to carry transit traffic

transit AS: has connections to more than one AS carries both transit and local traffic

Each AS has: one or more border routers one BGP speaker that advertises:

local networks other reachable networks (transit AS only) gives path information

26

EGP: Exterior Gateway Protocol

Overview designed for tree-structured Internet concerned with reachability, not optimal routes

Protocol messages neighbor acquisition: one router requests that another be

its peer; peers exchange reachability information neighbor reachability: one router periodically tests if the

another is still reachable; exchange HELLO/ACK messages; uses a k-out-of-n rule

routing updates: peers periodically exchange their routing tables (distance-vector)

27

Policy-Based vs. Distance-Based Routing?

ISP1

ISP2

ISP3

Cust1

Cust2Cust3

Host 1

Host 2

Minimizing “hop count” can violate commercial relationships thatconstrain inter-domain routing.

YES

NO

28

Why not minimize “AS hop count”?

Regional ISP1

Regional ISP2

Regional ISP3

Cust2Cust3 Cust3

National ISP1

National ISP2

YES

NO

29

BGP Operations Simplified

Establish Peering on TCP port 179

Peers Exchange All Routes

Exchange Incremental Updates

AS1

AS2

While connection is ALIVE exchangeroute UPDATE messages

BGP

30

Two Types of BGP Neighbor Relationships

• External Neighbor (eBGP) in a different Autonomous Systems

• Internal Neighbor (iBGP) in the same Autonomous System

AS1

AS2

eBGP

iBGPPhysical Connection

Logical (TCP) Connection

31

Four Types of BGP Messages Open : Establish a peering session.

Keep Alive : Handshake at regular intervals.

Notification : Shuts down a peering session.

Update : Announcing new routes or withdrawing

previously announced routes.

announcement = Network prefix + attributes

32

AS Path Attribute (cont.)

BGP at AS YYY will never accept a route whose AS Path contains YYY. This avoids interdomain routing loops.

AS702UUnet

10.22.0.0/16AS Path = 1 333 702 877

Don’t Accept!

33

Local Preference AttributeUsed only in iBGP to prefer a point of exit

Higher LocalPreference Valuesare more preferred

AS 1

AS 2

AS 4

AS 3

Frank’s Internet Barn

Frank’s Customer

Customer of Frank’s Customer

13.13.0.0/16AS Path = 4 1Loc pref = 80

13.13.0.0/16AS Path = 2 1Loc pref = 100

13.13.0.0/16AS Path = 3 1Loc pref = 90

Frank’s Upstream Provider

Frank’s Local Competition

13.13.0.0/16

34

IP Version 6 Features

128-bit addresses (classless) multicast real-time service authentication and security autoconfiguration end-to-end fragmentation protocol extensions

Header 40-byte “base” header extension headers (fixed order, mostly fixed length)

fragmentation source routing authentication and security other options

35

Tunneling

36

Routing for Mobile Hosts1- finding location of the mobile host2- hand-off 3- security

37

Routing for Mobile Hosts (2)

Packet routing for mobile users.