EEC484584 Computer Networks Lecture 12 Wenbing Zhao wenbingieee

  • Slides: 32
Download presentation
EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao wenbing@ieee. org (Part of the slides are

EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao [email protected] org (Part of the slides are based on Drs. Kurose & Ross’s slides for their Computer Networking book, and on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall) Spring Semester 2006 EEC-484/584: Computer Networks

2 Outline • • Distance vector routing Hierarchical routing Broadcast routing Internet protocol –

2 Outline • • Distance vector routing Hierarchical routing Broadcast routing Internet protocol – Header – Fragmentation Spring Semester 2006 EEC-484/584: Computer Networks 2

3 Distance Vector Routing • Also called Bellman-Ford or Ford-Fulkerson • Each router maintains

3 Distance Vector Routing • Also called Bellman-Ford or Ford-Fulkerson • Each router maintains a table (a vector), giving best known distance to each destination and which line to use to get there – Table is updated by exchanging info with neighbors – Table contains one entry for each router in network with • Preferred outgoing line to that destination • Estimate of time or distance to that destination – Once every T msec, router sends to each neighbor a list of estimated delays to each destination and receives same from those neighbors Spring Semester 2006 EEC-484/584: Computer Networks 3

4 Distance Vector Routing A d(A, Y) Y d(A, X) X d(X, Z) At

4 Distance Vector Routing A d(A, Y) Y d(A, X) X d(X, Z) At router A, for Z Compute d(A, X) + d(X, Z) and d(A, Y) + d(Y, Z), take minimum d(Y, Z) Z d(A, Z) = min {d(A, v) + d(v, Z) } where min is taken over all neighbors v of A Spring Semester 2006 EEC-484/584: Computer Networks 4

from x 0 2 7 y ∞∞ ∞ z ∞∞ ∞ node y table

from x 0 2 7 y ∞∞ ∞ z ∞∞ ∞ node y table cost to x y z from d(x, y) = min{d(x, y) + d(y, y), d(x, z) + d(z, y)} = min{2+0 , 7+1} = 2 node x table cost to x y z d(x, z) = min{d(x, y) + d(y, z), d(x, z) + d(z, z)} = min{2+1 , 7+0} = 3 x 0 2 3 y 2 0 1 z 7 1 0 x ∞ ∞ ∞ y 2 0 1 z ∞∞ ∞ node z table cost to x y z from x x ∞∞ ∞ y ∞∞ ∞ z 71 0 Spring Semester 2006 2 y 7 1 z time EEC-484/584: Computer Networks 5 5

Spring Semester 2006 from from from d(x, z) = min{d(x, y) + d(x, y)

Spring Semester 2006 from from from d(x, z) = min{d(x, y) + d(x, y) = min{d(x, y) + d(y, y), d(x, z) + d(z, y)} d(y, z), d(x, z) + d(z, z)} = min{2+0 , 7+1} = 2 = min{2+1 , 7+0} = 3 node x table cost to x y z x 0 2 7 x 0 2 3 y ∞∞ ∞ y 2 0 1 z 7 1 0 z ∞∞ ∞ z 3 1 0 node y table cost to x y z y x y z 2 1 x ∞ ∞ ∞ x 0 2 7 x 0 2 3 x z y 2 0 1 7 y 2 0 1 z ∞∞ ∞ z 7 1 0 z 3 1 0 node z table cost to x y z x 0 2 7 x 0 2 3 x ∞∞ ∞ y 2 0 1 y ∞∞ ∞ z 3 1 0 z 71 0 time EEC-484/584: Computer Networks 6 6

7 Distance Vector Routing • Delay A to B 12 ms, to C 25

7 Distance Vector Routing • Delay A to B 12 ms, to C 25 ms, to D 40 ms, to G 18 ms • Delay J to A 8 ms, to I 10 ms, to H 12 ms, to K 6 ms • Delay J to A to G 8+18 = 26 ms to I to G 10+31 = 41 ms to H to G 12+6=18 ms to K to G 6+31=37 ms Spring Semester 2006 EEC-484/584: Computer Networks 7

8 Distance Vector Routing • Good news travels fast • Bad news travels slow

8 Distance Vector Routing • Good news travels fast • Bad news travels slow • Count to infinity problem: Takes too long to converge upon router failure × Routers’ knowledge about the cost to A Spring Semester 2006 EEC-484/584: Computer Networks 8

9 Distance Vector Routing: Exercise • Consider the subnet shown below. Distance vector routing

9 Distance Vector Routing: Exercise • Consider the subnet shown below. Distance vector routing is used, and the following vectors have just come in to router C: from B: (5, 0, 8, 12, 6, 2); from D: (16, 12, 6, 0, 9, 10); and from E: (7, 6, 3, 9, 0, 4). The measured delays to B, D, and E, are 6, 3, and 5, respectively. What is C's new routing table? Give both the outgoing line to use and the expected delay. Spring Semester 2006 EEC-484/584: Computer Networks 9

10 Hierarchical Routing • Bigger network => bigger routing table • Use hierarchical structure

10 Hierarchical Routing • Bigger network => bigger routing table • Use hierarchical structure similar to telephone network – Regions: router knows details of how to route packets within its region, does not know internals of other regions – Clusters of regions, zones of clusters, groups of zones • Tradeoff: savings in memory space may result in longer path Spring Semester 2006 EEC-484/584: Computer Networks 10

11 Hierarchical Routing Spring Semester 2006 EEC-484/584: Computer Networks 11

11 Hierarchical Routing Spring Semester 2006 EEC-484/584: Computer Networks 11

12 Broadcast Routing • Deliver packets from source to all other nodes • Source

12 Broadcast Routing • Deliver packets from source to all other nodes • Source duplication is inefficient: duplicate R 1 duplicate creation/transmission R 1 duplicate R 2 R 3 R 4 R 3 source duplication Spring Semester 2006 EEC-484/584: Computer Networks R 4 in-network duplication 12

13 In-network Duplication • Flooding: when node receives broadcast packet, sends copy to all

13 In-network Duplication • Flooding: when node receives broadcast packet, sends copy to all neighbors – Problems: cycles & broadcast storm • Controlled flooding: node only broadcasts packet if it hasn’t broadcast same packet before – Node keeps track of packet ids already broadcasted – Or reverse path forwarding (RPF): only forward packet if it arrived on shortest path between node and source • Spanning tree – No redundant packets received by any node Spring Semester 2006 EEC-484/584: Computer Networks 13

14 Flooding • Idea: every incoming packet is sent out on every outgoing line

14 Flooding • Idea: every incoming packet is sent out on every outgoing line except the one it arrived on • Advantage: flooding always chooses shortest path, no other algorithm has shorter delay • Disadvantage: generates lots of duplicates Spring Semester 2006 EEC-484/584: Computer Networks 14

15 How to Reduce Duplicates • Include a hop counter in the header of

15 How to Reduce Duplicates • Include a hop counter in the header of each packet • Decrement the counter at each hop • Packet discarded when counter reaches 0 Spring Semester 2006 EEC-484/584: Computer Networks 15

16 How to Reduce Duplicates • The router assigns a sequence number in each

16 How to Reduce Duplicates • The router assigns a sequence number in each packet it receives from its hosts – Each router has a list for each source router telling which sequence numbers originating at that source have already been seen – Each list augmented with counter k, meaning all sequence numbers up through k have been seen – If packet is duplicate, router discards it A 88, 90, 92 Source k router Spring Semester 2006 EEC-484/584: Computer Networks 16

17 Reverse Path Forwarding • Rely on router’s knowledge of unicast shortest path from

17 Reverse Path Forwarding • Rely on router’s knowledge of unicast shortest path from it to sender • Each router has simple forwarding behavior: if (datagram received on incoming link on shortest path back to center) then flood datagram onto all outgoing links else ignore datagram

18 Reverse Path Forwarding • Assumption: – I is the sender – The cost

18 Reverse Path Forwarding • Assumption: – I is the sender – The cost for each hop is 1 – Optimal route is that gives the min hop count A subnet Spring Semester 2006 EEC-484/584: Computer Networks 18

19 Reverse Path Forwarding • Hop 1: I sends packets to F, H, J,

19 Reverse Path Forwarding • Hop 1: I sends packets to F, H, J, N; each arrives on preferred 1 path to I 2 • Hop 2: F sends packets to 3 A, D; H to E, K; J to G, O; 4 N to M, O • All are previously unvisited 5 routers; All but E, K, O arrive on preferred path • Hop 3: A sends packet to E; D to C, G; G to D; O to N; M to K; Only E, C, K arrive on preferred path Spring Semester 2006 EEC-484/584: Computer Networks 19

20 Exercise – Broadcast Routing • Looking at the subnet shown below, how many

20 Exercise – Broadcast Routing • Looking at the subnet shown below, how many packets are generated by a broadcast from B, using (a) flooding with duplicate control through sequence number? (b) reverse path forwarding? Spring Semester 2006 EEC-484/584: Computer Networks 20

21 Design Principles for Internet • Make sure it works – Build prototypes first

21 Design Principles for Internet • Make sure it works – Build prototypes first • Keep it simple – When in doubt, use the simplest solution • Make clear choices – If there are several ways of doing the same thing, choose one • Exploit modularity – Use protocol stacks, each of whose layers is independent of all the other ones Spring Semester 2006 EEC-484/584: Computer Networks 21

22 Design Principles for Internet • Expect heterogeneity – Different types of hardware, transmission

22 Design Principles for Internet • Expect heterogeneity – Different types of hardware, transmission facilities, and applications will occur on any large network • Avoid static options and parameters – Have the sender and receiver negotiate a value • Look for a good design; it need not be perfect • Be strict when sending and tolerant when receiving • Think about scalability • Consider performance and cost Spring Semester 2006 EEC-484/584: Computer Networks 22

23 Collection of Subnetworks The Internet is an interconnected collection of many networks, or

23 Collection of Subnetworks The Internet is an interconnected collection of many networks, or Autonomous Systems (ASes) Spring Semester 2006 EEC-484/584: Computer Networks 23

24 The Network Layer in Internet Host, router network layer functions: Transport layer: TCP,

24 The Network Layer in Internet Host, router network layer functions: Transport layer: TCP, UDP Network layer IP protocol • addressing conventions • datagram format • packet handling conventions Routing protocols • path selection • RIP, OSPF, BGP forwarding table ICMP protocol • error reporting • router “signaling” Link layer physical layer Spring Semester 2006 EEC-484/584: Computer Networks 24

IP Datagram Format IP protocol version number header length (bytes) “type” of data max

IP Datagram Format IP protocol version number header length (bytes) “type” of data max number remaining hops (decremented at each router) upper layer protocol to deliver payload to How much overhead with TCP? • • • 20 bytes of TCP 20 bytes of IP = 40 bytes + app layer overhead Spring Semester 2006 32 bits ver head. type of len service length fragment 16 -bit identifier flgs offset upper time to header layer live checksum 25 total datagram length (bytes) for fragmentation/ reassembly 32 bit source IP address 32 bit destination IP address Options (if any) data (variable length, typically a TCP or UDP segment) EEC-484/584: Computer Networks E. g. timestamp, record route taken, specify list of routers to visit. 25

26 The IPv 4 Header • Version – 4 • IHL – length of

26 The IPv 4 Header • Version – 4 • IHL – length of header in 32 -bit words – Min 5, max 15 – i. e. , 60 bytes • Type of service - to distinguish different classes of service – To accommodate differentiated services (which class this packet belongs to) • Total length – header and data 65, 535 (216 -1) bytes • Identification – allows destination to determine which datagram a fragment belongs to Spring Semester 2006 EEC-484/584: Computer Networks 26

27 The IPv 4 Header • Time to live – counter to limit packet

27 The IPv 4 Header • Time to live – counter to limit packet lifetimes – Max lifetime 255 sec – Packet is destroyed when counter becomes 0 • Protocol – which transport layer protocols being used • Header checksum – verifies header Spring Semester 2006 EEC-484/584: Computer Networks 27

28 The IPv 4 Header • Options – security, error reporting, etc. – Some

28 The IPv 4 Header • Options – security, error reporting, etc. – Some of the IP options Spring Semester 2006 EEC-484/584: Computer Networks 28

29 IP Fragmentation • Fragmentation Flags – DF – tells routers “Don’t Fragment” –

29 IP Fragmentation • Fragmentation Flags – DF – tells routers “Don’t Fragment” – MF – More Fragments. All fragments except last have this set. Used as check against total length • Fragment offset – where in datagram this fragment belongs – All fragments (payload in the IP packet) except last must be multiples of 8 bytes – The number of 8 byte blocks is called Number of Fragment Blocks (NFB) – The unit of the offset is NFB Spring Semester 2006 EEC-484/584: Computer Networks 29

30 IP Fragmentation & Reassembly • Network links have MTU (max. transfer size) -

30 IP Fragmentation & Reassembly • Network links have MTU (max. transfer size) - largest possible link-level frame. – different link types, different MTUs • Large IP datagram divided (“fragmented”) within net – one datagram becomes several datagrams – “reassembled” only at final destination – IP header bits used to identify, order related fragments Spring Semester 2006 fragmentation: in: one large datagram out: 3 smaller datagrams reassembly EEC-484/584: Computer Networks 30

31 IP Fragmentation and Reassembly Example • 4000 byte datagram • MTU = 1500

31 IP Fragmentation and Reassembly Example • 4000 byte datagram • MTU = 1500 bytes 1480 bytes in data field offset = 1480/8 Spring Semester 2006 length ID =4000 =x MF =0 offset =0 One large datagram becomes several smaller datagrams length ID =1500 =x MF =1 offset =0 length ID =1500 =x MF =1 offset =185 length ID =1040 =x MF =0 offset =370 EEC-484/584: Computer Networks 31

32 Exercise: IP Fragmentation • Suppose that host A is connected to a router

32 Exercise: IP Fragmentation • Suppose that host A is connected to a router R 1, R 1 is connected to another router, R 2, and R 2 is connected to host B. Suppose that a TCP message that contains 900 bytes of data and 20 bytes of TCP header is passed to the IP code at host A for delivery to B. Show the Total length, Identification, DF, MF, and Fragment offset fields of the IP header in each packet transmitted over the three links. Assume that link A-R 1 can support a maximum frame size of 1024 bytes including a 14 -byte frame header, link R 1 -R 2 can support a maximum frame size of 512 bytes, including an 8 -byte frame header, and link R 2 -B can support a maximum frame size of 512 bytes including a 12 -byte frame header. Spring Semester 2006 EEC-484/584: Computer Networks 32