1 Routing. 2 Connectionless Network Layers Destination, source, hop count Maybe other stuff...

44
1 Routing

Transcript of 1 Routing. 2 Connectionless Network Layers Destination, source, hop count Maybe other stuff...

1

Routing

2

Connectionless Network Layers

• Destination, source, hop count

• Maybe other stuff– fragmentation

– options (e.g., source routing)

– error reports

– special service requests (priority, custom routes)

– congestion indication

• Real diff: size of addresses

3

Comparative Addresses

• IPv4: 4 bytes, boundary depends on “mask”

• IPX: 10 bytes: 4=link, 6=node

• AppleTalk: 2=link, 1=node

• CLNP: variable length, 14=“area”, 6=node

• IPv6: 16 bytes: 8=link, 8=node (?)

4

IPv4 data packet

version hdr lnth

TOStotal length

pkt id

offsetdf mf

offset (cont’d)

TTL (time to live)

protocolhdr checksum

source

destinationoptions

padding

2

2

24

4

variable

variable

Don’t FragmentMore Fragments

TCP,UDP

5

IPv6

(4 bits)TOS flow label (20 bits)vers

(8 bits)

payload length next hops remain

source

destination

hop by hop hdr, or rtg hdr, or authentication hdr, orend-to-end, or TCP, or ...

6

Distributed Routing Protocols

• Rtrs exchange control info

• Use it to calculate forwarding table

• Two basic types– distance vector (DECnet, “old” ARPANET,

RIP)– link state (“new” ARPANET 1980, DECnet

Phase V 1985, IS-IS 1988, OSPF version 2 1998).

7

Distance Vector Routing• Rtr knows

– own ID– how many cables hanging off box– cost, for each cable, of getting to nbr

j

k

m

n

cost 3

cost 2

cost 2

cost 7I am “4”

8

Distance Vector (DV) Routing

• Initialize distances to all rtrs in the network to be 0, except to its nbrs.

• Rtr learns from nbrs their distances to all nodes in the network, calculate own distances, and forward the distance vector to nbrs. This repeats until the distance vector converges.

• Rtr updates the distance vector whenever it receives different distance vector from some nbr, or whenever some link breaks.

• Distance vector is either sent periodically or when the network configuration changes.

9

j

k

m

n

cost 3

cost 2

cost 2

cost 7I am “4”

distance vector rcv’d from cable j

distance vector rcv’d from cable k

distance vector rcv’d from cable m

distance vector rcv’d from cable n

your own calculated distance vector

your own calculated forwarding table

12 3 15 3 12 5 3 18 0 7 15

5 8 3 2 10 7 4 20 5 0 15

0 5 3 2 19 9 5 22 2 4 7

6 2 0 7 8 5 118 12 3 2

2

m

6

j

5

m

0

0

12

k

8

j

6

k/j

cost 3

cost 2

cost 2

cost 7

19

n

3 ?

j ?

?

?

Example of DV Routing

10

Problems with Distance Vector Routing

• B does not conclude that C is unreachable but that d(B,C)=d(B,A)+d(A,C) =3

• When A receives DV from B it concludes that d(A,C)=4

• DV increases in this until infinity, or maximum value which is set by administrator. For this reason, the cost field has the small size.

A B C

11

Split Horizon

• This technique sometime prevents counting toward infinity.• If R1 forwards packets to D through R2, then R2 informs R1

that its distance to D is infinity. • So, when the link toward node D fails, R2 concludes that its

distance to D is infinity immediately, i.e. that D is unreachable.

R1 R2 D

12

• Unfortunatelly, split horizon does not always work. • When link to D fails, R1 concludes that D is unreachable.• R2 gets the information from R1 that D is unreachable,

and sets the path to D through R2, calculating DV based on DC of R2, and vice versa.

R2

D

R1

R3

Split Horizon

13

Link State Routing

• Construct Link State Packet (LSP)– who you are– list of (nbr, cost) pairs

• Broadcast LSPs to all rtrs• Store latest LSP from each rtr received from

nbrs• Compute Routes• Forward LSPs from each nbr to other nbrs

14

Building Link State Packets

(a) A subnet. (b) The link state packets for this subnet.

15

Broadcasting LSP

• LSPs are distributed through flooding– send to every nbr except from which LSP rcv’d

• LSP is updated only if it has a higher sequence number than the existing one, or if its age exceeded the maximum age.

• Rtr forwards only updated LSPs, and it generates new LSPs periodically or when there is a configuration change (link cost has changed, nbr is down).

16

Fixing the Algorithm

• Require LSPs to age at every hop• Make sequence number large and linear• Careful synchronization between nbrs

– At most one LSP from one source– Each LSP has flags for acknowledgements and

transmissions to nbrs.– When LSP is received from some nbr its corresponding

ack flag is set, as well as its send flags to other nbrs. – Acknowledgments for LSP reception from one nbr are

sent to it in a round-robin fashion. LSPs with the send flags for some nbr set, are sent to it also in a round-robin fashion.

17

• Sequence number a is smaller than sequence number b when it holds:

banba

banba

2

2

>a

<a

an-1

n 0 1

Arithmetic in Circular Space

18

Distributing the Link State Packets

The packet buffer for router B in the previous slide (Fig. 5-13).

19

Computing Routes

• Edsgar Dijkstra’s algorithm:– calculate tree of shortest paths from self to each

– also calculate cost from self to each

– Algorithm:

• step 0: put (SELF, 0) on tree

• step 1: look at LSP of node (N,c) just put on tree. If for any nbr K, this is best path so far to K, put (K, c+dist(N,K)) on tree, child of N, with dotted line

• step 2: make dotted line with smallest cost solid, go to step 1

20

A B C

D E F

G

6 25

1

2122 4

A

B/6

D/2

B

A/6

C/2

E/1

C

B/2

F/2

G/5

D

A/2

E/2

E

B/1

D/2

F/4

F

C/2

E/4

G/1

G

C/5

F/1

Example of Dijkstra Algorithm

21

C(0)

B(2)

F(2)

G(5)

C(0)

B(2)

F(2)

G(5)

C(0)

B(2)

F(2)

G(5)

E(6) G(3)C(0)

B(2)

F(2)

E(6) G(3)

C(0)

B(2)

F(2)

E(6) G(3)

A(8) E(3)

C(0)

B(2)

F(2)

G(3)

A(8) E(3)

Example of Dijkstra Algorithm

22

C(0)

B(2)

F(2)

G(3)

A(8) E(3)

D(5)

C(0)

B(2)

F(2)

G(3)

A(8) E(3)

D(5)

C(0)

B(2)

F(2)

G(3)

A(8) E(3)

D(5)

A(7)C(0)

B(2)

F(2)

G(3)

E(3)

D(5)

A(7)

Forwarding table:A/BB/BC/selfD/BE/BF/FG/F

Example of Dijkstra Algorithm

23

Distance Vector vs Link State

• Memory: distance vector wins (but memory is cheap)

• Computation: debatable• Simplicity of coding: simple distance vector wins. • Convergence speed: link state better• Functionality: link state can have custom routes,

mapping the net, easier troubleshooting,

24

Specific Routing Protocols

• Interdomain vs Intradomain

• Intradomain: link state (OSPF, IS-IS) vs distance vector (RIP)

• Interdomain– static routing– EGP– BGP– ?

25

Routing Information Protocol (RIP)

• Packets are requests and responses. • Report through response every destination every 30

seconds, or as a reply to request. • Throw away info if too old (90? for IP)• Request when a rtr comes up or when info is too old• Maximum cost is 16• Most implementations of IP RIP do

– split horizon– triggered updates– poison reverse (rtr that learns about link fail announce the distance

through it as infinity).

26

Link State Routing Protocols

• Intermediate system-intermediate system (IS-IS) is ISO standard; Netware link state protocol (NLSP) is modification of IS-IS; Private network-to-network interface (PNNI) for ATM; Open shortest path first (OSPF);

• Similarities and differences: hierarchy, area addresses, LANs, parameter synchronization, number of destinations per LSP, LSP database overload, authentication.

27

IS-IS Pkt Types

• Hello– pt-to-pt

– LAN (extra stuff like LAN name, 2-way connectivity check)

• Sequence number packet (SNP)– CSNP (complete), for LAN sync, and startup

– PSNP (partial), for acking one or more LSPs

• LSPs.

28

OSPF Pkt Types

• Hellos• Database description

– Startup

• Link state request• Link state update

– Multiple LSAs

• Link state ack• Links state advertisement (LSA)

– type 1 LSA (like IS-IS ordinary LSP)– type 2 LSA (like IS-IS LSP on a LAN)– types 3, 4, 5, … external info

29

OSPF types 3, 4, and 5 LSAs

area

AS

IP prefix

area border router

AS border rtr 33

3

3

44

5

5

5

30

OSPF

• Runs on the top of IP with protocol field 89.• Comprises two levels of hierarchy: areas

and backbone. • Boarder routers of some domain calculate

their costs to the destinations outside the domain and flood the information into the area, so that area routers can calculate optimal path.

31

OSPF

• Hierarchy: OSPF has two levels of hierarchy. Boarder routers of any area calculate their costs to the boarder routers of the autonomous system (AS) and inject those to the area. The AS boarder routers report their cost to the destinations outside of the area.

• Area addresses: area has ID (4 bajta), where 0.0.0.0 denotes level 2 in hierarchy. No possibility for dynamic merging or splitting the areas.

32

OSPF • Routing in LAN: DR expects an acknowledgment from

LAN routers for each link stage advertisement (LSA). A backup DR (BDR) keeps the replicated LSA database. Whenever some LAN router sends LSA it multicasts it to DR and BDR. Acks are also multicast to DR and BDR. If there is no ack, LSA is sent to the individual router.

• Parameter sync.: HelloInterval and RouterDeadInterval are specified in Hello messages, and have to be the same in the nbrs. This is limitation when the parameters is to be changed.

• Startup: master/slave “database description” protocol where LSAs are explicitly sent and acked and only after that is complete does link come up.

33

OSPF

• One destination can be advertised in one LSA.• An overload protection is option in RFC 1765. All

routers receive the same max external link state information. Rtrs can purge the info that they transmit if their databases are overloaded.

• Authentication is set in the link state update message comprising multiple LSAs. It is same for the two directions of a link. Each rtr changes authentication.

34

Hierarchical Routing

Hierarchical routing.

35

Exterior Gateway Protocol (EGP)

• Like RIP, but no metrics. Just if reachable. Rtr inside a domain collects reachability information and informs the rtr on the boarder of the domain. Boarder rtr informs the internal rtr about reachability outside the domain.

• Rtrs establish com with pkts: nbr acquisition request, nbr acquisition reply or refusal, nbr cease request, nbr cease ack.

• Theoretically only legal topology (but tree would work):

backbone

36

EGP Does not Support Loops

R4R5

R6

R1

R3

R2

Domain 1

Domain 2

Core

Topologija u kojoj EGP ne funkcioniše

5*

37

Border Gateway Protocol (BGP)

• Replacement of EGP, with “policies”• Path vector: Instead of distances, rtrs exchange

info about path, sequence of AS. Given reported paths to D from each nbr, and configured preferences, choose your path to D– don’t ever route through domain X, or not to D, or only

as last resort

• Other policies: don’t tell nbr about D, or lie to nbr about D making path look worse

38

BGP Atributes and Pkts

• Origin (well-known, mandatory) can be IGP, EGP or incomplete; AS path (well-known, mandatory) 2 octets for each AS along the path; Next hop (well-known, mandatory), Unreachable (well-known, discretionary); Intra AS metric (optional, non-transitive) to help to rtrs of nbr AS to calculate optimal path; Community (optional, non-transitive) to establish a unique policy;

• Packets are: Open establish com between rtrs of different AS; Update carries routing info; Notification last message before a connection is closed; Keepalive to inform about presence of nbr.

39

BGP Configuration

• Path preference rules

• Which nbr to tell about which destinations

• How to “edit” the path when telling nbr N about prefix P (add fake hops to discourage N from using you to get to P)

• Possible policies that don’t converge

• Lots of theoretical problems, and in practice

40

E-BGP vs I-BGP

• Talking to peer within domain I-BGP

• Talking to peer in another domain E-BGP

• Original I-BGP had to be fully connected

• To improve things:– use confederations to break domain into smaller

domains (each fully connected I-BGP)– use “route reflecter”, start topology with BGP

router in domain in center, passing routing info

41

BGP Confederations

• Originally so could group lots of domains into super-domain– only one policy– path looks shorter– does constrain path (since can’t have domain

twice)

d1 d2 d3d4

d5d6

d7

FOO

S

D

42

Multicast Routing

(a) A network. (b) A spanning tree for the leftmost router. (c) A multicast tree for group 1. (d) A multicast tree for group 2.

43

Routing for Mobile Hosts

A WAN to which LANs, MANs, and wireless cells are attached.

44

References

• Radia Perlman, Interconnections: Bridges, Routers, Switches and Internetworking Protocols, Addison-Wesley January 2000.