41
CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Embed Size (px)

Citation preview

Page 1: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 1

CSS432 RoutingTextbook Ch4.2

Professor: Munehiro Fukuda

Augmented By Rob Nash

Page 2: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

IP on Scale

Addresses are hierarchicalReduces total information storage required to

forward packets Forward packets towards a single network

Then deliver to the host on that network

CSS 432: Routing 2

Page 3: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

IP on Heterogeneity

A under-demanding model: “best-effort”Due to this, IP has been shown to be

interoperable with any type of network Even ones invented after IP Carrier Pigeons?!

Zebra’s are so much cooler… http://portal.acm.org/citation.cfm?id=1147620

Don’t like IP? Aren’t compatible? Try tunneling.

CSS 432: Routing 3

Page 4: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Terms

IGPs – Interior Gateway Protocols BGPs – Border Gateway Protocols RIP - Route Information Protocol OSPF – Open Shortest Path First Protocol

ARP – Address Resolution ProtocolMaps IP addrs to physical adapters (MAC addrs)

CSS 432: Routing 4

Page 5: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

ARP

The mechanism that translates from IP GuIDs to underlying physical adapter addressingFrom IP to MAC, for example

CSS 432: Routing 5

Page 6: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 6

What Is Routing? Forwarding vs Routing

forwarding: To map a network # to an outgoing interface and some MAC

information in a forwarding table. To send a packet to an interface as consulting a local and static

forwarding table OSI Layer 2: data link level Implemented in specialized hardware (switch)

routing: To build a dynamic routing table To update table contents in a dynamic and distributed fashion OSI Layer 3: network level (internet) Using complex distributed algorithms

Page 7: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 7

Overview

Network as a Graph

Goal Find lowest cost path between two nodes

Static approach has shortcomings: Hardware failures Static network topology Static band width

Distributed, dynamic routing algorithms Distance vector routing (RIP) Link state routing (OSPF)

4

3

6

21

9

1

1D

A

FE

B

C

At Node A

E3F

E1E

E2D

E6C

E2B

Next HopCostDestination

Page 8: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 8

Distance Vector

Each node maintains a set of triples (Destination, Cost, NextHop)

Destination Cost Next hop

B 1 B

C 1 C

D ∞ -

E 1 E

F 1 F

G ∞ -

D

G

A

F

E

B

C

An initial distance vector at node A

Page 9: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 9

Distance Vector

Exchange updates directly connected neighbors periodically (on the order of several seconds) whenever table changes (called triggered update)

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

From B: (A, 1), (C, 1) From C: (A, 1), (B, 1), (D, 1) From E: (A, 1) From F: (A, 1), (G, 1)

Update local table if receive a “better” route From B: (C,1)

(C, 1, C) < (C, 2, B) From C: (D, 1)

(D, ∞, - ) > (D, 2, C) From F: (G, 1)

(G, ∞, - ) > (G, 2, F) Refresh existing routes; delete if they are expired

Destination Cost Next hop

B 1 B

C 1 C

D 2 C

E 1 E

F 1 F

G 2 F

D

G

A

F

E

B

C

Page 10: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 10

Routing Loop Failure-recovering scenario

F detects the link to G has failed F sets distance to G to ∞ and sends an update to A A sets distance to G to ∞ A receives periodic update from C with a 2-hop path to

G A sets distance to G to 3 and sends update to F F sets distance to G in 4 hops via A

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

D

G

A

F

E

B

C

To G in 2

To G in 1

To G in 3

To G in 4

(2) To E in ∞

(1) To E in 2

(3) To E in 3

(5) To E in 4

A

E

B

C(4) To E in ∞

(6) To E in 5

Page 11: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 11

Loop-Breaking Heuristics Set infinity to 16

Scheme: Stop an infinity loop in 16. Problem: No more 16 hops

Split horizon Scheme: Don’t send a neighbor the routing information learned from

this neighbor. Ex. B includes (E, 2, A) and thus doesn’t send (E, 3).

Split horizon with poison reverse Scheme: Send the routing information learned from this neighbor as

setting hop count to ∞. Ex. B includes (E, 2, A) and thus sends (E, ∞, A)

Problem: Its slow convergence speed

Page 12: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 12

Routing Information Protocol (RIP)

Cmd: 1-6 1: request 2: reply

Port: 520 Used by routed

Advertisement: 30secs Table entry timeout: 3 mins.

Deleted in 60secs Unix commands

Ripquery (BSD) Tcpdump (available in Linux, too) Snoop (Solaris)

frame header datagram heaader UDP header RIP Message

Cmd VerAddr family (net addr)

Address of net 1

Routing domain

Route tag

Subnet mask

Next hop address (1-16)Distance to net 1

Addr family (net addr)

Address of net 2

Route tag

Subnet mask

Next hop addressDistance to net 2 (1-16)

25 entries

Page 13: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 13

Link State Strategy

Reliable dissemination of link-state information to all nodes over a system.

Calculation of routes from the sum of all the accumulated link-state knowledge.

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

Page 14: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 14

Link State (cont)

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

A

C D

X

B

Page 15: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 15

Dijkstra’s Shortest-Path Algorithm* put (myself, 0, -) in the confirmed list Next = myself; while( true ) {

for each edge (X, distance, Next) where X is N’s neighbor if neither confirmed or tentative list has (X, distance, Y) where Y !

= Next, put (X, distance, Next) in the confirmed list if the tentative list has (X, distance, Y) where Y != Next, and (X,

distance, Y) > (X, distance, Next) Replace (X, distance, Y) with (X, distance, Next)

If the tentative list is empty, exit

else move the shortest edge (A, distance, B) from the tentative to the

confirmed list. Next = A

} //O((|E|+|V|) log |V|) time (which is dominated by O(|E| log |V|),

Page 16: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Forward Search From the Text

M = {me} For each node n in N - {me}

C(n) = l(me, n) //cost function init While ( N != M )

M = M U {w} s.t. C(w) is the min w for all (N-M) for each n in (N-M)

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

CSS 432: Routing 16

Page 17: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Another OSPF Algorithm

Initialize costs, and start with {me} While set M is not empty (tentative list)

Pick a node from the tentative list with the lowest cost = m

Move this to the confirmed list

List m’s neigbors, add each to tentative list If I have a neighbor route already in my tentative

list with a higher cost, replace that route

CSS 432: Routing 17

Page 18: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Graph Theory Visually….

CSS 432: Routing 18

http://en.wikipedia.org/wiki/Dijkstra's_algorithm

Page 19: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 19

Dijkstra’s Shortest-Path Algorithm

(A, 0, -)

(A, 0, -) (B, 5, B)(C, 10, C)(E, 2, E)(F, 4, F)

(A, 0, -)(E, 2, E)

(B, 5, B)(C, 10, C)(F, 4, F)

(A, 0, -)(E, 2, E)(F, 4, F)

(C, 10, C)(B, 5, B)

(A, 0, -)(E, 2, E)(F, 4, F)

(C, 10, C)(B, 5, B)(G, 15, F)

(A, 0, -)(E, 2, E)(B, 5, B)(F, 4, F)

(C, 8, B)(G, 18, B)

(A, 0, -)(E, 2, E)(B, 5, B)(F, 4, F)(C, 8, B)

(C, 8, B) (G, 15, F)

(A, 0, -)(E, 2, E)(B, 5, B)(F, 4, F)(C, 8, B)(D, 14, C)

(G, 15, F)

(A, 0, -)(E, 2, E)(B, 5, B)(F, 4, F)

(D, 14, C)(G, 15, F)

(A, 0, -)(E, 2, E)(B, 5, B)(F, 4, F)(C, 8, B)

(G, 15, F)

(A, 0, -)(E, 2, E)(B, 5, B)(F, 4, F)(C, 8, B)(D, 14, C)

(G, 15, F)

(A, 0, -)(E, 2, E)(B, 5, B)(F, 4, F)(C, 8, B)(D, 14, C)(G, 15, F)

D

G

A

F

E

B

C

11

5

10

3

2

6

4

213

Page 20: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 20

Open Shortest Path First Protocol (OSPF)

Header1. Hello (reachability)2. Database description (topology)3. Link status request4. Link status update5. Link status acknowledgment

Advertisement (header type=4) LS Age: = TTL Type=1: link cost b/w routers Link-State ID = Advertising Router Seq # from the same router Link ID = the other end route ID of link Link data = used if there are two or more links to the same router Metric = link cost Link type = P2P, ethernet, etc TOS = delay-sensitive, etc

frame header datagram heaader OSPF header OSPF Message

Version Type(=4)

AreaId

Message Length

Checksum

Authentication 0-3

Authentication type

SourceAddr

Authentication 4-7

# of link status advertisements

Link-state ID

LS Age Options

Advertising router

LS sequence number

Link Checksum Length

0 Flag 0 # of links

Type=1

Link ID

Link data

MetricNum TOSLink type

Optional TOS information

Page 21: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 21

OSPF Con’td

Gated daemon: directly uses IP datagram. Header Type2: Database description (topology)

message Used when the current topology has changed. Sent from an initialized router to another router which

has a topology information LS Sequence number

Used to determine which message is the latest Send a message with a new sequence number and

metric= ∞ when a router or a link fails.

Page 22: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Link State V.S. OSPF

Historically, OSPF has demonstrated more desirable propertiesLess bandwidth usage on large networks

After init, OSPF LPSs are deltas

Convergence speed Rip can take 10, 30, even 60 seconds

OSPF supports CIDR & netmasks

CSS 432: Routing 22

Page 23: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Practically Speaking…

RIP tells each direct neighbor about everyoneSo, neighbor-to-neighbor dissemination

OSPF (P) tells everyone about my direct neighbors“Reliable” Flooding to all

CSS 432: Routing 23

Page 24: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 24

Metrics Original ARPANET metric

measures number of packets enqueued on each link took neither latency or bandwidth into consideration

New ARPANET metric stamp each incoming packet with its arrival time (AT) record departure time (DT) when link-level ACK arrives, compute

Delay = (DT - AT) + Transmit + Latency if timeout, reset DT to departure time for retransmission link cost = average delay over some time period

Fine Tuning compressed dynamic range replaced Delay with link utilization

Page 25: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 25

Internet

Virtual Private Networks and Tunnels

BA

CompanyBranch

CompanyBranch

A B

C

A BApplicationLevel

RouterLevel

PhysicalNetwork Level

Source router Dest router

Router

10.0.0.1 20.0.0.1

10.0.0.1 20.0.0.1

20.0.0.110.0.0.1

To: 20.0.0.1

215.0.0.1

To: 10.0.0.2To: 215.0.0.1 To: 20.0.0.1

To: 20.0.0.1

To: 215.0.0.1

To: 215.0.0.1

To: 215.0.0.1 To: 20.0.0.1

Page 26: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 26

Why VPN?

1. Security The final destination/contents of packet cannot be

easily intercepted. 2. Routers

Routers with special features such as multicasting can form a virtual network.

3. No-IP packets Packets may be non-IP compatible packets.

4. Mobile IPs The final destination may be a mobile computer.

Page 27: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 27

Mobile IP

Homeagent

Internet

Mobile Host10.0.0.9(12.0.0.7)

DHCPserver

Mobile Host

Sending host

10.0.0.3

12.0.0.6

Invariant: Sending hosts want to use the same IP address mapped to a mobile host regardless of its location.

Questions How does the home agent intercept a packet that is

destined for the mobile agent? --- Use ARP How does the home agent then deliver the packet to the

mobile host? – Use DHCP and VPN

Page 28: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 28

Mobile IP (Cont’d)

Homeagent

Internet

Mobile Host10.0.0.9(12.0.0.7)

DHCPserver

Mobile Host

1. ARP request: What’s the physical addr corresponding to 10.0.0.9?

2. ARP response: sends back MAC of10.0.0.3 instead of 10.0.0.9

IP tunneling: wraps the packet inside an IPheader destined for the mobile host (12.0.0.7).

1. DHCP: receives a new IPin the foreign network.

Sending host

3. Packet request: sends a packet destined for 10.0.0.9to the home agent’s MAC address

2. Care-of-address: a mobile host informs itsHome agent of its original and new IPs.

10.0.0.3

12.0.0.6

Page 29: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS 432: Routing 29

Reviews RIP: distance vector, routing loop and breaking heurictics OSPF: link state, Dijkstra’s shortest path algorithm VPN and mobile IP

Exercises in Chapter 4 Ex. 15 (RIP) Ex. 18 (RIP) Ex. 28 (OSPF) Ex. 30 (OSPF)

Page 30: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS432: Applications 30

File Transfer Protocol

Transfer file to/from remote host Client/server model

Client: initiates a control TCP connection to a server on port 21. Client: sends a user ID and password as part of FTP commands. Server: authorizes the client Client: opens a data TCP connection to a server on port 20. Server: maintains state: current directory, earlier authentication.

A ftp client is allowed to initiate a transfer between two ftp servers.

FTP

localfile

system

remotefile

system

FTPserver

FTPclient

FTPuser

interface TCP port 20 for data transfer(not persistent)

TCP port 21 for control (persistent)

Page 31: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS432: Applications 31

FTP Commands <CRLF> delimits each command (and reply). Commands consist of four uppercase ASCII characters, some with

optional arguments: USER username : sends a user identification to server. PASS password : sends the user password to the server. PASV: requests the server to send back its IP and port on which it listens

to a data TCP connection from the user. LIST : ask the server to send back its current directory contents through

the data connection. RETR filename : gets a file from the current remote directory. STOR filename : stores a file into the current remote directory.

Each command is followed by a reply: 331 Username OK, password required 125 Data connection already open; transfer starting 425 Can't open data connection 452 Error writing file

FTP

Page 32: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS432: Applications 32

FTP ExampleFTP

[mfukuda@uw1-320-20]$ telnet ftp.tripod.com 21Trying 209.202.240.80…Connected to ftp.tripod.com (209.202.240.80).Escape character is ‘^]’.220 Welcome to Tripod FTP.USER css432331 Username set to css432. Now enter your password.PASS ********230 User ‘css432’ logged on.LIST425 Can’t open data connection for LIST.PASV227 Entering Passiv Mode (209,202,240,80,195,210)// Open another xterm and telnet 209.202.240.80 50130 (=195*256+210)// Trying 209.202.240.80…// Connected to ftp.tripod.com (209.202.240.80).// Escape character is ‘^]’.// drwxr-xr-x 1 css432 Tripod 0 Sep 15 21:22 cgi-bin// -rw-r--r-- 1 css432 Tripod 26169 Sep 16 18:28 ttcp.c// -rw-r--r-- 1 css432 Tripod 8236 Sep 15 21:22 index.htm// drwxr-xr-x 1 css432 Tripod 0 Sep 16 18:33 project // Connection closed by foreign host.LIST150 Opening ASCII mode data connection for LIST.226 Transfer complete.QUIT221 GoodbyeConnection closed by foreign host.[mfukuda@uw1-320-20]$ _

Page 33: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS432: Applications 33

FTP passive mode

FTPserver

FTPclient

TCP port 21 for control (persistent)

Client request: connect( ), USER, PASS, LIST

Server Reply: 220 server ready, 331 send password, 230 login ok, 425 connection timeout

TCP port 20 for data transfer (one time)

FTPserver

FTPclient

TCP port 21 for control (persistent)

Client request: connect( ), USER, PASS, PASV, LIST

Server Reply: 220 server ready, 331 send password, 230 login ok,227 Entering Passive Mode (140,142,12,173,195,54), 226 complete

TCP port 195*256 + 54 = 49974 for data transfer (one time)

data

Page 34: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

CSS432: Applications 34

FTP proxy command

FTPServer

2

FTPServer

1

FTPclient

(1) USER, PASS, SYST (2) USER, PASS, SYST(3) TYPE I, PASV

(4) TYPE I, PORT (140,142,12,173,195,54),STOR file(5) RETR file

(3’) 227 Entering Passive Mode(140,142,12,173,195,54)

TCP port 195*256 + 54 = 49974 for data transfer (one time)

data

ftp> open server1ftp> proxy open server2ftp> proxy get file

…(1)…(2)…(3)~(5)

Page 35: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Final Project Introduction

FTP project is live on the siteWe’ll worry with the last few steps during

lecture Signing our archives, etc.

CSS 432: Routing 35

Page 36: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

FTP is Fun Transfer Protocol!

(If you tend to think bytes are fun) We’re making a client to interface with an

existing server (a class of servers)

CSS 432: Routing 36

Page 37: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Remote Tips

You can always remote into the lab

You could install Ubuntu on a USB stickHas a good ftp server to play with

https://help.ubuntu.com/6.06/ubuntu/serverguide/C/ftp-server.html

You write the client to interact with this server

CSS 432: Routing 37

Page 38: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

General Tips Observe Dr. Fukuda’s output

It gives away hints left and right

RFC 959 – light reading

Telnet to port 21Act as the client!

For example, what does the server return when you issue a “USER” or “PASV” request?

CSS 432: Routing 38

Page 39: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Telnet Line Terminators

Carridge-Return, Line Feed

Find this out

CSS 432: Routing 39

Page 40: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

How Many Lines Of Code?

Decompose the projectA network component

Resue code here from previous projects

A filesystem component Reuse code here if you have it!

From Pseudocode to C, or Pseudocode->intermediary language -> C

CSS 432: Routing 40

Page 41: CSS 432: Routing 1 CSS432 Routing Textbook Ch4.2 Professor: Munehiro Fukuda Augmented By Rob Nash

Overarching Strategy

(0) Introduce yourself to the server (1) Relay a request to the server (2) Get a socket for data transmission

See PASV (3) Exchange data in ASCII or Binary (4) Loop to (1) or QUIT

CSS 432: Routing 41