28
CS 145A CS 145A Case Study: Case Study: Simplified BGP Simplified BGP Finite State Finite State Machine Machine Netlab.caltech.edu/course Netlab.caltech.edu/course

CS 145A Case Study: Simplified BGP Finite State Machine

  • Upload
    catori

  • View
    62

  • Download
    0

Embed Size (px)

DESCRIPTION

CS 145A Case Study: Simplified BGP Finite State Machine. Netlab.caltech.edu/course. Today. Brief Introduction of routing protocols An example of Finite State Machine Lab 3. What does the Internet look like?. Example: (/sbin/traceroute) C:\>tracert cwis.usc.edu - PowerPoint PPT Presentation

Citation preview

Page 1: CS 145A Case Study:  Simplified BGP Finite State Machine

CS 145ACS 145ACase Study: Case Study:

Simplified BGP Simplified BGP Finite State Finite State

MachineMachineNetlab.caltech.edu/courseNetlab.caltech.edu/course

Page 2: CS 145A Case Study:  Simplified BGP Finite State Machine

TodayToday Brief Introduction of routing Brief Introduction of routing

protocolsprotocols An example of Finite State MachineAn example of Finite State Machine Lab 3Lab 3

Page 3: CS 145A Case Study:  Simplified BGP Finite State Machine

What does the Internet What does the Internet look like?look like?

Example: (/sbin/traceroute) Example: (/sbin/traceroute) C:\>tracert cwis.usc.eduC:\>tracert cwis.usc.eduTracing route to cwis.usc.edu [128.125.253.146]Tracing route to cwis.usc.edu [128.125.253.146]1 <1 ms Jorgensen-RSM-44.caltech.edu [131.215.44.253]1 <1 ms Jorgensen-RSM-44.caltech.edu [131.215.44.253]2 <1 ms Booth-border.ilan.caltech.edu [131.215.254.254]2 <1 ms Booth-border.ilan.caltech.edu [131.215.254.254]3 <1 ms CalREN-Caltech.caltech.edu [192.41.208.49]3 <1 ms CalREN-Caltech.caltech.edu [192.41.208.49]4 <1 ms JPL--CIT.POS.calren2.net [198.32.248.5]4 <1 ms JPL--CIT.POS.calren2.net [198.32.248.5]5 1 ms UCLA--JPL.POS.calren2.net [198.32.248.1]5 1 ms UCLA--JPL.POS.calren2.net [198.32.248.1]6 1 ms ISI--UCLA.POS.calren2.net [198.32.248.29]6 1 ms ISI--UCLA.POS.calren2.net [198.32.248.29]7 2 ms USC--ISI.POS.calren2.net [198.32.248.25]7 2 ms USC--ISI.POS.calren2.net [198.32.248.25]8 3 ms rtr43-c2-gw.usc.edu [128.125.251.66]8 3 ms rtr43-c2-gw.usc.edu [128.125.251.66]9 2 ms rtr-gw-1.usc.edu [128.125.254.1]9 2 ms rtr-gw-1.usc.edu [128.125.254.1]10 2 ms cwis.usc.edu [128.125.253.146]10 2 ms cwis.usc.edu [128.125.253.146]

Page 4: CS 145A Case Study:  Simplified BGP Finite State Machine

Topology of the NetworkTopology of the Network131.215.44.214

131.215.44.253

131.215.254.254

192.41.

208.49

198.32.

248.5198.32.

248.1198.32.

248.29

198.32.

248.25

128.125.251.66

128.125.253.146

128.125.254.1

Page 5: CS 145A Case Study:  Simplified BGP Finite State Machine

The Journey of a packet (1)The Journey of a packet (1)131.215.44.214-131.215.44.214->131.215.44.253>131.215.44.253

131.215.44.214

131.215.44.253 131.215.

254.254

192.41.

208.49

198.32.

248.5198.32.

248.1198.32.

248.29

198.32.

248.25

128.125.251.66

128.125.253.146

128.125.254.1

Page 6: CS 145A Case Study:  Simplified BGP Finite State Machine

The Journey of a packet (2)The Journey of a packet (2)131.215.44.253131.215.44.253

IPIP

MACMAC

PhysicPhysic Get a packet From EthernetGet a packet From EthernetIt’s for 00:90:6D:E7:D4:00. It’s for 00:90:6D:E7:D4:00.

That’s me. I should accept it.That’s me. I should accept it.

131.215.44.214

131.215.44.253

131.215.254.254

Page 7: CS 145A Case Study:  Simplified BGP Finite State Machine

The Journey of a packet (2)The Journey of a packet (2)131.215.44.253131.215.44.253

IPIP

MACMAC ““OK, I am 00:90:6D:E7:D4:00”OK, I am 00:90:6D:E7:D4:00”Pass the packet to IPPass the packet to IP

PhysicPhysic Get a packet from ethernet for : 00:Get a packet from ethernet for : 00:90:6D:E7:D4:0090:6D:E7:D4:00

131.215.44.214

131.215.44.253

131.215.254.254

Page 8: CS 145A Case Study:  Simplified BGP Finite State Machine

The Journey of a packet (2)The Journey of a packet (2)131.215.44.253131.215.44.253

IPIP [IP] Header: [IP] Header: From 131.215.44.214 to From 131.215.44.214 to

“128.125.253.146”“128.125.253.146”““Should go to next router: Should go to next router:

131.215.254.254”131.215.254.254”MACMAC ““OK, I am 00:90:6D:E7:D4:00”OK, I am 00:90:6D:E7:D4:00”

Pass the packet to IPPass the packet to IPPhysicPhysic Get a packet from ethernet for: 00:Get a packet from ethernet for: 00:90:6D:E7:D4:0090:6D:E7:D4:00

131.215.44.214

131.215.44.253

131.215.254.254

Page 9: CS 145A Case Study:  Simplified BGP Finite State Machine

Necessary Information Necessary Information (1)(1)

Where shall I pass the packet, for a given Where shall I pass the packet, for a given destination IP address? – Routing Tabledestination IP address? – Routing Table Exmaple:Exmaple:[weixl@orchestra:~]> route[weixl@orchestra:~]> route

DestinatiDestinationon

GatewayGateway Gen-maskGen-mask FlaFlagsgs

InterfaInterfacece

131.215.131.215.44.044.0

** 255.255.2255.255.255.055.0

UU Eth0Eth0

127.0.0.0 127.0.0.0 ** 255.0.0.0255.0.0.0 UU lolodefault default 131.215.44131.215.44

.254.2540.0.0.00.0.0.0 UFUF Eth0Eth0

Page 10: CS 145A Case Study:  Simplified BGP Finite State Machine

How can the How can the routers know the routers know the

routing routing information?information?

Page 11: CS 145A Case Study:  Simplified BGP Finite State Machine

How?How? Manually add/delete routing entriesManually add/delete routing entries Automatically exchange routing Automatically exchange routing

information between routers.information between routers.

Page 12: CS 145A Case Study:  Simplified BGP Finite State Machine

Routing ProtocolRouting ProtocolA: hi, are you there?A: hi, are you there?B: yes.B: yes.A: Can I tell you a piece of news?A: Can I tell you a piece of news?B: Sure.B: Sure.A: I have a way to get to www.usc.edu.A: I have a way to get to www.usc.edu.B: ok. I will send you all the packets that are going to wB: ok. I will send you all the packets that are going to www.usc.edu. ww.usc.edu. ……B: Hi, Can I tell you some news, too?B: Hi, Can I tell you some news, too?A: Yes!A: Yes!B: I can connect to all the machines in “cs.caltech.edB: I can connect to all the machines in “cs.caltech.edu”u”A: ok. I will send you all the packets that are going to A: ok. I will send you all the packets that are going to “cs.caltech.edu”.“cs.caltech.edu”.…………

131. 215.44. 253

(B)

131. 215.254. 254

(A)

Page 13: CS 145A Case Study:  Simplified BGP Finite State Machine

Routing ProtocolRouting ProtocolA to C: hi, are you there?A to C: hi, are you there?......A to C: hi, are you there?A to C: hi, are you there?……A to B: I think C is down. And from A to B: I think C is down. And from

now on, I cannot contact USC.now on, I cannot contact USC.B: OK. I will try other paths when I B: OK. I will try other paths when I

get packets for USC.get packets for USC.……

131. 215.44. 253

(B)

131. 215.254. 254

(A)

192. 41.208. 49

(C)

Page 14: CS 145A Case Study:  Simplified BGP Finite State Machine

Routing ProtocolRouting Protocol Good: Efficiently broadcast up-to-Good: Efficiently broadcast up-to-

date routing informationdate routing information Bad: Rumor may be broadcast Bad: Rumor may be broadcast

efficiently, too.efficiently, too. Argument: If the majority is good…Argument: If the majority is good… The algorithm should be correct in The algorithm should be correct in

distributed environments.distributed environments.

Page 15: CS 145A Case Study:  Simplified BGP Finite State Machine

Routing ProtocolsRouting Protocols Autonomous SystemAutonomous System

Page 16: CS 145A Case Study:  Simplified BGP Finite State Machine

Routing ProtocolsRouting Protocols Inside Autonomous System: Inside Autonomous System:

Embrace the Freedom!Embrace the Freedom!• RIP (Routing Information Protocol)RIP (Routing Information Protocol)• OSPF (Open Shortest Path First)OSPF (Open Shortest Path First) Between Autonomous System Between Autonomous System

(Exterior Gateway Protocol): More (Exterior Gateway Protocol): More consideration…consideration…

• BGP (Border Gateway Protocol)BGP (Border Gateway Protocol)

Page 17: CS 145A Case Study:  Simplified BGP Finite State Machine

Border Gateway Border Gateway Protocol-4Protocol-4

Inter-Autonomous System Inter-Autonomous System CommunicationCommunication

Propagate Path InformationPropagate Path Information Support PolicySupport Policy Incremental UpdatesIncremental Updates Assume reliable transmission (TCP)Assume reliable transmission (TCP) http://www.ietf.org/rfc/rfc1771.txthttp://www.ietf.org/rfc/rfc1771.txt

Page 18: CS 145A Case Study:  Simplified BGP Finite State Machine

Simplified BGP State Simplified BGP State MachineMachineEvent/ Acti on Li st

1 Request for Connecti on2 Connecti on Succeeded3 Connecti on Fai l ed4 "Open" Recei ved5 "KeepAl i ve" Recei ved6 "Update" Recei ved7 "Noti fi cati on" Recei ved8 "Open" Sent9 "KeepAl i ve" Sent10 "Update" Sent11 "Noti fi cati on" Sent12 Cl ose connecti on13 Any Error, i ncl udi ng:TCP operat i on error,Packets f ormat error,Packets type error.

14 KeepAl i ve Ti mer Expi re15 KeepAl i ve Ti mer Reset16 Hol dOn Ti mer Reset17 Hol dOn Ti mer Expi re

-/10

Idle

Active OpenSent

OpenConfirmed

EstablishedConnect

-/81/-

4/9

5/- (15,16)3/12

2/-4/8, 9

6/-Any StateOther thanIdle/Active/

Connect IdleEstablished

Page 19: CS 145A Case Study:  Simplified BGP Finite State Machine

BGP PacketsBGP Packets Packets Format:Packets Format:

00-- 1515thth Byte: FF (hexadecimal) Byte: FF (hexadecimal) 16-1716-17thth Byte: Unsigned number, Length of Byte: Unsigned number, Length of the Packet (>=19)the Packet (>=19) 1818thth Byte: Packet Type: Byte: Packet Type:

11 OPENOPEN 22 UPDATEUPDATE 33 NOTIFICATIONNOTIFICATION 44 KEEPALIVEKEEPALIVE

1919thth Byte to the end of the Packet: Routing Data Byte to the end of the Packet: Routing Data

Page 20: CS 145A Case Study:  Simplified BGP Finite State Machine

Detailed SpecificationDetailed Specification http://www.ietf.org/rfc/rfc1771.txthttp://www.ietf.org/rfc/rfc1771.txt

Appendix I (page 47)Appendix I (page 47)

Page 21: CS 145A Case Study:  Simplified BGP Finite State Machine

Lab 3Lab 3

Page 22: CS 145A Case Study:  Simplified BGP Finite State Machine

Lab 3 - TaskLab 3 - Task Implement a (simplified) simplified Implement a (simplified) simplified

BGP Finite State Machine:BGP Finite State Machine:• Ignore the timersIgnore the timers• Ignore the details of Routing DataIgnore the details of Routing Data

Page 23: CS 145A Case Study:  Simplified BGP Finite State Machine

Lab3 - Finite State Lab3 - Finite State MachineMachine

Event/ Acti on Li st1 Request for Connecti on2 Connecti on Succeeded3 Connecti on Fai l ed4 "Open" Recei ved5 "KeepAl i ve" Recei ved6 "Update" Recei ved7 "Noti fi cati on" Recei ved8 "Open" Sent9 "KeepAl i ve" Sent10 "Update" Sent11 "Noti fi cati on" Sent12 Cl ose connecti on13 Any Error, i ncl udi ng:TCP operat i on error,Packets f ormat error,Packets type error.

-/10

Idle

Active OpenSent

OpenConfirmed

EstablishedConnect

-/81/-

4/9

5/-3/12

2/-4/8, 9

6/-Any StateOther thanIdle/Active/

Connect Idle

Page 24: CS 145A Case Study:  Simplified BGP Finite State Machine

Lab 3 - RequirementsLab 3 - Requirements The implementation is based on TCP.The implementation is based on TCP. The implementation is able to actively The implementation is able to actively

connect to multiple machines and it is able connect to multiple machines and it is able to accept requests from multiple machines.to accept requests from multiple machines.

The implementation allows at most one The implementation allows at most one connection from one machine (identified by connection from one machine (identified by IP / hostname).IP / hostname).

For each connection, the implementation For each connection, the implementation implements the Lab3 Finite State Machine.implements the Lab3 Finite State Machine.

Page 25: CS 145A Case Study:  Simplified BGP Finite State Machine

Lab 3 - DetailsLab 3 - Details A program “server” A program “server” Read from a file called “server.conf”. Format Read from a file called “server.conf”. Format of “server.conf”:of “server.conf”:• (1(1stst line:) Listen_Port Connection_Num(N) line:) Listen_Port Connection_Num(N)• (2(2ndnd line:) IP_1 Port_1 line:) IP_1 Port_1• (…)(…)• (N+1(N+1stst line:) IP_N Port_N line:) IP_N Port_N The server should read from “server.conf”, liThe server should read from “server.conf”, listen to Listen_Port for new connection, at the ssten to Listen_Port for new connection, at the same time, actively connect the specified machiame time, actively connect the specified machines (IP_1:Port_1, IP_2:Port_2, … IP_N:Port_N)nes (IP_1:Port_1, IP_2:Port_2, … IP_N:Port_N)

Page 26: CS 145A Case Study:  Simplified BGP Finite State Machine

Lab 3 - Possible Lab 3 - Possible ProblemsProblems

Implementation of Finite State Implementation of Finite State MachineMachine

Check the errors (including Check the errors (including operation errors and Packet errors)operation errors and Packet errors)

Multiple connections from the same Multiple connections from the same machinemachine

Page 27: CS 145A Case Study:  Simplified BGP Finite State Machine

Lab 3 - TipsLab 3 - Tips Re-Use the codes in Lab 1Re-Use the codes in Lab 1 How to implement the Finite State How to implement the Finite State

Machine?Machine?• ““if … then…”if … then…”• ““State transition table”State transition table” How to test?How to test? Incremental DevelopmentIncremental Development DON’T START AT THE LAST MOMENT!DON’T START AT THE LAST MOMENT!

Page 28: CS 145A Case Study:  Simplified BGP Finite State Machine

Lab 3 Lab 3 Due: Dec 1Due: Dec 1stst (Sunday) 23:59:59 (Sunday) 23:59:59 Email: Email: [email protected]@caltech.edu GradingGrading TA hours: TA hours: Tue / Thu (20:00 – 22:00) JRG 170Tue / Thu (20:00 – 22:00) JRG 170ExceptExcept: Nov.19 / Nov.21: Nov.19 / Nov.21