資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided...

33
資 資 Lee <Lesson 10-1> Lesson 10 RIP, OSPF, and BGP

Transcript of 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided...

Page 1: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-1>

Lesson 10

RIP, OSPF, and BGP

Page 2: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-2>

Routing in Internet

An internet is divided into autonomous systems. An autonomous system(AS) is a group of networks and routers under the authority of a single administration.

Routing inside an AS is called interior routing, Routing between ASs is referred to as exterior routing.

RIP and OSPF are protocols used in interior routing, and BGP is for exterior routing.

autonomous system autonomous system

R1

R2

Routers R1 and R2 use an interior and an exterior routing, others use only interior routing protocols.

Page 3: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-3>

RIP (Routing Information Protocol)

RIP based on distance vector routing, which uses the Bellman-Ford algorithm for calculating the routing tables.

In distance vector routing, each router periodically shares its knowledge about the entire internet with neighbors. Three keys:◦ Sharing knowledge about the entire autonomous system.

◦ Sharing only with neighbors.

◦ Sharing at regular internals. At every 30 seconds

Routing Table

Destination Hop Count Next Hop Other Information

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

Page 4: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-4>

資 管

Routing Table

RIP Updating AlgorithmReceive: 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. else1. 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. add it to the routing table.

2.else1. do nothing

3. Return

The routing table is updated upon receipt of a RIP response message. The following Shows the updating algorithm used by RIP.

Page 5: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-5>

Example of updating table

Net2 4

Net3 8

Net6 4

Net8 3

Net9 5

Net2 5

Net3 9

Net6 5

Net8 4

Net9 6

Net1 7 A

Net2 2 C

Net6 8 F

Net8 4 E

Net9 4 F

Updatingalgorithm

Net1 7 A

Net2 5 C

Net3 9 C

Net6 5 C

Net8 4 E

Net9 4 F

RIP message from C

RIP message from C after increment

Note: for Net6, the RIP massageContains a lower hop count and this shows up on the new routing table.For Net2, both identify the same next hop (router C). Although the value of hopCount is less than that comes from RIPThe value is updated to 5.

Page 6: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-6>

資 管

Initializing status to the routing table

Net: 14Net: 14

Net: 78Net: 78

Net: 23Net: 23

Net: 55Net: 55

Net: 92Net: 92

Net: 66Net: 66

Net: 08Net: 08

14 1 -

23 1 -

78 1 -

A

14 1 -

55 1 -

B

78 1 -

92 1 -

F

08 1 -

23 1 -

E

08 1 -

66 1 -

D

55 1 -

66 1 -

C

Page 7: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-7>

資 管

Final the routing table for the previous

Net: 14Net: 14

Net: 78Net: 78

Net: 23Net: 23

Net: 55Net: 55

Net: 92Net: 92

Net: 66Net: 66

Net: 08Net: 08

08 2 E

14 1 -

23 1 -

55 2 B

66 3 E

78 1 -

92 2 F

A

B

F

E D

C08 2 D

14 2 B

23 3 D

55 1 -

66 1 -

78 3 B

92 4 B08 1 -

14 2 A

23 1 -

55 3 A

66 2 D

78 2 A

92 3 A

08 1 -

14 3 E

23 2 E

55 2 C

66 1 -

78 3 E

92 4 E

08 3 A

14 1 -

23 2 A

55 1 -

66 2 C

78 2 A

92 3 A

Page 8: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-8>

資 管

RIP Message FormatCommand Version Reserved

Family All 0s

Network address

All 0s

All 0s

Distance

Command. The 8-bit field specifies the type of message: request (1) or response (2).

Version. The 8-bit field defines the version. Version 1 , version 2. Family. This 16-bit field defines the family of the protocol used. For TCP/IP

the value is 2. Address. Defines the address of the destination network. RIP allocated 14

bytes for this field. IP currently uses only four bytes. Distance. 32-bit field defines the hop count from the advertising router to

the destination network. RIP message are used UDP user datagram with port 520. A RIP message

does not include length field, since that can be found in the UDP.Com: 1 Version Reserved

Family All 0s

Network address

All 0s

All 0s

Distance

Com: 1 Version Reserved

Family All 0s

All 0s

All 0s

All 0s

Distance

Repeated

Request for some Request for all

Page 9: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-9>

Com: 2 Version Reserved

Family:2 All 0s

141.12.0.0

All 0s

All 0s

5

Family:2 All 0s

181.2.0.0

All 0s

All 0s

2

Family:2 All 0s

97.0.0.0

All 0s

All 0s

4

141.12.0.0 5

181.2.0.0 2

97.0.0.0 4

Conceptual message

Response message

Page 10: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-10>

Problems with RIP Slow Convergence

Net: 2Net: 2 Net: n+1Net: n+1R1 R2

Rn

Net: 1Net: 1

0 seconds 15 seconds15x n seconds

Instability

Net: 2Net: 2Net: 1Net: 1Net: 3Net: 3

Net 1 1 -

… …Net 1 2 A

… …

A B

Net: 2Net: 2Net: 1Net: 1

Net 1 16 -

… …Net 1 2 A

… …

A B Net: 3Net: 3

Net 1 2 A

… …

Net: 2Net: 2Net: 1Net: 1

Net 1 3 B

… …Net 1 2 A

… …

A B Net: 3Net: 3

Net 1 4 A

… …

Page 11: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-11>

Open Shortest Path First (OSPF) An autonomous system(AS) is divided into many different areas. Routers inside an area flood the area with routing information. At the border of an area, special routers called area border routers

summarize the information about the area and send it to other areas.

R1

Area border router

R2

To other ASs

ASBoundary router

Backbonerouter

Backbonerouter

Area border router

Area 0

Area 1 Area 2

Page 12: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-12>

Areas and backbone An area is a collection of networks, host, and

routers all contained within an autonomous system. Routers inside an area flood the area with routing

information. At the border of an area, special routers called area border routers summarize the information about the area and send it to other areas.

One special area called backbone; all of the areas inside an autonomous must be connected to the backbone. Each area has an area identification. The backbone area is area zero.

Page 13: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-13>

OSPF

Metric: OSPF protocol allows the administrator to assign a cost, called the metric, to each route. The ,metric can be based on a type of service (min. delay, max. throughput). As a matter of fact, a router can have multiple routing tables, each based on a different type of service.

Link state routing: OSPF uses link state routing to update the routing tables in an area. Three keys to the link state routing:◦ Sharing knowledge about the neighborhood. Each router sends

the state of its neighbor to every other router in the area.◦ Sharing with every other router. Each router sends the state of its

neighbor to every other router in the area. It does so by flooding, a process sends its information to all of its neighbors.

◦ Sharing when there is a change. Each router shares the state of its neighbor only when there is a change.

Page 14: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-14>

Types of Links In OSPF terminology, a network is called a link. Four types

are defined:◦ Point-to-point Link: a point-to-point link connects two routers without

any other host or router in between.

◦ Transient Link: a network with several routers attached to it. All LANs and some WANs with two or more routers are of this type.

◦ Stub Link: a network that is connected to only one router.

◦ Virtual Link: when the link between two routers is broken. A virtual link between them uses a longer path.

AB

A B

C D E

A B

CE

Designed Network

DA

A

Designed Network

point-to-point Link

stub Link

Transient Link

Page 15: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-15>

C

A

B

D

E

F

FDDI

Token ring

T1 line

N1N2

EthernetEthernet

T3 line

Ethernet N4

N3 N5

A

B

C

D

E

FN2 N1 N3

N4

N5

2 3

8 8

5

7

4 4

5

29 5

Example of an internet

Graphical representation of an internet

Page 16: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-16>

Link state advertisement (LSA, 1/5)Five LSAs:

◦ Router link, defines the links of a true router. Announce information about all of its links and what is at the other side of the link(neighbors)

Point-to-point

Virtual

To stub network

To transient networkAdvertising routerwith 4 links

Page 17: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-17>

Link state advertisement (LSA, 2/5)◦ Network link: a network defines the links of a network.

A designated router, on behalf of the transient network, distributes this type of LSA packet. The packet announces the existence of all of the routers connected to the network.

Network with5 links Designated router

advertises the links

Page 18: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-18>

Link state advertisement (LSA, 3/5) Summary link to network: router link and

network link advertisements flood the area with information about the router links and network links inside an area. But a router should also know about the networks outside its area, and the area border routers can provide this information. An area border router is active in more than one area. It receives router link and network link advertisements and creates a routing table for each area.

R1

R2

Area 1 Area 2

Area 0Summary link to network

Flooded by the area boarder router into the area

N1

Router R1has two routing tables, one for area 1 and one for area 0. R1 floods area 1 with information about how to reach a network located in an area 0

Flooded by the area boarder router into the area

Summary link to network

Page 19: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-19>

Link state advertisement (LSA)◦ Summary Link to AS boundary router: .

External link:

R1

R2

Area 1 Area 2

Area 0

Flooded by the area boarder router into the area

Flooded by the area boarder router into the area

ASSummary link to AS boundary router

AS boundaryrouter

Area 1 Area 2

Area 0AS

Flooded by the AS boundary router intothe AS

External link

Page 20: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-20>

Dijkstra Algorithm

◦ Every router in the same area had the same link state database.

◦ Use Dijkstra to calculate the shortest path between two points on a network using a graph made of modes and edges.

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 step3 3 to 5 until every node becomes permanent.

Page 21: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-21>

A A D

N1

8

5

0A D

N1

8

5C

5

B

5

A D

N1

8

5C

5

B

5

N2

A D

N1

8

5C

5

B

5

7N2

A D

N1

8

5C

5

B

5

7

E9 E9

N2

A D

N1

8

5C

5

B

5

7

E9

N310

Page 22: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-22>

N2

A D

N1

8

5C

5

B

5

7

E9

N310

N2

A D

N1

8

5C

5

B

5

7

E9

N310

N411

14

N2

A D

N1

8

5C

5

B

5

7

E9

N310

N411

F10

N2

A D

N1

8

5C

5

B

5

7

E9

N310

N411

F10 N515

N2

A D

N1

8

5C

5

B

5

7

E9

N310

11

F10 N515

N2

A D

N1

8

5C

5

B

5

7

E9

N310

N411

F10 N515

N4

Page 23: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-23>

OSPF’s routing table

Network Cost Next Router Other Information

N1 5 -

N2 7 C

N3 10 D

N4 11 B

N5 15 D

Every router uses the shortest path tree method to construct its routing table. The routing table shows the cost of reaching each network in the area. To find the cost of reaching networks outside of the area, and the external link advertisements.

Page 24: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-24>

Types of packets in OSPFOSPFpackets

OSPFpackets

Hello Hello DatabasedescriptionDatabasedescription

Link stateupdateLink stateupdate

Link staterequestLink staterequest

Link state acknowledgementLink state acknowledgement

Link staterequestLink staterequest

Router linkNetwork linkSummary link to networkSummary link to AS boundary routerExternal link

Page 25: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-25>

Packet Format in OSPF

Version (2) Type (1:5) Message length

Source router IP address

Area ID

Checksum Authentication type

Authentication (64-bit)

OSPF packet header (24 bytes)

Authentication type: defines the authentication method used in this area. At this time, two types are defined: 0 for none and 1 for password.

Authentication. This 64-bit field is the actual value of the authentication data. In the future, when more authentication types are defined, this field will contain the result of the authentication calculation. For now, if the type is 0, this field is filled with 0s. If the type is 1, this field carries an eight-character password.

Page 26: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-26>

Hello message in OSPF

Common header 24 bytes TYPE:1

Network mask

Hello interval All 0s E T Priority

Dean interval

Designed router IP address

Backup designed router IP address

Neighbor IP address [repeated]

Hello message: header plus data

OSPF uses the hello message to create neighbor relationships and to test the reachability of neighbors.

Network mask. Hello interval. Defines the number of seconds between hello

messages. E flag. The area is a stub. T flag, supports multiple metrics. Priority. Defines the priority of the router. After all neighbors

declare their priorities, the router with the highest priority is chosen as the designed router.

Dead intervals, Designed router IP address, The IP address of the designed router

over which the message is sent Neighbor IP address, list of all the neighbors from which the

sending router has received.

Page 27: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-27>

Database description message in OSPF

Common header 24 bytes TYPE:2

All 0s All 0s E B All 0s I M MS

Message sequence number

Link sate header (20 bytes)[repeated]

OSPF uses the database description to give an outline about the database from sending router. The received router finds out which lines of information it does not have. It then sends one or more link state request packets to get full information.

E flag. Set to 1 if the advertising router is an autonomous boundary router (E stands for external)

B flag. Set to 1 if the advertising router is an area border router. I flag. Set to 1 if the message is the first message. M flag. Set to 1 if this is not the last message. M/S flag. Indicates the origin of the packet: master (1) or slave (0) Message sequence number. Used to match a request with

response. Link state header. Gives the outline of each link, without details.

Page 28: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-28>

Link State request&update packet in OSPF

Common header 24 bytes TYPE:3 (request)

Link state type

Message sequence number

Advertising router

Request is sent by a router that needs information about a specific route or routes. It is answered with a link update packet.

Update: used by a router to advertise the states of its links. Each update packet may contain several different LSAs. For example, a link state update packet can contain 14 LSAs. Four of which are router link advertisements, three are network link advertisements, two are summary link to networks, two are summary link to AS boundary router advertisements, and thee are external link advertisements.

Common header 24 bytes TYPE:4 (update)

Number of link state advertisement

Link state advertisement (five different types) [repeated]

rep

eate

d

Page 29: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-29>

Link state age reserved E T Link state type

Link state ID

Advertising router

Link sate sequence number

Link state checksum Length

Link state age. Indicates the number of seconds elapsed since this message was first generated.

E flag. Set to 1, means the area is a stub area. T flag. Set to 1 if the router can handle mltiple types of service. Link state type. Link state ID.

LSA header

Page 30: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-30>

BGP: Border Gateway Protocol

Page 31: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-31>

BGP

◦ BGP: an inter-autonomous system routing protocol. It first appeared in 1989 and has gone through four versions. BGP is based on a routing method called path vector routing. Why not the distance vector and link state routing? Distance vector is not a good candidate because there are occasions in which the route with the smallest hop count is not the preferred route. Link state result in huge routing table when do the inter-autonomous system.

◦ Path vector routing: each entry in the routing table contains the destination, 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.

Network Next Router Path

N01 R01 AS14, AS23, AS67

N02 R05 AS22, AS67, AS05, AS89

N03 R06 AS67, AS89, AS09,AS34

N04 R12 AS62, AS02, AS09

Page 32: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-32>

R1

R2

AS1 AS2

AS3

R3

R4

AS4

N1 R1 AS1 N1 R2 AS2, AS1

N1 R3 AS3, AS2, AS1

◦ Path vector messages: the AS boundary routers that participate in path vector routing advertise the reach ability of the networks in their own AS to neighbor AS boundary routers. The concept of neighborhood here is the same as the one described in the RIP or OSPF protocol.

The router R1 sends a path vector message advertising the reachability of N1. router R2 receives the message, update its routing table, and after adding its AS to the path and inserting itself as the next router.

Page 33: 資 管 Lee Lesson 10 RIP, OSPF, and BGP. 資 管 Lee Routing in Internet An internet is divided into autonomous systems. An autonomous system(AS) is a group.

資 管 Lee <Lesson 10-33>

QuizRIP, OSPF, and BGP are acronym for?What are the functions of RIP, OSPF, and

BGP?What is Path vector routing? Why BGP uses

it?What are the problems with RIP? Can you tell the advantages and

disadvantages among RIP, OSPF and BGP?