* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Weekly Review Slides - CSE Labs User Home Pages
Distributed firewall wikipedia , lookup
IEEE 802.1aq wikipedia , lookup
Network tap wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Multiprotocol Label Switching wikipedia , lookup
Computer network wikipedia , lookup
Asynchronous Transfer Mode wikipedia , lookup
Airborne Networking wikipedia , lookup
Serial digital interface wikipedia , lookup
TCP congestion control wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
Zero-configuration networking wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Internet protocol suite wikipedia , lookup
Deep packet inspection wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
We Have Learned Last Time Weekly Summary CSci4211: Weekly Summary 1 What We Learned Last Time (Sep 14) What is a network? What is a computer/data network? Compare w/ diff. networks (telephone, postal office, transportation networks, …) “bolts-&-nuts” view vs. service perspective Network is a shared resource! ways to share (“multiplex”) resources? TDMA, FDMA, CDMA, … Packet switching vs. circuit switching: packets, packet switching and statistical multiplexing • • For “bursty” data applications store-&-forward delay, losses and congestion vs. call blocking New: four types of delays propagation, transmission, processing & queueing delays New: Architecture: layering & hourglass different technologies, “boxes” (routers, switches), & apps Protocols and Interfaces (API) CSci4211: Weekly Summary 2 Switching & Multiplexing • Network is a shared resource • How do we do it? – Provide services for many people at same time – Carry bits/information for many people at same time – Switching: how to deliver information from point A to point B? – Multiplexing: how to share resources among many users Think about postal service and telephone system! Switching and multiplexing are closely related! CSci4211: Introduction 3 Switching/Multiplexing Strategies • Circuit switching – set up a dedicated route (“circuit”) first – carry all bits of a “conversation” on one circuit • original telephone network • Analogy: railroads and trains/subways • Packet switching – divide information into small chunks (“packets”) – each packet delivered independently – “store-and-forward” packets • Internet (also Postal Service, but they don’t tear your mail into pieces first!) • Analogy: highways and cars • Pros and Cons? - think taking subways vs. driving cars, during off-peak vs. rush hours! CSci4211: Introduction 4 Analogy: railroad and train CSci4211: Introduction 5 Analogy: Highway and cars 6 CSci4211: Introduction Circuit Switching network resources (e.g., bandwidth) divided into “pieces” • pieces allocated to calls • resource piece idle if not used by owning call (no sharing) dividing link bandwidth into “pieces” frequency division time division code division Trivia Q: You must have heard of the term “CDMA” (think the company Qualcom, for which it is most associated with), what does “CD” in CDMA stands for? 7 CSci4211: Introduction Circuit Switching: FDM and TDM Example: FDM 4 users frequency time TDM frequency CSci4211: time Introduction 8 Networks with Circuit Switching e.g., conventional (fixed-line) telephone networks End-end resources reserved for “call” • link bandwidth, switch capacity • dedicated resources: no sharing • circuit-like (guaranteed) performance • call setup required CSci4211: Introduction 9 Circuit Switched Networks • All resources (e.g. communication links) needed by a call dedicated to that call for its duration – Example: telephone network – Call blocking when all resources are used CSci4211: Introduction 10 Numerical example • How long does it take to send a file of 640,000 bits from host A to host B over a circuit-switched network? – All links are 1.536 Mbps – Each link uses TDM with 24 slots/sec – 500 msec to establish end-to-end circuit Let’s work it out! 10.5 seconds CSci4211: Introduction 11 Packet Switching Each end-end “data stream” divided into packets • users A, B packets share network resources • each packet uses full link bandwidth • resources used as needed Bandwidth division into “pieces” Dedicated allocation Resource reservation CSci4211: resource contention: aggregate resource demand can exceed amount available congestion: packets queue, wait for link use store and forward: packets move one hop at a time Node receives complete packet before forwarding Packets may suffer delay or losses! Introduction 12 Statistical Multiplexing • • • • • • Time division, but on demand rather than fixed Reschedule link on a per-packet basis Packets from different sources interleaved on the link Buffer packets that are contending for the link Buffer buildup is called congestion This is packet switching, used in computer networks CSci4211: Introduction 13 Packet Switching: Statistical Multiplexing 100 Mb/s Ethernet A B statistical multiplexing C 1.5 Mb/s queue of packets waiting for output link D E Sequence of A & B packets does not have fixed pattern, shared on demand statistical multiplexing. TDM: each host gets same slot in revolving TDM frame. CSci4211: Introduction 14 Packet-switching: store-and-forward L R R • Takes L/R seconds to transmit (push out) packet of L bits on to link or R bps • Entire packet must arrive at router before it can be transmitted on next link: store and forward • delay = 3L/R (assuming zero propagation delay) R Example: • L = 7.5 Mbits • R = 1.5 Mbps 15 sec • delay = ? more on delay later … 15 CSci4211: Introduction Packet switching versus circuit switching Packet switching allows more users to use network! • 1 Mb/s link • each user: – 100 kb/s when “active” N users – active 10% of time 1 Mbps link • circuit-switching: – 10 users • packet switching: – with 35 users, probability > 10 active less than .0004 Q: how did we get value 0.0004? M n M n n p 1 p n N 1 M 16 CSci4211: Introduction Circuit Switching vs Packet Switching Item Circuit-switched Packet-switched Dedicated “copper” path Yes No Bandwidth available Fixed Dynamic Potentially wasted bandwidth Yes No (not really!) Store-and-forward transmission No Yes Each packet/bit always follows the same route Yes Not necessarily Call setup Required Not Needed When can congestion occur At setup time On every packet Effect of congestion Call blocking Queuing delay CSci4211: Introduction 17 Four sources of packet delay 1. nodal processing: 2. queueing • check bit errors • determine output link • • time waiting at output link for transmission depends on congestion level of router transmission A propagation B nodal processing queueing CSci4211: Introduction 18 Delay in packet-switched networks 3. Transmission delay: • R=link bandwidth (bps) • L=packet length (bits) • time to send bits into link = L/R 4. Propagation delay: • d = length of physical link • s = propagation speed in medium (~2x108 m/sec) • propagation delay = d/s transmission A propagation B nodal processing queueing CSci4211: Note: s and R are very different quantitites! Introduction 19 Nodal delay d nodal d proc d queue d trans d prop • dproc = processing delay – typically a few microsecs or less • dqueue = queuing delay – depends on congestion • dtrans = transmission delay – = L/R, significant for low-speed links • dprop = propagation delay – a few microsecs to hundreds of msecs CSci4211: Introduction 20 Statistical Multiplexing and Queueing 10 Mbs Ethernet A B statistical multiplexing C 1.5 Mbs queue of packets waiting for output link 45 Mbs D CSci4211: E Introduction 21 Queueing delay (revisited) • R=link bandwidth (bps) • L=packet length (bits) • a=average packet arrival rate traffic intensity = La/R • La/R ~ 0: average queueing delay small • La/R -> 1: delays become large • La/R > 1: more “work” arriving than can be serviced, average delay infinite! CSci4211: Introduction 22 Queueing delay and Packet loss • Queue (aka buffer) preceding link in buffer has finite capacity • When packet arrives to full queue, packet is dropped (aka lost) • lost packet may be retransmitted by previous node, by source end system, or not retransmitted at all CSci4211: Introduction 23 “Real” Internet delays and routes • What do “real” Internet delay & loss look like? • Traceroute program: provides delay measurement from source to router along end-end Internet path towards destination. For all i: – sends three packets that will reach router i on path towards destination – router i will return packets to sender – sender times interval between transmission and reply. 3 probes 3 probes 3 probes CSci4211: Introduction 24 “Real” Internet delays and routes Let’s Traceroute to www.bbc.com CSci4211: Introduction 25 Throughput • throughput: rate (bits/time unit) at which bits transferred between sender/receiver – instantaneous: rate at given point in time – average: rate over longer period of time link capacity that can carry server, with server sends bits pipe Rs bits/sec fluid at rate file of F bits (fluid) into pipe Rs bits/sec) to send to client CSci4211: link that capacity pipe can carry Rfluid c bits/sec at rate Rc bits/sec) Introduction 26 Throughput (cont’d) • Rs < Rc What is average end-end throughput? Rs bits/sec Rc bits/sec Rs > Rc What is average end-end throughput? Rs bits/sec Rc bits/sec bottleneck link link on end-end path that constrains end-end throughput CSci4211: Introduction 27 Throughput: Internet scenario • per-connection end-end throughput: min(Rc,Rs,R/10) • in practice: Rc or Rs is often bottleneck CSci4211: Rs Rs Rs R Rc Rc Rc 10 connections (fairly) share backbone bottleneck link R bits/sec Introduction 28 Introduction (cont’d) Key network functions: -- naming, addressing, routing & forwarding networks are distributed & complex systems! What’s so special about the Internet? -- Internet Architecture: layering & hourglass different technologies, “boxes” (routers, switches), & apps Protocols and Interfaces (API) What today’s Internet looks like? economics & policies What may go wrong? bit errors, packet losses,, node failures, software bugs, app crashes. ….. and Attacks !!! CSci4211: Weekly Summary 29 What’s so special about the Internet? • • Internet is based on the notion of “packet switching” – enables statistical multiplexing – better utilization of network resources for transfer of “bursty” data traffic Internet’s key organizational/architectural principle: “smart” end systems + “dumb” networks – architecture: functional division & function placement hourglass Internet architecture: enables diverse – “dumb” network (core): simple packet-switched, store- – “smart” end systems/edges: servers, PCs, mobile devices, …; – applications and accommodates evolving technologies forward, connectionless “datagram” service, with core functions: global addressing, routing & forwarding diverse and ever-emerging new applications! CSci4211: Introduction 30 Internet Hourglass Architecture enabling diverse applications & new types of end devices bitTorrent, DHT, SIP, DASH, …. accommodating evolving & new technologies network core network edge/end hosts p2p file sharing, skype, YouTube, Netflix, Cloud Computing WiFi, Bluetooth, Docsis, gMPLS, DWDM/fiber, …, 3G/4G cellular, …. CSci4211: Introduction 31 Questions? CSci4211: Weekly Summary 32 Internet Protocol Stack • application: supporting network applications – FTP, SMTP, HTTP, DASH, … • transport: process-process data transfer – TCP, UDP • network: routing of datagrams from source to destination – IP, routing protocols • link: data transfer between neighboring network elements application transport network link physical – PPP, Ethernet • physical: bits “on the wire” 33 CSci4211: Introduction Layered Architecture • Layering simplifies the architecture of complex system • Layer N relies on services from layer N-1 to provide a service to layer N+1 • Interfaces define the services offered • Service required from a lower layer is independent of its implementation – Layer N change doesn’t affect other layers – Information/complexity hiding – Similar to object oriented methodology CSci4211: Introduction 34 Protocols and Services • Protocols are used to implement services – Peering entities in layer N provide service by communicating with each other using the service provided by layer N-1 • Logical vs physical communication CSci4211: Introduction 35 What’s a protocol? human protocols: • “what’s the time?” • “I have a question” • introductions network protocols: • machines rather than humans • all communication activity in Internet governed by protocols (why this concept is so important!!!) 36 CSci4211: Introduction Protocol Packets • Protocol data units (PDUs): – packets exchanged between peer entities • Service data units (SDUs): – packets handed to a layer by an upper layer • Data at one layer is encapsulated in packet at a lower layer – Envelope within envelope: PDU = SDU + (optional) header or trailer CSci4211: Introduction 37 Encapsulation source message segment M Ht M datagram Hn Ht M frame Hl Hn Ht M application transport network link physical link physical switch destination M Ht M Hn Ht Hl Hn Ht M M Hn Ht Hl Hn Ht application transport network link physical M M network link physical Hn Ht M router CSci4211: Introduction 38 Introduction (cont’d) Key network functions: -- naming, addressing, routing & forwarding What’s so special about the Internet? -- Internet Architecture: layering & hourglass networks are distributed & complex systems! different technologies, “boxes” (routers, switches), & apps Protocols and Interfaces (API) What today’s Internet looks like? -- economics & policies What may go wrong? bit errors, packet losses,, node failures, software bugs, app crashes. ….. and Attacks !!! CSci4211: Weekly Summary 39 Internet Structure Internet: “networks of networks”! International lines IXPs or private peering National or tier-1 ISP National or tier-1 ISP Regional or local ISP company university Internet eXcange Points Regional ISPs local ISPs company LANs Home users access via WiFi hotspots Home users CSci4211: Introduction 40 Internet structure: network of networks • Roughly hierarchical • At center: “tier-1” ISPs (e.g., Verizon, Sprint, AT&T, L3, Cable and Wireless), national/international coverage – treat each other as equals Tier-1 providers interconnect (peer) privately Tier 1 ISP Tier 1 ISP CSci4211: IXP Tier-1 providers also interconnect at Internet Exchange Point Tier 1 ISP Introduction 41 Tier-1 ISP: e.g., Sprint POP: point-of-presence to/from backbone peering … … . … … … to/from customers CSci4211: Introduction 42 Internet structure: network of networks • “Tier-2” ISPs: smaller (often regional) ISPs – Connect to one or more tier-1 ISPs, possibly other tier-2 ISPs Tier-2 ISP pays tier-1 ISP for connectivity to rest of Internet tier-2 ISP is customer of tier-1 provider Tier-2 ISP Tier-2 ISP Tier 1 ISP Tier 1 ISP Tier-2 ISP CSci4211: IXP Tier 1 ISP Tier-2 ISPs also peer privately with each other, interconnect at IXP Tier-2 ISP Tier-2 ISP Introduction 43 Internet structure: network of networks • “Tier-3” ISPs and local ISPs – last hop (“access”) network (closest to end systems) local ISP Local and tier3 ISPs are customers of higher tier ISPs connecting them to rest of Internet Tier 3 ISP Tier-2 ISP local ISP local ISP local ISP Tier-2 ISP Tier 1 ISP Tier 1 ISP Tier-2 ISP local local ISP ISP CSci4211: IXP Tier 1 ISP Tier-2 ISP local ISP Introduction Tier-2 ISP local ISP 44 Internet structure: network of networks • a packet passes through many networks! traceroute www.cnn.com A local ISP Routing & forwarding: how do packets go from A to B? Tier 3 ISP Tier-2 ISP local ISP local ISP local ISP Tier-2 ISP Tier 1 ISP Tier 1 ISP Tier-2 ISP local local ISP ISP CSci4211: IXP Tier 1 ISP Tier-2 ISP local ISP Introduction Tier-2 ISP local ISP B 45 Map of Internet CSci4211: Weekly Summary 47 Announcement & Reminder (Sep 21) • Programming Project # 1 has also been posted on the class website: Due Monday Oct 10 11:59pm • Hw #1: due: Friday Oct 7 11:59pm Please start working on them! CSci4211: Weekly Summary 48 What We Learned Last Time (Sep 21) What is a network? What is a computer/data network? Compare w/ diff. networks (telephone, postal office, transportation networks, …) “bolts-&-nuts” view vs. service perspective Network is a shared resource! ways to share (“multiplex”) resources? TDMA, FDMA, CDMA, … Packet switching vs. circuit switching: packets, packet switching and statistical multiplexing • • For “bursty” data applications store-&-forward delay, losses and congestion vs. call blocking New: four types of delays propagation, transmission, processing & queueing delays Architecture: layering & hourglass different technologies, “boxes” (routers, switches), & apps Protocols and Interfaces (API) CSci4211: Weekly Summary 49 Internet Hourglass Architecture enabling diverse applications & new types of end devices bitTorrent, DHT, SIP, DASH, …. accommodating evolving & new technologies network core network edge/end hosts p2p file sharing, skype, YouTube, Netflix, Cloud Computing WiFi, Bluetooth, Docsis, gMPLS, DWDM/fiber, …, 3G/4G cellular, …. CSci4211: Introduction 50 Layered Architecture • Layering simplifies the architecture of complex system • Layer N relies on services from layer N-1 to provide a service to layer N+1 • Interfaces define the services offered • Service required from a lower layer is independent of its implementation – Layer N change doesn’t affect other layers – Information/complexity hiding – Similar to object oriented methodology CSci4211: Introduction 51 Protocols and Services • Protocols are used to implement services – Peering entities in layer N provide service by communicating with each other using the service provided by layer N-1 • Logical vs physical communication CSci4211: Introduction 52 Fundamental Issues in Networking Network is a shared resource – Provide services for many people at same time – Carry bits/information for many people at same time • Switching and Multiplexing – How to share resources among multiple users, and transfer data from one node to another node • Naming and Addressing – How to find name/address of the party (or parties) you would like to communicate with – Address: byte-string that identifies a node • unicast, multicast and broadcast addresses • Routing and Switching/Forwarding: – process of determining how to send packets towards the destination based on its address: finding out neighbors, building routing tables – transferring data from source to destination CSci4211: Introduction 53 Fundamental Problems in Networking … Or what can go wrong? • Bit-level errors: due to electrical interferences • “Frame-level” errors: media access delay or frame collision due to contention/collision/interference • Packet-level errors: packet delay or loss due to network congestion/buffer overflow • Out of order delivery: packets may takes different paths • Link/node failures: cable is cut or system crash • [and of course, cyber attacks! –> will not be covered in this class: if interested, take “computer security”] CSci4211: Introduction 54 Fundamental Problems in Networking What can be done? • Add redundancy to detect and correct erroneous packets • Acknowledge received packets and retransmit lost packets • Assign sequence numbers and reorder packets at the receiver • Sense link/node failures and route around failed links/nodes Goal: to fill the gap between what applications expect and what underlying technology provides CSci4211: Introduction 55 A Simplified Illustration of Internet CSci4211: Weekly Summary 56 Applications and Application Layer Protocols Basics of Building Applications: a networking perspective application processes and inter-process communications API: socket overview “Addressing” processes (“whom is the other party is”) What transport services to use? TCP and UDP Application Structures IP addresses and port numbers client-server peer-to-peer download “wireshark” software! - data centers, cloud services Case studies: applications/application protocols world wide web and HTTP: transaction-oriented app protocol email and SMTP (& POP, IMAP): session-based app protocol CSci4211: Weekly Summary 57 Web and HTTP Summary Transaction-oriented (request/reply), use TCP, port 80 Non-persistent (HTTP/1.0) vs. persistent (HTTP/1.1) Server Client GET /index.html HTTP/1.0 CSci4211: HTTP/1.0 200 Document follows Content-type: text/html Content-length: 2090 -- blank line -HTML text of the Web page Weekly Summary 58 CSci4211: Weekly Summary 59 Announcement & Reminder (Sep 28) • Hw #1: due: Friday Oct 7 11:59pm Please start working on them! • Programming Project # 1 Due Monday Oct 10 11:59pm Please start working on your project also! • Wednesday Oct 12: hand-out take-home quiz I; due Oct 14 CSci4211: Weekly Summary 60 What We Learned Last Time (Sept 28) … Case studies: applications/application protocols email and SMTP (& POP, IMAP): session-based app protocol Domain Name System: world wide web and HTTP: transaction-oriented app protocol; non-persistent vs. persistent; maintaining “states” across request-reply transactions via cookie Mapping domain (DNS) name to IP addresses Network Socket Programming BSD socket programming interfaces: Socket programming in Python Socket porgramming in Java CSci4211: Weekly Summary TCP vs. UDP sockets 61 Web and HTTP Summary Transaction-oriented (request/reply), use TCP, port 80 Client Server GET /index.html HTTP/1.0 CSci4211: HTTP/1.0 200 Document follows Content-type: text/html Content-length: 2090 -- blank line -HTML text of the Web page Weekly Summary 62 Email Summary Alice Message user agent (MUA) client Message transfer agent (MTA) SMTP outgoing mail queue SMTP over TCP (RFC 821) Bob POP3 (RFC 1225)/ IMAP (RFC 1064) for accessing mail Message user agent (MUA) user mailbox CSci4211: Weekly Summary port 25 server Message transfer agent (MTA) 63 Internet Domain Names • Hierarchical: anywhere . (root) from two to possibly infinity • Examples: afer.cs.umn.edu, lupus.fokus.gmd.de edu, de: organization type or country (a “domain”) – umn, fokus: organization administering the “subdomain” – cs, fokus: organization administering the host – afer, lupus: host name (have IP address) . com . uk . edu – CSci4211: umn.edu yahoo.com cs.umn.edu itlabs.umn.edu www.yahoo.com afer.cs.umn.edu Application Layer 64 DNS: Root name servers • contacted by local name server that can not resolve name • root name server: – contacts authoritative name server if name mapping not known – gets mapping – returns mapping to local name server • ~ dozen root name servers worldwide CSci4211: Application Layer 65 DNS: iterated queries recursive query: root name server • puts burden of name resolution on contacted name server • heavy load? 3 4 7 local name server intermediate name server dns.aol.com iterated query: • contacted server replies with name of server to contact • “I don’t know this name, but ask this server” iterated query 2 1 8 dns.umn.edu 5 6 authoritative name server requesting host dns.cs.umn.edu homeboy.aol.com CSci4211: afer.cs.umass.edu Application Layer 66 DNS: caching and updating records • once (any) name server learns mapping, it caches mapping – cache entries timeout (disappear) after some time • update/notify mechanisms under design by IETF – RFC 2136 – http://www.ietf.org/html.charters/dnsind-charter.html CSci4211: Application Layer 67 DNS records DNS: distributed db storing resource records (RR) RR format: (name, value, type,ttl) • Type=CNAME • Type=A – name is hostname – value is IP address • Type=NS – name is domain (e.g. foo.com) – value is IP address of authoritative name server for this domain CSci4211: – name is an alias name for some “canonical” (the real) name – value is canonical name • Type=MX – value is hostname of mailserver associated with name Application Layer 68 DNS protocol, messages Name, type fields for a query RRs in reponse to query records for authoritative servers additional “helpful” info that may be used CSci4211: Application Layer 69 DNS Protocol • Query/Reply: use UDP, port 53 • Transfer of DNS Records between authoritative and replicated servers: use TCP CSci4211: Application Layer 70 Socket: Conceptual View socket() CSci4211: Socket API 71 A summary of BSD Socket protocol localAddr,localPort remoteAddr, remotePort conn-oriented server socket() bind() listen(), accept() connect() conn-oriented client socket() connectionless server socket() bind() recvfrom() connectionless client socket() bind() sendto() CSci4211: Socket API 72 BSD Socket Programming Flows (connection-oriented) CSci4211: Socket API 73 BSD Socket Programming (connectionless) CSci4211: Socket API 74 Highlight of Today’s Lecture (Sept 28) Briefly: Peer-to-peer programming paradigm • Unstructured P2P Application Examples: Napster, Gnutella, KaZaa, BitTorrent, Skype Distributed Hashing Tables (DHT) (very briefly) A Quick Intro to Multimedia Networking key problem in p2p programming paradigm? how to find the other party? What’re the IP of and port # used by the other party? please read by yourself: YouTube and Netflix Overview Second Part: Transport Layer: UDP; A simple reliable data transfer protocol (Stop-&-Wait) TCP Connection Setup; CSci4211: Weekly Summary 75 CSci4211: Weekly Summary 76 Announcement & Reminder (Oct 5) • Hw #1: due: this Friday Oct 7 11:59pm • Programming Project # 1 Due next Monday Oct 10 11:59pm • Wednesday Oct 12: hand-out take-home quiz I; due Oct 14 CSci4211: Weekly Summary 77 UDP: User Datagram Protocol [RFC 768] • “no frills,” “bare bones” Internet transport protocol • “best effort” service, UDP segments may be: – lost – delivered out of order to app • connectionless: – no handshaking between UDP sender, receiver – each UDP segment handled independently of others Why is there a UDP? • no connection establishment (which can add delay) • simple: no connection state at sender, receiver • small segment header • no congestion control: UDP can blast away as fast as desired CSci4211: Weekly Summary 78 UDP Datagram Format • often used for streaming multimedia apps Length, in – loss tolerant – rate sensitive 32 bits source port # dest port # length checksum bytes of UDP segment, including header • other UDP uses – DNS – SNMP • reliable transfer over UDP: add reliability at application layer – application-specific error recovery! CSci4211: Weekly Summary Application data (message) UDP segment format 79 TCP: Overview • full duplex data: • point-to-point: – bi-directional data flow in same connection – MSS: maximum segment size – one sender, one receiver • reliable, in-order byte steam: • connection-oriented: – no “message boundaries” • pipelined: – TCP congestion and flow control set window size • send & receive buffers socket door application writes data application reads data TCP send buffer TCP receive buffer – handshaking (exchange of control msgs) init’s sender, receiver state before data exchange • flow controlled: socket door – sender will not overwhelm receiver segment CSci4211: Weekly Summary 80 TCP Segment Structure 32 bits URG: urgent data (generally not used) ACK: ACK # valid PSH: push data now (generally not used) RST, SYN, FIN: connection estab (setup, teardown commands) Internet checksum (as in UDP) source port # dest port # sequence number acknowledgement number head not UA P R S F len used checksum counting by bytes of data (not segments!) rcvr window size ptr urgent data Options (variable length) # bytes rcvr willing to accept application data (variable length) CSci4211: Weekly Summary 81 TCP Seq. # & Ack.# Seq. #’s: byte stream “number”of first byte in segment’s data Host A User types ‘C’ host ACKs receipt of ‘C’, echoes back ‘C’ ACKs: seq # of next byte expected from other side Host B host ACKs receipt of echoed ‘C’ time red: A-to-B green: B-to-A simple telnet scenario CSci4211: Weekly Summary 82 TCP: Some Key Issues How to design a simple “reliable” transfer protocol? • stop-&-wait protocol (or alternative bit protocol) How to deal with “lost” packets? how to detect a packet is “lost”? • need to set a timer (“retransmission timer”) • what value shall we choose to set the timer? what to do with “lost” packets? • retransmit the “lost” packet when timer goes off What problem packet retransmission create? (potential) duplicate packets! • e.g., when a “lost” packet is not actually lost, but takes longer to get delivered, after timer times out how to recognize duplicate packets? sequence # : but why do we need sequence #? how many bits shall we use? CSci4211: Weekly Summary 83 Simple Reliable Data Transfer Protocol Host A Host B send data pkt & set retrans. timer Error Scenarios: • data pkt lost X data pkt lost timer goes off! resend data pkt time CSci4211: Weekly Summary 84 Simple Reliable Data Transfer Protocol Host B Host A send data pkt & set retrans. timer Error Scenarios: • data pkt lost • ack pkt lost X timer goes off! resend data pkt time ACK pkt lost Note: Host A can’t tell whether the two error scenarios apart: whether data packet or ACK packet is lost CSci4211: Weekly Summary 85 Simple Reliable Data Transfer Protocol Host A Host B send data pkt & set retrans. timer Error Scenarios: • data pkt lost • ack pkt lost • retrans. timer goes off (but none is lost!) duplicate packets timer goes off! resend data pkt Host B: did host A send “C” or “CC” ? time Note: Host B has no idea that retrans. timer at Host A went off! CSci4211: Weekly Summary 86 Simple Reliable Data Transfer Protocol Host A send data pkt & set retrans. timer Host B Why Do We Need Seq # ? Host B: Did host A send “C” or “CC” ? time Error Scenario (retrans. timer goes off) vs. Normal Scenario (host A sends another data pkt (with char “C”) look exactly the same from Host B’s perspective! CSci4211: Weekly Summary 87 Simple Reliable Data Transfer Protocol Host A send data pkt & set retrans. timer timer goes off! Host B expecting data pkt w/ seq. 42; received pkt. w/seq=42 send ACK w/ ack=43; expecting data pkt w/ seq=43 Duplicate data pkt, resend ACK w/ ack=43! time CSci4211: Weekly Summary 88 Simple Reliable Data Transfer Protocol Host A send data pkt & set retrans. timer timer goes off! Host B expecting data pkt w/ seq. 42; received pkt. w/seq=42 send ACK w/ ack=43; expecting data pkt w/ seq=43 Duplicate data pkt, resend ACK w/ ack=43! time CSci4211: Weekly Summary 89 Simple Reliable Data Transfer Protocol Host A send data pkt & set retrans. timer Host B expecting data pkt w/ seq. 42; received pkt. w/seq=42 send ACK w/ ack=43; expecting data pkt w/ seq=43 received new data pkt as expected! send ACK w/ ack=44; expecting data pkt w/ seq=43 time With seq. included in the data packet, error Scenario (retrans. timer goes off) vs. Normal Scenario (host A sends another data pkt (with char “C”) can now be distinguished by host B! CSci4211: Weekly Summary 90 A Simple Reliable Data Transfer Protocol “Stop & Wait” Protocol (aka “Alternate Bit” Protocol) Receiver algorithm: Sender algorithm: • Send Phase: send data segment (n bytes) w/ seq=x, buffer data segment, set timer • Wait Phase: wait for ack from receiver w/ ack= x+n – if received ack w/ ack=x+n, set x:=x+n, and go to sending phase with next data segment – if time out, resend data segment w/ seq=x. – if received ack w/ ack != x+n, ignore (or resend data segment w/ seq=x) Wait-for-Data: wait for data packet with the (expected) next-seq = x • • if received Data packet w/ seq. =x and of size n bytes: send ACK pkt w/ ack = x+n; set next-seq:= x+n; go back to “Wait-for-Data”; If received Data packet w/ seq != x, (re-)send ACK pkt w/ ack= next-seq; go back to “Wait-for-Data”; Q: what is the “state” information maintained at the sender & receiver, resp.? CSci4211: Weekly Summary 91 SRDTP: Finite State Machine : state event action : transition Sender FSM Receiver FSM? Upper layer: send data (n bytes) make data sgt, seq = x, set timer pass data sgt to lower layer ? ? receive Ack w/ ack != x+n Send phase Wait phase no op, or resend data sgt time out resend data sgt receive Ack w/ ack = x+n x: = x+n, stop timer info (“state”) maintained at sender: phase it is in (send, or wait), ack expected, data sgt sent (seq #), timer CSci4211: Weekly Summary 92 TCP Connection Set Up Three way handshake: TCP sender, receiver establish Step 1: client sends TCP SYN “connection” before control segment to server exchanging data segments – specifies initial seq # • initialize TCP variables: – seq. #s – buffers, flow control info • client: end host that initiates connection • server: end host contacted by client Step 2: server receives SYN, replies with SYN+ACK control segment – ACKs received SYN – specifies server receiver initial seq. # Step 3:client receives SYN+ACK, replies with ACK segment (which may contain 1st data segment) CSci4211: Weekly Summary 93 TCP 3-Way Hand-Shake client server Question: initiate connection SYN received a. What kind of “state” client and server need to maintain? b. What initial sequence # should client (and server) use? connection established connection established CSci4211: Weekly Summary 94 TCP: Some Key Issues TCP Connection Set-up Design Questions Why Three-Way, not, say Two-Way, Handshake? e.g., client: SYN (x); server: SYNACK(y,x) Why Do Both Client and Server Need to Choose a Unique Seq. # to number its byte stream? Unique each connection between the same source and destination host pair (and port number pair) must have a different sequence number • Recall: each TCP connection is identified by a 5-tuple <src IP, dst IP, src port, dst port, TCP> Problems: “old” duplicate packets (“ghost” packets) from previous (instantiation of the “same”) connection can create “half-open” connection (that we want to avoid!) CSci4211: Weekly Summary 95 Connection Setup Error Scenarios • Lost (control) packets – What happen if SYN lost? client vs. server actions – What happen if SYN+ACK lost? client vs. server actions – What happen if ACK lost? client vs. server actions • Duplicate (control) packets – What does server do if duplicate SYN received? – What does client do if duplicate SYN+ACK received? – What does server do if duplicate ACK received? CSci4211: Weekly Summary 96 Connection Setup Error Scenarios (cont’d) • Importance of (unique) initial seq. no.? – When receiving SYN, how does server know it’s a new connection request? – When receiving SYN+ACK, how does client know it’s a legitimate, i.e., a response to its SYN request? • Dealing with old duplicate (aka “ghost”) packets from old connections (or from malicious users) – If not careful: “TCP Hijacking” [i.e., Mitnick attack] • How to choose unique initial seq. no.? – In practice: randomly choose a number (out of 232 possible #’s) and add to last syn# used • Other security concern: – “SYN Flood” -- denial-of-service attack CSci4211: Weekly Summary 97 CSci4211: Weekly Summary 98 Announcement & Reminder (Oct 12) Take-home quiz I : due Oct 14 11:59pm • Has been posted to the class mailing list earlier • Please submit via Moodle class website • Programming Project # 2 Due Monday Oct 31 11:55pm • TA Anas will provide a short overview next week’s class. • Hw #1 sample solutions (posted/shared with you) CSci4211: Weekly Summary 99 What We Learned Last Time (Oct 12) Transport Layer: multiplexing and de-multiplexing UDP: connectionless transport service • src/dst port no.’s, checksum TCP: connection-oriented, reliable service • seq #, ack #, special “flags” (SYN, ACK, FIN, RST) • connection management: • 3-way handshake set-up & timed wait shut-down • Key challenges: old, duplicate messages! A simply reliable data transfer protocol : stop & wait Efficiency of Protocol Design: stop-&-wait Pipelining Protocols: Go-Back-N and Selective Repeat CSci4211: Weekly Summary 100 Reliable Data Transfer Protocols Reliable Data Transfer Protocols • basic mechanisms: seq. no, ACK, timer, retransmission • Simplest protocol: Stop-&-Wait • • To ensure correct operations of the protocol: at least 1-bit (0 or 1) needed for seq. no. (why?) More efficient reliable data transfer protocols • What’s the problem with Stop & Wait protocol? • Sliding window protocols: Go-Back-N and Selective Repeat • concept of ”sliding window” • sender algorithm: •when to retransmit, when to send new packets? when to move window forward? • receiver algorithm: •when/what to acknowledge? when to move window forward? when to buffer packets, and when to pass to upper layer? •relationship between window size & seq. no. space CSci4211: Weekly Summary 101 Simple Reliable Data Transfer Protocol “Stop-and-Wait” Protocol (rdt3.0 in the textbook) – also called Alternating Bit Protocol • Sender: – i) send data segment (n bytes) w/ seq =x • buffer data segment, set timer, retransmit if time out – ii) wait for ACK w/ack = x+n; if received, set x:=x+n, go to i) • retransmit if ACK w/ “incorrect” ack no. received • Receiver: – i) expect data segment w/ seq =x; if received, send ACK w/ ack=x+n, set x:=x+n, go to i) • if data segment w/ “incorrect” seq no received, discard data segment, and retransmit ACK. CSci4211: Weekly Summary 102 Problem with Stop & Wait Protocol Sender Receiver first packet bit transmitted, t = 0 RTT first packet bit arrives ACK arrives, send next packet, t = RTT + L / R • Can’t keep the pipe full – Utilization is low when bandwidth-delay product (R x RTT)is large! CSci4211: CSci4211: Transport Layer: Part II Weekly Summary 103 Stop & Wait: Performance Analysis Example: 1 Gbps connection, 15 ms end-end prop. delay, data segment size: 1 KB = 8Kb; ack segment size: assume negligible Ttransmit U sender L (packet length in bits) 8 kb 9 R (transmiss ion rate, bps) 10 b/s 8 106 s 0.008 ms L/R L .008 0.00027 RTT L / R RTT * R L 30.008 – U sender: utilization, i.e., fraction of time sender busy sending – 1KB data segment every 30 msec (round trip time) --> 0.027% x 1 Gbps = 33kB/sec throughput over 1 Gbps link Moral of story: network protocol limits use of physical resources! CSci4211: Weekly Summary 104 Pipelined Protocols Pipelining: sender allows multiple, “in-flight”, yetto-be-acknowledged data segments – range of sequence numbers must be increased – buffering at sender and/or receiver • Two generic forms of pipelined protocols: Go-Back-N and Selective Repeat CSci4211: Weekly Summary 105 Pipelining: Increased Utilization sender receiver first packet bit transmitted, t = 0 last bit transmitted, t = L / R first packet bit arrives last packet bit arrives, send ACK last bit of 2nd packet arrives, send ACK last bit of 3rd packet arrives, send ACK RTT ACK arrives, send next packet, t = RTT + L / R Increase utilization by a factor of 3! U sender = 3*L/R RTT + L / R CSci4211: = .024 30.008 = 0.0008 Weekly Summary microsecon ds 106 Go-Back-N: Basic Ideas Sender: • Packets transmitted continually (when available) without waiting for ACK, up to N outstanding, unACK’ed packets • A logically different timer associated with each “inflight” (i.e., unACK’ed) packet • timeout(n): retransmit pkt n and all higher seq # pkts in window Receiver: • ACK packet if corrected received and in-order, pass to higher layer, NACK or ignore corrupted or out-of-order packets • “cumulative” ACK: if multiple packets received corrected and in-order, send only one ACK with ack= next expected seq no. CSci4211: Weekly Summary 107 Go-Back-N: Sliding Windows Sender: • • “window” of up to N, consecutive unack’ed pkts allowed send_base: first sent but unACKed pkt, move forward when ACK’ed expected, not received yet may be received (and can be buffered, but not ACK’ed) rcv_base Receiver: • rcv_base: keep track of next expected seq no, move forward when next in-order (i.e., w/ expected seq no) pkt received CSci4211: Weekly Summary 108 GBN in Action CSci4211: Weekly Summary 109 Selective Repeat • As in Go-Back-N – Packet sent when available up to window limit • Unlike Go-Back-N – Out-of-order (but otherwise correct) is ACKed – Receiver: buffer out-of-order pkts, no “cumulative” ACKs – Sender: on timeout of packet k, retransmit just pkt k • Comments – Can require more receiver buffering than Go-Back-N – More complicated buffer management by both sides – Save bandwidth • no need to retransmit correctly received packets CSci4211: Weekly Summary 110 Selective Repeat: Sliding Windows CSci4211: Weekly Summary 111 Selective Repeat in Action CSci4211: Weekly Summary 112 Seqno Space and Window Size Check out the companion website (for the 6th edition) for GBN and SR Applets: GBN: http://media.pearsoncmg.com/aw/ecs_kurose_compnetwork_6/ video_applets/GBNindex.html SR: http://media.pearsoncmg.com/aw/ecs_kurose_compnetw ork_6/video_applets/SRindex.html OR check out the interactive Animation on the 7th edition website https://media.pearsoncmg.com/aw/ecs_kurose_compnetwork_7/c w/interactive-animations-cw.php CSci4211: Weekly Summary 113 Seqno Space and Window Size • How big the sliding window (W) can be? – MAXSEQNO S: number of available sequence #’s • S = 2s if s bits are used to present the sequence #’s – Go-Back-N: W=S won’t work! – What about Selective Repeat? • Assumptions about the underlying network are important! – If two machines are directly connected via a physical link, the network may corrupt or lose packets, but cannot deliver two packets successfully but out-of-order • GBN: • SR: CSci4211: Weekly Summary 114 Selective Repeat: Dilemma Example: • seq #’s: 0, 1, 2, 3 • window size=3 • receiver sees no difference in two scenarios! • incorrectly passes duplicate data as new in (a) Q: what relationship between seq # size and window size? CSci4211: Weekly Summary 115 Seqno Space and Window Size • How big the sliding window (W) can be? • Assumptions about the underlying network are important! – If two machines are directly connected via a physical link, the network may corrupt or lose packets, but cannot deliver two packets successfully but out-of-order • GBN: W=S-1; SR: W= S/2 – If two machines are connected via a general network (more than one link), the underlying network may not only corrupt or lose packets, but also deliver two packets successfully but out-oforder, what should W be? – Key Principle: W must be (small enough) such that there can’t an old packet and a new packet sent by the sender carrying the same sequence # inside the network or at the receiver ! otherwise, the receiver will be confused! CSci4211: Weekly Summary 116 CSci4211: Weekly Summary 117 Announcement & Reminder (Nov 16) Homework assignment #2 due Friday Nov 18 11:55pm No Class Next Wednesday Happy Thanksgiving! Take-Home Quiz II : handout: Tuesday Nov 22 due: Monday Nov 28 11:55pm cover everything until Nov 9’s lectures, with emphasis what you learned after Quiz I • CSci4211: Weekly Summary 118 What We Learned Last Time (Nov 16) Network Layer Control Plane: routing! • basic issues: exchange routing info & compute routes Distributed vs. Centralized Control Plane Two Basic (Distributed) Routing Algorithms: Link State vs. Distance Vector • How does Link State (LS) work? • How does Distance Vector (DV) work? • Issue with DV: county-to-infinity & possible hacks Centralized Control Plane: Openflow & SDN Controllers Routing in Internet: two-level Intra-domain routing (RIP, OSPF, IS-IS) – performance-based vs. Inter domain routing: BGP – policy routing Today’s Class: inter-domain routing & BGP ISP business models & AS relations BGP path vector routing, route filtering & selection processes, etc. CSci4211: Weekly Summary 119 CSci4211: Weekly Summary 120 Reminder (Nov 30) Project #4 is due Friday Dec 9 (11:55pm) ! TA Anas will be holding a Q&A towards the end of this lecture. Including today’s lecture, three more classes left, Hurray! Final exam: Dec 21 (Wednesday) 6:30pm -8:30pm, in-class (about 2 hours) CSci4211: Weekly Summary 121 What We Learned Last Time (Nov 30) •Routing in the Internet • two-level hierarchy; notion of AS • intra-domain: RIP, OSPF, IS-IS -- collection of them referred to as IGP (interior gateway protocol) • inter-domain: BGP, path-vector, policy-based ISP business models & AS relations •AS relationship: provider-customer; peering BGP path vector routing, route filtering & selection processes, etc. • routing policies: e.g., prefer customer routes Today’s Class: inter-domain routing & BGP Quickly go over: SNMP! Move on to media access control protocols If time, start talking about WiFi! CSci4211: Weekly Summary 122 Routing in the Internet • The Global Internet consists of Autonomous Systems (AS) interconnected with each other: – Stub AS: small corporation: one connection to other AS’s – Multihomed AS: large corporation (no transit): multiple connections to other AS’s – Transit AS: provider, hooking many AS’s together • Two-level routing: – Intra-AS: administrator responsible for choice of routing algorithm within network – Inter-AS: unique standard for inter-AS routing: BGP CSci4211: Network 123 Layer: Part II Internet Structure Internet: “networks of networks”! International lines IXPs or private peering National or tier-1 ISP National or tier-1 ISP Regional or local ISP company university Internet eXcange Points Regional ISPs local ISPs company LANs Home users access via WiFi hotspots Home users CSci4211: Introduction 124 Customers and Providers provider provider IP traffic customer customer Customer pays provider for access to the Internet CSci4211: Network Layer: Control Plane Part II 125 The Peering Relationship peer provider traffic allowed Peers provide transit between their respective customers peer customer traffic NOT allowed CSci4211: Peers do not provide transit between peers Peers (often) do not exchange $$$ Network Layer: Control Plane Part II 126 Peering Provides Shortcuts Peering also allows connectivity between the customers of “Tier 1” providers. CSci4211: peer provider Network Layer: Control Plane Part II peer customer 127 BGP Basics BGP session: two BGP routers (“peers”) exchange BGP messages over semi-permanent TCP connection: • advertising paths to different destination network prefixes (BGP is a “path vector” protocol) • when AS3 gateway router 3a advertises path AS3,X to AS2 gateway router 2c: – AS3 promises to AS2 it will forward datagrams towards X AS 1 AS 3 1b 1a 1c 3b 3a AS 2 1d 2b 2a 3c 3d 2c X BGP advertisement: AS3, X 2d CSci4211: Network Layer: Control Plane Part II 128 AS Path Attribute AS 1129 135.207.0.0/16 AS Path = 1755 1239 7018 6341 135.207.0.0/16 AS Path = 1239 7018 6341 AS 1239 Sprint 135.207.0.0/16 AS Path = 6341 AS 1755 Ebone Global Access 135.207.0.0/16 AS Path = 1129 1755 1239 7018 6341 ASRIPE 12654 NCC 135.207.0.0/16 AS Path = 7018 6341 AS7018 RIS project 135.207.0.0/16 AS Path = 3549 7018 6341 AT&T AS 6341 135.207.0.0/16 AS Path = 7018 6341 AT&T Research 135.207.0.0/16 Prefix Originated AS 3549 Global Crossing How to detect loop using AS path? CSci4211: Network Layer: Control Plane Part II 129 BGP: AS Path Advertisement and Policy Routing Suppose: gateway X send its path to peer gateway W • W may or may not select path offered by X – cost, policy (don’t route via competitors AS), loop prevention reasons – Policy-based Routing Selection (using BGP attributes) • If W selects path advertised by X, then: Path (W,Z) = W, Path (X,Z) • Note: X can control incoming traffic by controlling its route advertisements to peers: – e.g., don’t want to route traffic to Z don’t advertise any routes to Z – route filtering and export policy (by manipulating attributes) CSci4211: Network Layer: Control Plane Part II 130 BGP Attributes Value ----1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... 255 Code --------------------------------ORIGIN AS_PATH NEXT_HOP MULTI_EXIT_DISC LOCAL_PREF ATOMIC_AGGREGATE AGGREGATOR COMMUNITY ORIGINATOR_ID CLUSTER_LIST DPA ADVERTISER RCID_PATH / CLUSTER_ID MP_REACH_NLRI MP_UNREACH_NLRI EXTENDED COMMUNITIES Reference --------[RFC1771] [RFC1771] [RFC1771] [RFC1771] [RFC1771] [RFC1771] [RFC1771] [RFC1997] [RFC2796] [RFC2796] [Chen] [RFC1863] [RFC1863] [RFC2283] [RFC2283] [Rosen] reserved for development From IANA: http://www.iana.org/assignments/bgp-parameters CSci4211: Network Layer: Control Plane Part II Most important attributes Not all attributes need to be present in every announcement 131 BGP Route Processing Open ended programming. Constrained only by vendor configuration language Receive Apply Policy = filter routes & BGP Updates tweak attributes Apply Import Policies Based on Attribute Values Best Routes Best Route Selection Best Route Table Apply Policy = filter routes & tweak attributes Transmit BGP Updates Apply Export Policies Install forwarding Entries for best Routes. IP Forwarding Table CSci4211: Network Layer: Control Plane Part II 132 BGP Route Selection • router may learn about more than one route to destination AS, selects route based on: 1. 2. 3. 4. local preference value attribute: policy decision shortest AS-PATH closest NEXT-HOP router: hot potato routing additional criteria … CSci4211: Network Layer: Control Plane Part II 133 Tweak Tweak Tweak • • For inbound traffic – Filter outbound routes – Tweak attributes on outbound routes in the hope of influencing your neighbor’s best route selection For outbound traffic – Filter inbound routes – Tweak attributes on inbound routes to influence best route selection inbound traffic outbound traffic outbound routes inbound routes In general, an AS has more control over outbound traffic CSci4211: Network Layer: Control Plane Part II 134 BGP: Controlling Who Routes to You legend: B W provider network X A customer network: C Y a simple BGP scenario Export Policy for a Provider AS? Export Policy for a Customer AS? • A,B,C are provider networks • X,W,Y are customer (of provider networks) • X is dual-homed: attached to two networks – C tells X networks belonging to C, i.e., a route to them via C – X does not want to carry traffic from B via X to C – .. so X will not advertise to B any route to networks in C learned from C CSci4211: Network Layer: Control Plane Part II 135 BGP: Controlling Who Routes to You legend: B W provider network X A customer network: C Y a simple BGP scenario Export Policy for a Peer AS? • A advertises to B the path AW What about route selection? •which should you prefer? a • B advertises to X the path BAW • Should B advertise to C the path BAW? route learned from a customer – No way! B gets no “revenue” for routing AS, a peer AS or a provider AS? CBAW since neither W nor C are B’s customers Hint: think how money flows! – B wants to force C to route to W via A – B wants to route only to/from its customers! CSci4211: Network Layer: Control Plane Part II 136 eBGP vs. iBGP Sessions • eBGP: between (usually directly-connected) routers in different Ass • iBGP: between (BGP-speaking) routers in same AS • Different (operational) rules and polices apply! AS 1239 AS 7007 XP AS 701 AS 6079 AS 4006 CSci4211: Routing and Network Layer Part II 137 iBGP (different from IGP such as OSPF) • iBGP speakers are (usually) fully meshed: why? eBGP session AS 3847 iBGP session A both running on top of TCP! F E C CSci4211: Routing and Network Layer Part II D B 138 eBGP vs. iBGP: Key Differences eBGP Rules: • By default, only talks to directly-connected router. • Sends the one best BGP route for each destination. • Sends all of the important “attributes”; omits the “local preference” attribute. • Adds (prepends) the speaker’s ASN to the “ASPath” attribute. • Usually rewrites the “next-hop” attribute. CSci4211: Routing and Network Layer Part II 139 eBGP vs. iBGP: Key Differences iBGP Rules: • Can talk to routers many hops away by default. • Can only send routes it “injects”, or routes heard directly from an external peer. • Thus, requires a full mesh. • Sends all attributes. • Leaves the “as-path” attribute alone. • Doesn’t touch the “next hop” attribute. • With iBGP, next-hop is not a router directly connected. – So a “recursive lookup” is needed. – After the next-hop is found, a second lookup is made to figure out how to send the packet “in the direction” of the next-hop. CSci4211: Routing and Network Layer Part II 140 Intra-AS and Inter-AS Routing C.b a C A.a b A.c d A “Gateways”: B.a a c b a c B b •perform interAS routing amongst themselves •perform intraAS routers with other routers in their AS network layer inter-AS, intra-AS routing in gateway A.c CSci4211: link layer physical layer Network Layer: Control Plane Part II 141 CSci4211: Weekly Summary 142 Reminder (Dec 7) Project #4 is due this Friday (Dec 9 11:55pm) ! Final exam: Dec 21 (Wednesday) 6:30pm -8:30pm, in-class (about 2 hours) Will post a sample final exam by this Friday • Please work on it alone, say, this weekend; before next Wednesday’s class Next Wednesday’s Lecture: • • catch-up, wrap-up and summary; go over sample final solutions; Q&A CSci4211: Weekly Summary 143 Quiz II Stats Total: 125 Max 123 Median 102 Average 93.78 Min 29 But three students did not submit their Quiz II CSci4211: Weekly Summary 144 What We Learned Last Time (Dec 7) Review & re-cap inter-domain routing BGP • policy routing using path vector (& other attributes) • AS relationships & routing policies: best route selection: routes from a customer, a peer, vs. provider what routes to export: for a route learned from a customer, should an AS advertise it to another custom, a peer vs. to a provider? What about a router learned from a peer or a provider? Data Link Layer Revisited: • framing and “byte stuffing”; • Point-to-point protocol: PPP • Media Access Control Protocols: basic taxonomy: i) static channel allocation; ii) on-demand adaptive (polling, “taking turns”); iii) random access Random Access MAC: Aloha, slotted Ahoha, CSMA/CD Ethernet: collision detection, collision domain, exp. back-off efficiency vs. complexity of MAC protocols CSci4211: Weekly Summary 145 Taxonomy of MAC Protocols CSMA/CA (WiFi/802.11) polling CSci4211: Data Link Layer: Part 2 146 Ethernet and IEEE 802.3 1-persistent CSMA/CD • Carrier sense: station listens to channel first – Listen before talking • If idle, station may initiate transmission – Talk if quiet • Collision detection: continuously monitor channel – Listen while talking • If collision, stop transmission – One talker at a time CSci4211: Data Link Layer: Part 2 147 Ethernet CSMA/CD Algorithm 1. Adaptor gets datagram from and 4. If adapter detects another creates frame transmission while transmitting, aborts and sends jam signal 2. If adapter senses channel idle, it starts to transmit frame. If 5. After aborting, adapter enters it senses channel busy, waits exponential backoff: after the until channel idle and then mth collision, adapter chooses a transmits K at random from {0,1,2,…,2m-1}. Adapter waits 3. If adapter transmits entire K*512 bit times and returns to frame without detecting Step 2 another transmission, the adapter is done with frame ! 6. Quit after 16 attempts, signal Signal to network layer to network layer “transmit “transmit OK” error” CSci4211: Data Link Layer: Part 2 148 Ethernet’s CSMA/CD (more) Jam Signal: make sure all other transmitters are aware of collision; 48 bits; Bit time: .1 microsec for 10 Mbps Ethernet ; for K=1023, wait time is about 50 msec See/interact with Java applet on AWL Web site: highly recommended ! CSci4211: Exponential Backoff: • Goal: adapt retransmission attempts to estimated current load – heavy load: random wait will be longer • first collision: choose K from {0,1}; delay is K x 512 bit transmission times • after second collision: choose K from {0,1,2,3}… • after ten collisions, choose K from {0,1,2,3,4,…,1023} Data Link Layer: Part 2 149 IEEE 802.3 Parameters • 1 bit time = time to transmit one bit – 10 Mbps 1 bit time = 0.1 microseconds ( m s) • Maximum network diameter <= 2.5km – Maximum 4 repeaters • “Collision Domain” – Distance within which collision can be detected – IEEE 802.3 specifies: worst case collision detection time: 51.2 m s • Why minimum frame size? – 51.2 m s => minimum # of bits can be transited at 10Mpbs is 512 bits => 64 bytes is required for collision detection CSci4211: Data Link Layer: Part 2 150 Worst Case Collision Detection Time CSci4211: Data Link Layer: Part 2 151 CSMA/CD Efficiency Relevant parameters – cable length, signal speed, frame size, bandwidth • Tprop = max prop between 2 nodes in LAN • ttrans = time to transmit max-size frame • Efficiency goes to 1 as tprop goes to 0 • Goes to 1 as ttrans goes to infinity • Much better than ALOHA, but still decentralized, simple, and cheap CSci4211: Data Link Layer: Part 2 152 Ethernet Frame Format Sending adapter encapsulates IP datagram (or other network layer protocol packet) in Ethernet frame DIX frame format 8 bytes Preamble 6 Dest addr 6 Src addr 2 Type 0-1500 Data 4 CRC IEEE 802.3 format 8 bytes Preamble 6 Dest addr 6 Src addr 2 0-1500 Length Data 4 CRC • Ethernet has a maximum frame size: data portion <=1500 bytes • It has imposed a minimum frame size: 64 bytes (excluding preamble) If data portion <46 bytes, pad with “junk” to make it 46 bytes Q: Why minimum frame size in Ethernet? CSci4211: Data Link Layer: Part 2 153 CSci4211: Weekly Summary 154 Reminder (Dec 14) Final exam: Dec 21 (Wednesday) 6:30pm -8:30pm, in-class (about 2 hours; upto 3 hours) Venus: this classroom CSci4211: Weekly Summary 155 Data Link Layer Summary & What We Learned Last Time (Dec 7) Media Access Control & MAC Protocols: Summary Shared Media: issues and difficulties Taxonomy of MAC Protocols Random Access Control: •ALOHA and Slotted ALOHA • CSMA: nonpersistent vs. p-persistent • CSMA/CD •What are they? How do they work? Adaptive Controlled Access: • token passing vs. polling Efficiency of MAC protocols: light vs. heavy load Ethernet (802.3) •MAC: 1-persistent CSMA/CD, binary random backoff • collision domain, bit-time and min. frame size • 10BaseT, 100 BaseT (Fast Ethernet), Gigabit Ethernet CSci4211: Weekly Summary 156 Data Link Layer Summary & What We Learned Last Time (Dec 7) Token Ring (802.5) • token passing & ring maintenance issues (e.g., monitor) 802.11b and Wireless LAN: key issues & difficulties: • hidden terminal problem, power saving requirement receiver acknowledgement needed! • how does it work? SIFS < DIFS CSMA/CA: how does it work? RTS, CTS, NAV 802.11 frame format & frame forwarding via APs • Why 3 (or 4) addresses? How are they used? • a translational bridge/switch (and non-transparent): mobile devices need to explicitly associate w/ AP, know its MAC address; in contrast to Ethernet switches! WiFi Access Point (AP): connecting WiFi & Ethernet Quickly: cellular networks; today: wide-area mobility CSci4211: Weekly Summary 157 Wireless Network Characteristics (again!) Multiple wireless senders and receivers create additional problems (beyond multiple access): C A B A B Hidden terminal problem • B, A hear each other • B, C hear each other • A, C can not hear each other means A, C unaware of their interference at B C C’s signal strength A’s signal strength space Signal fading: • B, A hear each other • B, C hear each other • A, C can not hear each other interferring at B CSci4211 802.11 Wireless and Mobile Networks 158 IEEE 802.11: Multiple Access • avoid collisions: 2+ nodes transmitting at same time • 802.11: CSMA - sense before transmitting – don’t collide with ongoing transmission by other node • 802.11: no collision detection! – difficult to receive (sense collisions) when transmitting due to weak received signals (fading); • often need to switch between transmitting vs. receiving mode – can’t sense all collisions in any case: hidden terminal, fading – goal: avoid collisions: CSMA/C(ollision)A(voidance) A C A B B C C’s signal strength A’s signal strength space CSci4211 802.11 Wireless and Mobile Networks 159 IEEE 802.11 MAC Protocol: CSMA/CA 802.11 sender 1 if sense channel idle for DIFS then transmit entire frame (no CD) 2 if sense channel busy then start random backoff timer timer counts down while channel idle transmit when timer expires sender receiver DIFS if no ACK (e.g., due to collision or bit error), increase random backoff interval, repeat 2 802.11 receiver - if frame received OK data SIFS ACK return ACK after SIFS (ACK needed due to hidden terminal problem) CSci4211 802.11 Wireless and Mobile Networks 160 Collision Avoidance Mechanisms • Problem: – two nodes, hidden from each other, transmit complete frames to base station – wasted bandwidth for long duration ! • Solution: – small reservation packets – nodes track reservation interval with internal “network allocation vector” (NAV) CSci4211 802.11 Wireless and Mobile Networks 161 Avoiding Collisions (cont’d) idea: allow sender to “reserve” channel rather than random access of data frames: avoid collisions of long data frames • sender first transmits small request-to-send (RTS) packets to BS using CSMA – RTSs may still collide with each other (but they’re short) • BS broadcasts clear-to-send CTS in response to RTS • RTS heard by all nodes – sender transmits data frame – other stations defer transmissions Avoid (large) data frame collisions using small reservation packets! CSci4211 802.11 Wireless and Mobile Networks 162 Collision Avoidance: RTS-CTS Exchange • sender transmits short RTS (request to send) packet: indicates duration of transmission • receiver replies with short CTS (clear to send) packet – notifying (possibly hidden) nodes • hidden nodes will not transmit for specified duration: NAV CSci4211 802.11 Wireless and Mobile Networks 163 Collision Avoidance: RTS-CTS Exchange A AP B reservation collision DATA (A) defer time CSci4211 802.11 Wireless and Mobile Networks 164 802.11 Frame: Addressing 2 2 6 6 6 frame address address address duration control 1 2 3 2 6 seq address 4 control 0 - 2312 4 payload CRC Address 4: used when frames are Address 1: MAC address forwarded from one of wireless host or AP Address 3: MAC address AP to another AP to receive this frame of original (i.e., actual!) (MAC address of source or destination actual source) Address 2: MAC address when frames are forwarded by AP of wireless host or AP transmitting this frame CSci4211 802.11 Wireless and Mobile Networks 165 802.11 Frame: More frame seq # (for reliable ARQ) duration of reserved transmission time (RTS/CTS) 2 2 6 6 6 frame address address address duration control 1 2 3 2 Protocol version 2 4 1 Type Subtype To AP 6 2 1 seq address 4 control 1 From More AP frag 1 Retry 1 0 - 2312 4 payload CRC 1 Power More mgt data 1 1 WEP Rsvd frame type (RTS, CTS, ACK, data) CSci4211 802.11 Wireless and Mobile Networks 166 802.11 Frame: Addressing Internet R1 router H1 AP Not AP’s MAC address! R1 MAC addr H1 MAC addr dest. address source address 802.3 frame AP MAC addr H1 MAC addr R1 MAC addr address 1 address 2 To-AP=1; From-AP=0; address 3 802.11 frame CSci4211 802.11 Wireless and Mobile Networks 167 802.11 Frame: Addressing Internet R1 router H1 AP H1 MAC addr R1 MAC addr dest. address source address 802.3 frame H1 MAC addr AP MAC addr R1 MAC addr address 1 address 2 To-AP=0; From-AP=1; address 3 802.11 frame CSci4211 802.11 Wireless and Mobile Networks 168 802.11: Mobility within Same Subnet • H1 remains in same IP subnet: IP address can remain same • switch: which AP is associated with H1? – self-learning (Ch. 6): switch will see frame from H1 and “remember” which switch port can be used to reach H1 router hub or switch BBS 1 AP 1 AP 2 H1 CSci4211 802.11 Wireless and Mobile Networks BBS 2 169 CSci4211: Weekly Summary 170