870 likes | 1.03k Vues
Computer Networks CSE 434 Fall 2009. Sandeep K. S. Gupta Arizona State University. http://impact.asu.edu/cse434fa09.html. http://impact.asu.edu. Research Experience for Undergraduates (REU). Announcements and Agenda. HW4 due Nov 4. Network layer What’s in a Router Routing Cont.
E N D
Computer NetworksCSE 434 Fall 2009 Sandeep K. S. Gupta Arizona State University http://impact.asu.edu/cse434fa09.html http://impact.asu.edu Research Experience for Undergraduates (REU)
Announcements and Agenda • HW4 due Nov 4. • Network layer • What’s in a Router • Routing Cont. • Routing Recap • Internet Forwarding and Routing • IP datagram format • IP fragmentation and reassembly • RIP • OPSF • BGP
Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing
Router Architecture Overview Two key router functions: run routing algorithms/protocol (RIP, OSPF, BGP) forwarding datagrams from incoming to outgoing link
Input Port Functions Decentralized switching: given datagram dest., lookup output port using forwarding table in input port memory goal: complete input port processing at ‘line speed’ queuing: if datagrams arrive faster than forwarding rate into switch fabric Physical layer: bit-level reception Data link layer: e.g., Ethernet see chapter 5
Switching Via Memory First generation routers: traditional computers with switching under direct control of CPU packet copied to system’s memory speed limited by memory bandwidth (2 bus crossings per datagram) Memory Input Port Output Port System Bus
Switching Via a Bus datagram from input port memory to output port memory via a shared bus bus contention: switching speed limited by bus bandwidth 32 Gbps bus, Cisco 5600: sufficient speed for access and enterprise routers
Switching Via An Interconnection Network overcome bus bandwidth limitations Banyan networks, other interconnection nets initially developed to connect processors in multiprocessor advanced design: fragmenting datagram into fixed length cells, switch cells through the fabric. Cisco 12000: switches 60 Gbps through the interconnection network
Output Ports Buffering required when datagrams arrive from fabric faster than the transmission rate Scheduling discipline chooses among queued datagrams for transmission
Output port queueing buffering when arrival rate via switch exceeds output line speed queueing (delay) and loss due to output port buffer overflow!
How much buffering? RFC 3439 rule of thumb: average buffering equal to “typical” RTT (say 250 msec) times link capacity C e.g., C = 10 Gps link: 2.5 Gbit buffer Recent recommendation: with N flows, buffering equal to . RTT C N
Output port queuing Packet scheduler is needed at output port to choose one packet among those queued for transmission: FCFS Weighted Fair Scheduling – WFQ What happens when queue becomes full? Drop tail policy – remove one or more already-queued packets to make room for the newly arrived packet Avoidance – start dropping packets before the buffer gets full in order to provide implicit congestion signal to the sender.
Scheduling and Dropping Mechanisms scheduling: choose next packet to send on link FIFO (first in first out) scheduling: send in order of arrival to queue real-world example? discard policy: if packet arrives to full queue: who to discard? Tail drop: drop arriving packet priority: drop/remove on priority basis random: drop/remove randomly
Scheduling Policies: (Ch7 – for QoS guarantee) Priority scheduling: transmit highest priority queued packet multiple classes, with different priorities class may depend on marking or other header info, e.g. IP source/dest, port numbers, etc..
Scheduling Policies round robin scheduling: multiple classes cyclically scan class queues, serving one from each class (if available)
Scheduling Policies Weighted Fair Queuing: generalized Round Robin each class gets weighted amount of service in each cycle
Active Queue Management (AQM) - RED AQM – packet dropping and marking policy E.g. RED – Random Early Detection (RED) A weighted average Lavg is maintained for the length of the output queue Upon packet arrival: If Lavg < minimum threshold minth, admit the packet in the queue If the queue is full or the Lavg > maximum threshold maxth, mark the packet (to be dropped) or drop it. If minth <= Lavg <= maxth, the packet is marked to be dropped with a probability which is typically a function of Lavg.
Input Port Queuing Fabric slower than input ports combined -> queueing may occur at input queues Head-of-the-Line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward queueing delay and loss due to input buffer overflow!
Longest prefix matching rule • “Find the longest matching entry in the forwarding table and • forward the packet to the link interface associated with the • longest prefix match.” • Ensures the most specific entry is selected for destination address (DA) Prefix MatchLink Interface 11001000 00010111 00010 0 11001000 00010111 00011000 1 11001000 00010111 00011 2 otherwise 3 Examples Which interface? DA: 11001000 00010111 00010110 10100001 -- interface 0 Which interface? DA: 11001000 00010111 00011000 10101010 -- interface 1
Distance Vector (DV) Algorithm Whereas Link-State (LS) algorithm uses global information (hence requires broadcast communication), DV algorithm is: distributed– each node receives some information (distance vector) from one or more of its directly attached neighbors asynchronous – does not require all the nodes to operate in lock-step with each other. iterative – process continues until no more information is exchanged between neighbors. self-terminating – there is no signal that the computation should stop; it just stops. DV-like algorithms are used in many routing protocols in practice, including the Internet’s RIP and BGP, ISO IDRP, Novell IPX, and the original ARPAnet.
DV - Theory Bellman-Ford Equation (dynamic programming) Define dx(y) := cost of least-cost path from x to y Then dx(y) = min {c(x,v) + dv(y) } where min is taken over all neighbors v of x v
Bellman-Ford example 5 3 5 2 2 1 3 1 2 1 x z w y u v Clearly, dv(z) = 5, dx(z) = 3, dw(z) = 3 B-F equation says: du(z) = min { c(u,v) + dv(z), c(u,x) + dx(z), c(u,w) + dw(z) } = min {2 + 5, 1 + 3, 5 + 3} = 4 Node that achieves minimum is next hop in shortest path ➜ forwarding table
DV – data structure at node x Dx(y) = estimate of least cost from x to y Node x knows cost to each neighbor v: c(x,v) Node x maintains distance vector Dx = [Dx(y): y є N ] Node x also maintains its neighbors’ distance vectors For each neighbor v, x maintains Dv = [Dv(y): y є N ]
Distance Vector Algorithm At each node x: Initialization: for all destinations y in N: Dx(y) = c(x,y) // if y is not a neighbor then c(x,y) = ∞ for each neighbor w Dw(y) = ∞ for all destinations y in N for each neighbor w Send distance vector Dx = [Dx(y): y in N] to w Loop wait (until link cost changed to some neighbor w OR recv distance vector from some neighbor w) for each y in N: Dx(y) = minv{c(x,v) + Dv(y)} If Dx(y) changed for ANY destination y send distance vector Dx = [Dx(y): y in N] to all neighbors Forever
Distance Vector: link cost changes 1 4 1 50 x z y Link cost changes: • node detects local link cost change • updates routing info, recalculates distance vector • if DV changes, notify neighbors At time t0, y detects the link-cost change, updates its DV, and informs its neighbors. “good news travels fast” At time t1, z receives the update from y and updates its table. It computes a new least cost to x and sends its neighbors its DV. At time t2, y receives z’s update and updates its distance table. y’s least costs do not change and hence y does not send any message to z.
Distance Vector: link cost changes 60 4 1 50 x z y Link cost changes: • good news travels fast • bad news travels slow - “count to infinity” problem! • 44 iterations before algorithm stabilizes: see text Poisoned reverse: • If Z routes through Y to get to X : • Z tells Y its (Z’s) distance to X is infinite (so Y won’t route to X via Z) • will this completely solve count to infinity problem?
Hierarchical Routing scale: with 200 million destinations: can’t store all dest’s in routing tables! routing table exchange would swamp links! administrative autonomy internet = network of networks each network admin may want to control routing in its own network Our routing study thus far - idealization • all routers identical • network “flat” … not true in practice
Hierarchical Routing aggregate routers into regions, “autonomous systems” (AS) routers in same AS run same routing protocol “intra-AS” routing protocol routers in different AS can run different intra-AS routing protocol Gateway router Direct link to router in another AS
forwarding table configured by both intra- and inter-AS routing algorithm intra-AS sets entries for internal dests inter-AS & intra-As sets entries for external dests Interconnected ASes 3a 3b 2a AS3 AS2 1a 2c AS1 2b 3c 1b 1d 1c Inter-AS Routing algorithm Intra-AS Routing algorithm Forwarding table
Inter-AS tasks suppose router in AS1 receives datagram destined outside of AS1: router should forward packet to gateway router, but which one? AS1 must: learn which dests are reachable through AS2, which through AS3 propagate this reachability info to all routers in AS1 Job of inter-AS routing! 3a 3b 2a AS3 AS2 1a AS1 2c 2b 3c 1b 1d 1c
Example: Setting forwarding table in router 1d suppose AS1 learns (via inter-AS protocol) that subnet x reachable via AS3 (gateway 1c) but not via AS2. inter-AS protocol propagates reachability info to all internal routers. router 1d determines from intra-AS routing info that its interface I is on the least cost path to 1c. installs forwarding table entry (x,I) 2c 2b 3c 1b 1d 1c … x 3a 3b 2a AS3 AS2 1a AS1
Example: Choosing among multiple ASes now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2. to configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x. this is also job of inter-AS routing protocol! 3a 3b 2a AS3 AS2 1a AS1 2c 2b 3c 1b 1d 1c … … x
Example: Choosing among multiple ASes now suppose AS1 learns from inter-AS protocol that subnet x is reachable from AS3 and from AS2. to configure forwarding table, router 1d must determine towards which gateway it should forward packets for dest x. this is also job of inter-AS routing protocol! hot potato routing: send packet towards closest of two routers. Determine from forwarding table the interface I that leads to least-cost gateway. Enter (x,I) in forwarding table Use routing info from intra-AS protocol to determine costs of least-cost paths to each of the gateways Learn from inter-AS protocol that subnet x is reachable via multiple gateways Hot potato routing: Choose the gateway that has the smallest least cost
Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing
IP datagram format IP protocol version number 32 bits total datagram length (bytes) header length (bytes) type of service head. len ver length for fragmentation/ reassembly fragment offset “type” of data flgs 16-bit identifier max number remaining hops (decremented at each router) upper layer time to live header checksum 32 bit source IP address 32 bit destination IP address upper layer protocol to deliver payload to E.g. timestamp, record route taken, specify list of routers to visit. Options (if any) data (variable length, typically a TCP or UDP segment) how much overhead with TCP? • 20 bytes of TCP • 20 bytes of IP • = 40 bytes + app layer overhead
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 fragmentation: in: one large datagram out: 3 smaller datagrams reassembly
IP Fragmentation and Reassembly length =1040 length =4000 length =1500 length =1500 ID =x ID =x ID =x ID =x fragflag =1 fragflag =1 fragflag =0 fragflag =0 offset =370 offset =185 offset =0 offset =0 One large datagram becomes several smaller datagrams Example • 4000 byte datagram • MTU = 1500 bytes 1480 bytes in data field offset = 1480/8
Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing
Intra-AS Routing also known as Interior Gateway Protocols (IGP) most common Intra-AS routing protocols: RIP: Routing Information Protocol OSPF: Open Shortest Path First IGRP: Interior Gateway Routing Protocol (Cisco proprietary)
Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing
RIP ( Routing Information Protocol) distance vector algorithm included in BSD-UNIX Distribution in 1982 distance metric: # of hops (max = 15 hops) u v destinationhops u 1 v 2 w 2 x 3 y 3 z 2 w x z y C A D B From router A to subnets:
RIP advertisements distance vectors: exchanged among neighbors every 30 sec via Response Message (also called advertisement) each advertisement: list of up to 25 destination subnets within AS
RIP: Example z w x y A D B C Destination Network Next Router Num. of hops to dest. w A 2 y B 2 z B 7 x -- 1 …. …. .... Routing/Forwarding table in D
RIP: Example z w x y A D B C Dest Next hops w - 1 x - 1 z C 4 …. … ... Advertisement from A to D Destination Network Next Router Num. of hops to dest. w A 2 y B 2 z B A 7 5 x -- 1 …. …. .... Routing/Forwarding table in D
RIP: Link Failure and Recovery If no advertisement heard after 180 sec --> neighbor/link declared dead routes via neighbor invalidated new advertisements sent to neighbors neighbors in turn send out new advertisements (if tables changed) link failure info quickly (?) propagates to entire net poison reverse used to prevent ping-pong loops (infinite distance = 16 hops)
RIP Table processing RIP routing tables managed by application-level process called route-d (daemon) advertisements sent in UDP packets, periodically repeated routed routed Transprt (UDP) Transprt (UDP) network forwarding (IP) table network (IP) forwarding table link link physical physical
Chapter 4: Network Layer 4. 1 Introduction 4.2 Virtual circuit and datagram networks 4.3 What’s inside a router 4.4 IP: Internet Protocol Datagram format IPv4 addressing ICMP IPv6 4.5 Routing algorithms Link state Distance Vector Hierarchical routing 4.6 Routing in the Internet RIP OSPF BGP 4.7 Broadcast and multicast routing
OSPF (Open Shortest Path First) “open”: publicly available uses Link State algorithm LS packet dissemination topology map at each node route computation using Dijkstra’s algorithm OSPF advertisement carries one entry per neighbor router advertisements disseminated to entire AS (via flooding) carried in OSPF messages directly over IP (rather than TCP or UDP