1 Routing Protocol. 2 Outline Router 的運作 Routing Protocol Routing Algorithm Case Studies

Preview:

Citation preview

1

Routing Protocol

2

Outline

• Router 的運作• Routing Protocol

• Routing Algorithm

• Case Studies

3

路由器( Router )• Router 用於連接 LLC 不同,但

Network Layer 及上層都相同的網路。• Internet 以 Routers 做為中繼站,穿越各個網路轉送 Packet 。

• 企業內部以 Routers 做為子網路交換 Packet 的中心。

4

Router 通訊協定架構

Physical

Data Link

Network

PHY PHY

LAN 1 LAN 2

Router Function

Host A Host B

Session

Transport

Presentation

Application

Physical

Data Link

Network

Session

Transport

Presentation

Application

Network

Data LinkData Link

5

Routers 的運作• 讀取收到的 Packet 上的 IP 位址,查詢路由表( Routing Table ),以得知應從那 一個 Port 將 Packet 送出。

• Router 必須了解兩個協定的 PHY 、 Data Link Layers ,以便和兩個子網路溝通和進行封包的轉換。

• 依據 Routing Table , Router 會選擇到 Destination 有最短路徑的網路介面,將 Datagram 傳給 Next Hop 。

6

路由器 R2 的路由資訊

7

Router R2 路由表

R2 R3R1

8

Routing Table 的建立• Static Routing

• Dynamic Routing

9

Static Routing

• 不會與其他 Routers 交換訊息,安全性高,當想隱藏某一部分網路資訊,就可使用 Static Routing 來設定。

• 如果一個網路只能經由一個路徑到達,只要使用 Static Routing 就很足夠,可減少網路 traffic 。

• 要輸入 Default Routing 的資訊。

10

Dynamic Routing

• 由於網路結構會不斷改變,無法用 Static Routing ,以節省人力。

• Routers 間要不斷地交換訊息、自動學習改進 Dynamic Routing Table 。

• Routers 之間使用 Routing Protocol 來交換網路的資訊。

11

Routing/Routed Protocols

• Routed Protocol :用封裝 packet 來攜帶data ,像信件的作用。– Ex: IP 、 IPX 、 AppleTalk

• Routing Protocol :用以選擇最佳路徑來傳送 packets ,像貨運公司的作用。– Ex: OSPF 、 RIP 、 IGRP

12

Autonomous System

• 自主系統、網路自治區 (Autonomous System 、 AS)– A group of routers that share routing information

between them.

• Autonomous System 是自然形成,自己管理自己的一個網路系統。

• 每一個 Autonomous System 都有一個編號:自治號碼。– TANET : 1659 、 Hinet : 3462 、 Seednet :

4780 、 FETnet : 9674 、 ETWebs : 7481 。

13

Routing Protocols

• 各 Autonomous System 自行決定自己的 Routing Paths 。

• 兩大類的 Routing Protocols :– EGP ( Exterior Gateway Protocol ):用於讓 Autonomous Systems 間互相交換 Routing Information 的 Protocol 。

– IGP ( Interior Gateway Protocol ):用於 Autonomous System 內部 Routers 交換路徑的 Protocol 。

14

EGP ( 1/2 )• Exterior Gateway Protocol (外部選徑協定)

• 用於讓 Autonomous Systems 間互相交換 Routing Information 。

Autonomous System 1

Autonomous System 2

使用 EGP

內部使用 IGP 2

內部使用 IGP 1

Border gateway

15

EGP ( 2/2 )

• Routing Information 包含如何經由某些特定 Autonomous Systems ,可到達那些 Network 的資訊。

• 目前只有一種 EGP 在流傳:各 Autonomous Systems 間以 BGP ( Border Gateway Protocol )來交換路由資訊。– PS :有一種 Routing Protocol 也取名為

EGP 。

16

IGP ( 1/2 )• Interior Gateway Protocol (內部選徑協定)

• IGP refers to any algorithm that interior routers use when they exchange network reachability and routing information.

Autonomous System 1

Autonomous System 2

使用 EGP

內部使用 IGP 2

內部使用 IGP 1

17

IGP ( 2/2 )• 常見的 IGP :

RIP 、 OSPF 、 IGPR 、 EIGRP…

• 其他有名的 IGP :SPREAD 、 NLSP 、 Hello…

• 也有 Autonomous System 使用 BGP 做為 IGP

18

Types of Routing Algorithms

• 以 Routers 間交換路徑資訊與處理的方式,可將 Routing Algorithm 分類:– Distance Vector– Link Status– Hybrid

19

Distance Vector Algorithm

• 指使用 Propagation 傳遞路由資訊的 Algorithms 。路由資訊包含:– Vector :代表 Destination– Distance :到 Destination 的距離

• 以 Routing Table 儲存到各 Destination Network 的 Distance 和 Next Hop 。

• 每一個 Router 都會定期告訴 Neighbors 自己 Routing Table 內所有的資訊。

20

Propagation

A

B C D1. 新增一個 D 的網路介面聯到 Network 1

2. 更新 D 的 Routing Table

3. D 傳送更新後的 Routing Table

4. 更新 C 的 Routing Table

5. C 傳送更新後的 Routing Table

6. 更新 A,B 的 Routing Table

• 透過一層一層的傳送,更新 Router 資訊。

21

Basic Operations

• Router 在 Boot 後,隨時偵測與 Neighbors 間的連結關係。

• 一開始只有直接相連的網路會列在 Routing Table 上。

• 定期 Router 會送出一份 Routing Table 的 Copy 給 Neighbor 。

• 以收到 Neighbor Routers 送來的資料,選擇新的路徑,修正維護自己的 Routing Table 。

22

Network Topology (Original)

0

NET42

NET30

NET 2

NET 1

2

21

1

A

Q

B

A

NET17

1

2

1

2

5

4

3

ML

4

3

2

5

6

NET24

NET 4

2

7

6

5

43

8

4

a

b

4

3

23

An Initial Routing Table

Destination Distance Route

Net 1 0 direct

Net 2 0 direct

• This is the routing table for a router A.

• Each entry contains the IP address of network and an integer distance to the network.

24

A’s Routing Table at Time t

Destination Distance Route

Net 1 0 direct

Net 2 0 direct

Net 4 8 Router L

Net 17 5 Router M

Net 24 6 Router B

Net 30 2 Router Q

Net 42 2 Router B

25

Network Topology (New)

0

NET42

NET30

NET 2

NET 1

2

21

1

A

Q

B

A

NET17

1

2

4

1

2

5

4

3

ML

4

3

2

5

6

NET24

3NET 4

2

7

6

5

43

8

4

a

bZ

4 c

NET21

5

Y

3

26

Routing Message from B to A

Destination Distance

Net 1 2

Net 4 3

Net 17 6

Net 21 4

Net 24 5

Net 30 3

Net 42 3

Add a new router Z.

Y is crashed.

27

Modified Routing Table

Destination Distance Route

Net 1 0 direct

Net 2 0 direct

Net 4 8 4 Router L B

Net 17 5 Router M

Net 24 6 Router B

Net 30 2 Router Q

Net 42 2 4 Router B

Net 21 5 Router B

A’s Routing Table

at Time t+1

Destination Distance

Net 1 2

Net 4 3 a shorter distance

Net 17 6

Net 21 4 a new destination

Net 24 5

Net 30 3

Net 42 3 Its next hop is B

The B’s advertisement

at Time t

28

Properties of Distance Vector

• 只能確定與自己直接連接網路的資訊• 定期傳送整個 Routing Table

• 容易維護• 不需快速 processor 與大量 memory 進行計算

• Converge slowly

• 不適合大 Network

29

Connectionless Transport 的問題

• 大部分的 Routing Protocol 使用不可靠的 Connectionless Transport 。

• Routing Protocol 自行找解決方式:– 使用 Checksum 可解決收到錯誤封包問題。– Sequence Number 可處理不照順序傳送的封包。– Soft state 用 Timeout 除去過期的資料– Acknowledgement/Retransmission 可解決封包遺失問題。

30

Examples of Distance Vector

• Hello ( for 56kbps NSFNET )• SPREAD (最後一代 Core Network 使用的 Protocol )

• GGP ( Gateway-to-Gateway Protocol )• RIP ( Routing Information Protocol )• IGRP ( Interior Gateway Routing

Protocol )

31

Link Status Algorithm

• 又稱為 Link State 、 Shortest Path First ( SPF )。

• 設定時每一 Router 都要先有一份 Complete Topology Information 。

• Router 只送出自己與 Neighbors 間的 Link Status 給其他 Routers 。– Link is Up : Neighbor 與 Link 都存在。– Link is Down : Link 中斷。

32

Tasks of Link Status

• Router 定期與 Neighbor 交換訊息,以確認對方 Alive 或 Reachable 。

• 每一個 Router 定期送出它自己的 Link Status 給所有其他 Router 。

• 其他 Router 收到並使用此資訊修改自己的 Map of Internet 。並以 Dijkstra Shortest Path Algorithm 重新計算到每個 Destination 的 Shortest Path 。

33

Properties of Link Status

• 有整個 Network Topology 的資訊• 大家收到的訊息都相同

– Easy to debug– Guarantee to converge (also fast)

• 需要有快速 processor 與大量 memory 以進行計算

• Link Status 只靠每個 router 的 links ,與網路大小無關 Scaling

34

Examples of Link Status

• OSPF ( Open Shortest Path First )• IS-IS ( Intermediate System to

Intermediate System )• EIGRP ( Enhanced Interior Gateway

Routing Protocol )• NLSP

35

Hybrid

• 混合 Distance Vector 與 Link Status• Examples of Hybrid :

– IS-IS ( Intermediate System to Intermediate System )

– EIGRP ( Extended Interior Gateway Routing Protocol )

• 收斂快但不需較大的 Memory 與Computing 。

36

What Is a Short Routing Path?

• Metric in IGP– Hop count– Delay– Bandwidth– Load– Reliability– MTU– Cost

37

BGP ( 1/2 )• BGP ( Border Gateway Protocol )

– RFC 1771, BGP version 4

• 唯一流傳的 EGP,但也被用於 IGP 。

BGPSystem

Router

Router

Autonomous System 1

Autonomous System 2

BGPSystem

Router

Router

BGPSystem

Router

Router

Autonomous System 3

38

BGP ( 2/2 )• 和其他 IGP 不同處:

– 使用 IGP 的同一 Autonomous Systems 內的 Router 互相信任,相信其他 Router’s Advertisement ,也廣播自己的 Routing Table 。

– BGP 不信賴其他 Autonomous Systems 的 Routers ,可以有 Policy 決定要送出那些部份 Routes ,以避免其他 Routers 的錯誤擴散。

39

3 Basic Functions of BGP

• 建立 2 BGP peers 間的 TCP 連線。– 包含做 Authentication 。

• 送出 Positive 和 Negative Reachability Information 。

• 提供 Ongoing Verification ,以確保網路連結之資料正確。

40

BGP Message Headers

– Marker : detect the loss of synchronization: and authenticate incoming message

– Length : total length of message

– Type : type code of message

Length Type

Marker

32bit

41

Types of BGP Messages

1 OPEN – 建立好 2 BGP peers 間的 TCP 連線,用 Open 宣告相關的參數。

2 UPDATE– 送出 Positive 和 Negative 路由訊息。

3 NOTIFICATION– 若發現錯誤,用 Notification 告知對方

4 KEEPALIVE – 做為線上的測試。

42

OPEN Message

• Initial exchange

Length

Authentication Data

BGP Identifier

Type: OPEN Version

Marker

My Autonomous System Hold Time

Auth. Code

32bit

43

UPDATE Message

• Transfer routing information

Length Type: UPDATE Path Attr -

Marker

Network 1

Network n

- Length

Path Attributes

32bit

44

NOTIFICATION Message

• Report the error

Length Type: NOTIFIC.

Marker

Error Code

Error subcodeData

32bit

45

KEEPALIVE Message

• Actively test peer connectivity

Length Type: KEEPALIVE

Marker

32bit

46

Features of BGP ( 1/2 )• Inter-autonomous system communication

• Not pure distance vector, also not pure link state protocol.

• Coordination among multiple BGP speakers

• Policy support

• Propagation of Reachability Information

• Next-hop paradigm

47

Features of BGP ( 2/2 )

• Path Information

• Incremental Updates

• Route Aggregation

• Reliable Transport

• Support for classless addressing

• Authentication

48

Hello

• Original Core Network (56kbps NSFNET) 使用的 IGP 。目前已走入歷史。

• 屬於 Distance Vector Protocol 。• 以 Delay 做為 Metric 。• 2 Functions of Hello :

– It synchronizes the clocks among these routers.

– It allows each router to compute the distance of the shortest delay path to destinations.使用 Timestamp 求 Round Trip Delay

49

Instability

• Problem of using delay metric is instability.

• Delay measurements are not fix values (i.e., it changed because of many conditions.)– Hardware clock drift (漂移 ), CPU load during

measurement, link-level synchronization

• Using hold down, threshold, K-out-of-N rules, Hello still has instable problem.

• Example: satellite vs. serial lines

50

Satellite vs. Serial Lines

• Satellite: high capacity, large delay

• Serial line: low capacity, small delay– Someone sends a lot of data on serial line. – Serial line traffic load and delay : change

to use satellite.– Serial line traffic load and delay : change

to use serial line.

Serial line

satellite

51

GGP

• GGP ( Gateway-to-Gateway Protocol )• Original Core Network 使用的 IGP 。目前已走入歷史( historic ) 。

• 使用 Distance Vector Protocol 。• 以 Hop Count 做為 Metric 。• 直接將資料封裝於 IP Datagram 之上。

52

RIP ( 1/2 )

• RIP ( Routing Information Protocol )• University of California at Berkeley 首先寫出 routed 做為內部網路交換 Routing Information 。它是使用 Xerox NS Routing Information Protocol 所寫成。

• 隨 FreeBSD , routed 隨之擴散。• 直到 1988 , RIP 的 RFC 1058 才出現。

• 適合小型區域網路。

53

RIP ( 2/2 )

• 屬於 Distance Vector Protocol 。• 以 Hop Count 做為 Metric 。• 使用 UDP , port=520 。• Broadcasting of responses• Update Routing table either at regular 30-

second intervals or triggered• RIP-2 (RFC 2453) support for CIDR,

authentication and multicast transmission

54

Initial Routing Table of RIP

14 1 -- 23 1 -- 78 1 --

A

14 1 -- 55 1 --

78 1 -- 92 1 --

55 1 -- 66 1 --

08 1 -- 66 1 --08 1 --

23 1 --

B

E

F

C

DNet 08

Net 66

Net 55

Net 78 Net 92

Net 14

Net 23

55

Next Routing Table of A08 2 E 14 1 -- 23 1 -- 55 2 B 78 1 -- 92 2 F

A

14 1 -- 55 1 --

78 1 -- 92 1 --

08 1 -- 23 1 --

B

E

F

C

DNet 08

Net 66

Net 55

Net 78 Net 92

Net 14

Net 23

56

Final Routing Table of RIP

08 2 E 14 1 -- 23 1 -- 55 2 B 66 3 E 78 1 -- 92 2 F

A

08 3 A 14 1 -- 23 2 A 55 1 -- 66 2 C 78 2 A 92 3 A

08 3 A 14 2 A 23 2 A 55 3 A 66 3 A 78 1 -- 92 1 --

08 2 D 14 2 B 23 3 D 55 1 -- 66 1 -- 78 3 B 92 4 B

08 1 -- 14 3 E 23 2 E 55 2 C 66 1 --78 3 E 92 4 E

08 1 -- 14 2 A 23 1 -- 55 3 A 66 2 D 78 2 A 92 3 A

B

E

F

C

DNet 08

Net 66

Net 55

Net 78 Net 92

Net 14

Net 23

57

Invalid Hop Count

• The distance of RIP is 1-16.– 1: connected directly– 15: max hop count– 16: invalid

• When a router is crash, its neighbors will never receive any information from it.

• A timer is set and the router is set to be invalid when the timer is expired.– Timer: 180 second in RIP.

58

Problems and Solutions of RIP (1/2)

• # of router traffic • Not Optimal

– Manager 可自行更改 metric

• Slow Convergence Problem– Triggered update– Hold down

• Broadcast Avalanche

59

Problems and Solutions of RIP (2/2)

• Routing Loop– Split horizon update– Poison reversion

• Count to Infinity– 以 hop count =16 表示 invalid 。– 當 path 很長, hop 數往上加,就會變成

16 ,就當作發生 loop ,移除此 path 。

60

Not Optimal in RIP

• The smallest hop count may be not the actually shortest route.

• Solution: RIP allows managers to increase hop count of path 2.

Path 1: Serial line, distance=5, faster

Path 2: Satellite, distance=4, slower

Router will choose Path 2.

61

Slow Convergence Problem (1/3)

• 但當 C's interface is down → 不再廣播此網路訊息 → 其他 Router A 必需等到 Timeout (180 sec) 才確定是 Disconnected ,設定 18.4.0.0 unreachable 。

• 如果其它 Router B 廣播他可到達此 Network ,則 Router A 會以 B 取代 C 。

A

B C18.4.0.0

62

Slow Convergence Problem (2/3)

• 但如果是以下的網路型態。若其他尚未 Timeout 的 Router D 不知網路已經不通,傳回 connected 的消息,又 Router A 要重新再 Timeout 一次。

D finds 18.4.0.0 timeout

A

D C

D sends its Routing Tables

A finds 18.4.0.0 timeout

18.4.0.0

A finds 18.4.0.0 timeout

63

Slow Convergence Problem (3/3)

• 然而當 router 廣播 a short route → 很快所有 router 都設定為此 routing path 。

• 好消息傳得快,壞消息傳得慢。• Solutions to Slow Convergence

– Triggered Update– Hold Down

64

Triggered Update

• 當 Router 測得某一網路不通的消息,就要馬上設為 invalid=16, 馬上 Broadcast ,而不會等到下一次的Advertisement 。

• 其他 Gateway 收到 path 故障的消息,也要馬上 Broadcast 。

• 這些 Routers 會同時廣播,會造成 Broadcast Avalanche 。

65

Broadcast Avalanche

• 當許多 routers 連結兩個網路。當有一網路不再暢通,所有 routers 都要快速將此壞消息傳送出去,形成 Broadcast Avalanche 。

• RIP 要求 routers 必需 wait a random time before triggered update 。

Network 1

Network 2

66

Hold Down (1/2)

• 當 Gateway 收到某一 Network 無法存取的訊息時 (R0 以 Triggered Update 方式通知 ) ,並強迫此 Disconnected 訊息保留一段時間 ( 一般 Hold down timer 設為 60 seconds) ,( Roughly )不再接收此網路的訊息,以保證其它所有 Routers 均已收到故障訊息。

• 加快收斂的速度。R1

R2 R0Network N0

67

Hold Down (2/2)

• R1 收到 R0 的廣播說 Network N0 無法存取,R1 將 N0 設為 invalid ,起動 Hold down timer 。在 Timeout 之前:– R1 收到其它 Router 如 R2 的訊息,是以較大的

Cost 連上 N0 , R1 不理會此訊息。– R1 收到其它 Router 如 R2 的訊息,是以較小的

Cost 連上 N0 , R1 將 N0 設為 valid ,移除 Hold down timer 。

– R1 收到 R0 的廣播說 N0 又可以連上, R1 將 N0 設為 valid ,移除 Hold down timer 。

68

Routing Loop (1/2)

• R1 發現 Net 1 已無法相連

• R1 未廣播 Net 1 is invalid 前,先收到 R2 的廣播 (Net1,2) :

• R2 收到 R1 的廣播:

Network 1R1 R2 R3

Network 1R1 R2 R3 R1 <Net1,1 direct>

R2 <Net1,2,R1>

R1 <Net1,3,R2> R2 <Net1,2,R1>

Network 1R1 R2 R3 R1 <Net1,3 R2>

R2 <Net1,4,R1>

R1 <Net1,16 invalid>

69

Routing Loop (2/2)

• A routing loop occurs.

• Finally, R1 收到 R2 的廣播, Net 1 之 distance= 16 ,變成 invalid ,視為無法到達。– RIP 設 Max hop value 為 15 、 IGRP 為

255 ( default=100 、 manager 會設為 50 )

Network 1R1 R2 R3 R1 <Net1,15 R2>

R2 <Net1,14,R1>

70

Split Horizon Update

• Gateway 會記錄所接收的資訊是從那一個Router 送來,不會再將更新後的資料回傳給此 Router 。– Ex: R2 是從 R1 得到 Net 1 的消息,所以

R2廣播時,是不會將 Net 1 的消息回傳給 R1 。

– 可消除上例中的 Loop 。• 但無法消除所有的 Loop 。

Network 1R1 R2 R3 R1 <Net1,1 direct>

R2 <Net1,2,R1>

71

Poison Reversion

• 規定 Router R2 由 R1 得知 Network 1 無法存取的訊息 (R1 以 Triggered Update 方式通知 ) , R2 必需將 metric 改為 invalid (16) , 同時回傳此訊息給 R1 。

Network 1R1 R2 R3 R1 <Net1,1 direct>

R2 <Net1,2,R1>

72

Other RIP Rules

• 同一個時間只能有一個 Router 進行 Advertisement ,其他 Routers 必需listen ,以避免 Broadcast Avalanche 。– Random number between 25-35 sec

• 若 Router 收到兩個 path 有相同的 cost ,則會選用先收到的那一條路徑。

73

RIP Message FormatsCommand(1) Version(1) Must be Zero(2)

Address Family Identifier(2) Must be Zero(2)

IP Address(4)

Must be Zero(4)

Must be Zero(4)

Metric(4)

RIP-1Command(1) Version(1) Routing Domain(2)

Address Family Identifier(2) Route Tag(2)

IP Address(4)

Subnet Mask(4)

Next Hop(4)

Metric(4)RIP-2Routing Domain : group routers in domains which share routing informationRoute Tag : propagate the information acquired from an EGPSubnet Mask : subnet mask for CIDR implementationNext Hop : next hop addresses that allows for optimization routes

74

IGRP ( Interior Gateway Routing Protocol ) (1/2)

• Cisco 於 1980 年代中期發展出的 Protocol 。• 屬於 Distance Vector Protocol 。• 以

Delay 、 Bandwidth 、 Loading 、 Reliability 、 Hop count 、 Ticks 、 cost 做為 Metric 。– Manager 決定 Weight 。以 Bandwidth 最為重要。

• 支援 Multipath Routing (最多 4 paths ),以提高網路的頻寬。

• 可支援較大的網路( Max hop value=255 )

75

IGRP ( Interior Gateway Routing Protocol ) (2/2)

• Timer setup :– 90 sec 傳送一次 Routing Table 。– 270 sec 沒有收到某一 neighbor 的訊息,設此

neighbor 為 invalid 。– 630 sec沒有收到某一 neighbor 的訊息,將此

neighbor 從 Routing table 中移除(稱為 Flush )。

• 也使用 Hold down ( 280 sec )、 Poison Reversion 、 Split Horizon update 。

76

EIGRP ( Enhanced Interior Gateway Routing Protocol )

• Cisco 改進 IGRP 的 new protocol 。• 屬於 Hybrid algorithm 。

77

IS-IS ( Intermediate System to Intermediate System )

• 一種 OSI 協定的 Protocol 。• T1 NSFNET Backbone 使用。目前仍有大型的 ISP 採用。

• 屬於 Link Status Protocol or Hybird 。

78

OSPF ( Open Shortest Path First )

• 由 IETF ( Internet Engineering Task Force )發展出的 Protocol 。

• 屬於 Link Status Protocol 。• 適用於大型網路。• 在判斷最佳路徑時,有考量

Bandwidth 、 Flow 、 Reliability 、 Security 。

• 第一個提出 Multiple routes ,因此可以做 Type of services 、 Load balancing 。

79

Areas of OSPF

BorderRouter

Router

Router

BorderRouter

RouterRouter

Router

Router Router

Backbone area

Area 1

Area 2

80

Goal of OSPF ( 1/2 )

• Open standard

• OSPF includes type of service routing.

• OSPF provides load balancing.

• Network can be partitioned to subsets.– Easy management– Permit network growth

• Authentication

81

Goal of OSPF ( 2/2 )

• OSPF supports classless routes.

• OSPF minimize broadcasts on multi-access network.

• Virtual network topology

• OSPF allows routers to exchange routing information learned form external sites.

82

Homework 3

1. 說明使用 Distance Vector Method 會遭遇的問題與解決的方法。

2. 對於 IGP 而言,你認為那些 Metric 適合用於計算到 Destination 的 Distance 。請簡單說明理由。

Recommended