* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Networking Basics - Undergraduate Research in Consumer
IEEE 802.1aq wikipedia , lookup
Net neutrality law wikipedia , lookup
Asynchronous Transfer Mode wikipedia , lookup
Multiprotocol Label Switching wikipedia , lookup
Distributed firewall wikipedia , lookup
Zero-configuration networking wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Deep packet inspection wikipedia , lookup
Computer network wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Network tap wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
Internet protocol suite wikipedia , lookup
Airborne Networking wikipedia , lookup
Routing in delay-tolerant networking wikipedia , lookup
TCP congestion control wikipedia , lookup
Packet switching wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Introduction to Networking Slides adapted from Larry Peterson Outline Applications and Features Statistical Multiplexing Inter-Process Communication Network Architecture Performance Metrics Implementation Issues Summer 2014 NSF/MU REU 1 Goal • Network applications – WWW, email – File sharing, Napster, Facebook – Streaming media, Skype, IPTV • PPLive: http://www.pptv.com/ • YouTube: http://www.youtube.com/ • How does it work? – Scalable connectivity – Cost efficient resource sharing – Support for common services • Course objective: – Understand some basic principles of computer network Summer 2014 NSF/MU REU 2 1 What’s a Network: Key Features • Providing certain services – • Shared resources – • used by many users, often concurrently Basic building blocks – – • transport goods, mail, information or data nodes (active entities): process and transfer goods/data links (passive medium): passive “carrier” of goods/data Typically “multi-hop” – – two “end points” cannot directly reach each other need other nodes/entities to relay Summer 2014 NSF/MU REU 3 What’s a Network: “Nuts and Bolts” View router • • network edge: millions of endsystem devices: – pc’s workstations, servers – PDA’s, phones, toasters running network apps network core: routers, switches forwarding data server workstation mobile local net regional net – packets: packet switching – calls: circuit switching • communication links – fiber, copper, radio, … Summer 2014 company net NSF/MU REU 4 2 Building Blocks • Nodes: PC, special-purpose hardware… – hosts – switches (store-and-forward) • Links: coax cable, optical fiber… – point-to-point (a) – multiple access (b) Summer 2014 ■■■ NSF/MU REU 5 Brief History of the Internet • 70’s: started as a research project, 56 kbps, < 100 computers • 80-83: ARPANET and MILNET split, • 85-86: NSF builds NSFNET as backbone, links 6 Supercomputer centers, 1.5 Mbps, 10,000 computers • 87-90: link regional networks, NSI (NASA), ESNet(DOE), DARTnet, TWBNet (DARPA), 100,000 computers • 90-92: NSFNET moves to 45 Mbps, 16 mid-level networks • 94: NSF backbone dismantled, multiple private backbones • Today: backbones run at >10 Gbps, >600 millions computers in >190 countries Summer 2014 NSF/MU REU 6 3 Sprint Network Seattle Tacoma Click here for a closer look at the Sprint network on the East Coast Click here for a closer look at the Sprint network in Washington state Stockton Cheyenne San Jose Click here for a closer look at the Sprint network in Northern California DS3 OC3 OC12 OC48 Legend New York Pennsauken Relay Wash. DC Chicago Kansas City Roachdale Anaheim Atlanta Pearl City in Hawaii is a future network location Fort Worth Orlando Summer 2014 NSF/MU REU 7 Addressing and Routing • Address: byte-string that identifies a node – usually unique – What other properties? • Routing: process of forwarding messages to the destination node based on its address • Types of addresses – unicast: node-specific – broadcast: all nodes on the network – multicast: some subset of nodes on the network Summer 2014 NSF/MU REU 8 4 Statistical Multiplexing • • • • • • Used in Internet On-demand time-division Schedule link on a per-packet basis Packets from different sources interleaved on link Buffer packets that are contending for the link Buffer (queue) overflow is called congestion ■■■ Summer 2014 NSF/MU REU 9 Inter-Process Communication • Turn host-to-host connectivity into process-to-process communication (to support common services). • Fill gap between what applications expect and what the underlying technology provides. Host Host Application Channel Host Application Host Summer 2014 Host NSF/MU REU 10 5 What Goes Wrong in the Network? • Bit-level errors (electrical interference) • Packet-level errors (congestion) • Link and node failures • Packets are delayed • Packets are deliver out-of-order • Third parties eavesdrop Summer 2014 NSF/MU REU 11 Internet Architecture • Defined by Internet Engineering Task Force (IETF) • Hourglass Design • Application vs Application Protocol (FTP, HTTP) FTP HTTP NV TFTP UDP TCP IP NET 1 Summer 2014 NET 2 NSF/MU REU ■■■ NET n 12 6 Layering: Logical Communication E.g.: transport • • • • • take data from app add addressing, reliability check info to form “datagram” send datagram to peer wait for peer to ack receipt analogy: post office Summer 2014 data application transport transport network link physical ack application transport network link physical network link physical data application transport network link physical NSF/MU REU data application transport transport network link physical 13 Layering: Physical Communication data application transport network link physical application transport network link physical Summer 2014 network link physical application transport network link physical NSF/MU REU data application transport network link physical 14 7 Performance Metrics • Bandwidth (throughput) – data transmitted per time unit – link versus end-to-end (effective bandwidth) – notation • KB = 210 bytes • Mbps = 106 bits per second • Latency (delay) – time to send message from point A to point B – one-way versus round-trip time (RTT) – components Latency = Propagation + Transmit + Queue Propagation = Distance / c Transmit = Size / Bandwidth Summer 2014 NSF/MU REU 15 Socket API • Creating a socket int socket(int domain, int type, int protocol) • domain = PF_INET, PF_UNIX • type = SOCK_STREAM, SOCK_DGRAM, SOCK_RAW • Passive Open (on server) int bind(int socket, struct sockaddr *addr, int addr_len) int listen(int socket, int backlog) int accept(int socket, struct sockaddr *addr, int addr_len) Summer 2014 NSF/MU REU 16 8 Sockets (cont) • Active Open (on client) int connect(int socket, struct sockaddr *addr, int addr_len) • Sending/Receiving Messages int send(int socket, char *msg, int mlen, int flags) int recv(int socket, char *buf, int blen, int flags) Summer 2014 NSF/MU REU 17 Direct Link Networks Point-to-Point Links Shared Access Networks FTP Our goals: understand principles behind data link layer services: HTTP NSF/MU REU TFTP UDP TCP IP NET1 Summer 2014 NV NET 2 ■■■ NETn 18 9 Point-to-Point Links Slides adapted from Larry Peterson Encoding Framing Error Detection Sliding Window Algorithm Summer 2014 NSF/MU REU 19 CRC Example • Message M(x): x7+x4+x3+x1 • Multiply by X3 • C(x)=1101 11111001 1101 10011010000 1101 1001 … 101 10011010 10011010000 remainder • Send 10011010101 Summer 2014 NSF/MU REU 20 10 Acknowledgements & Timeouts Sender Receiver Fram Sender Receiver Fram e e ACK ACK Fram e Duplicated frame ACK (a) (c) Sender Receiver Fram Sender Receiver Fram e e ACK Fram Fram e e Duplicated frame ACK ACK (b) (d) include 1-bit sequence number Summer 2014 NSF/MU REU 21 Sliding Window • Allow multiple outstanding (un-ACKed) frames • Upper bound on un-ACKed frames, called window • How to determine the value of “window”? Sender Summer 2014 NSF/MU REU Receiver 22 11 Timeline Diagram for Sliding Window SWS=RWS=3 frames Timeout= 2 RTT Summer 2014 NSF/MU REU 23 Shared Access Networks Slides adapted from Larry Peterson Outline Bus (Ethernet) Wireless (802.11) (later) Summer 2014 NSF/MU REU 24 12 Ethernet Overview • History – – – – developed by Xerox PARC in mid-1970s roots in Aloha packet-radio network standardized by Xerox, DEC, and Intel in 1978 similar to IEEE 802.3 standard • Media access control (MAC) – CSMA/CD • carrier sense • multiple access • collision detection • Frame 64 Format Preamble 48 48 16 Dest addr Src addr Type Summer 2014 32 Body CRC NSF/MU REU 25 Transmit Algorithm • If line is idle… – send immediately – upper bound message size of 1500 bytes • If line is busy… – wait until idle and transmit immediately – called 1-persistent (special case of p-persistent) Summer 2014 NSF/MU REU 26 13 Algorithm (cont) • If detect collision… – Send jamming signal for 32 bits, then stop transmitting frame – delay and try again • 1st time: delay 0 or 51.2us • 2nd time: 0, 51.2, 102.4, 153.6us • 3rd time: 0, 51.2, 102.4, …, or 7*51.2us • nth time: k x 51.2us, for randomly selected k=0..2n - 1 • give up after several tries (usually 16) • exponential backoff Summer 2014 NSF/MU REU 27 Switching and Forwarding Slides adapted from Larry Peterson Outline Store-and-Forward Switches Bridges and Extended LANs FTP HTTP NV TFTP UDP TCP IP NET1 Summer 2014 NSF/MU REU NET 2 ■■■ NETn 28 14 Scalable Networks • Switch – forwards packets from input port to output port – port selected based on address in packet header T3 T3 STS-1 Switch Input ports T3 T3 STS-1 Output ports • Advantages – cover large geographic area (tolerate latency) – support large numbers of hosts (scalable bandwidth) • Three approaches Summer 2014 NSF/MU REU 29 Datagram Model • There is no round trip delay waiting for connection setup; a host can send data as soon as it is ready. • Source host has no way of knowing if the network is capable of delivering a packet or if the destination host is even up. • Since packets are treated independently, it is possible to route around link and node failures. • Since every packet must carry the full address of the destination, the overhead per packet is higher than for the connection-oriented model. Summer 2014 NSF/MU REU 30 15 Bridges: Traffic Isolation • Bridge installation breaks LAN into LAN segments • bridges filter packets: – same-LAN-segment frames not usually forwarded onto other LAN segments – when frame is to be forwarded, uses CSMA/CD to access segment – segments become separate collision domains collision domain collision domain bridge LAN segment = hub = host LAN segment Extended LAN Summer 2014 NSF/MU REU 31 Learning Bridges • Do not forward when unnecessary – based on MAC dest address • Maintain forwarding table A B C Port 1 Bridge Port 2 X Y Z Host A B C X Y Z Port 1 1 1 2 2 2 • Plug-and-play, self-learning – bridges do not need to be configured – learn table entries based on MAC source address • Always forward broadcast frames Summer 2014 NSF/MU REU 32 16 Internetworking Slides adapted from Larry Peterson Outline FTP Best Effort Service Model Global Addressing Scheme HTTP NV TFTP UDP TCP IP NET1 Summer 2014 NET 2 ■■■ NETn NSF/MU REU 1 The Internet Network layer 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 Summer 2014 NSF/MU REU 2 1 Service Model • Connectionless (datagram-based) • Best-effort delivery (unreliable service) – – – – packets are lost packets are delivered out of order duplicate copies of a packet are delivered packets can be delayed for a long time • Datagram format 0 4 Version 8 16 31 Length Ident TTL 19 TOS HLen Flags Offset Protocol Checksum SourceAddr DestinationAddr Pad (variable) Options (variable) Data Summer 2014 NSF/MU REU 3 Global Addresses • IP address: 32-bit identifier for host, router interface • Properties – globally unique – hierarchical: network + host “class-full” addressing: class • Dot Notation – 10.3.2.4 – 128.96.33.81 – 192.12.69.77 (a) 7 0 24 Network Host 14 (b) 1 0 1 1 16 Network Host 21 (c) Summer 2014 NSF/MU REU 0 Network 8 Host 4 2 Datagram Forwarding • Strategy – – – – – – every datagram contains destination’s address if connected to destination network, then forward to host if not directly connected, then forward to some router forwarding table maps network number into next hop each host has a default router each router maintains a forwarding table • Example (R2) Summer 2014 Network Number 1 2 3 4 Next Hop R3 R1 interface 1 interface 0 NSF/MU REU 5 Routing Slides adapted from Larry Peterson and Rose Outline FTP Algorithms Scalability HTTP TFTP UDP TCP IP NET1 Summer 2014 NV NSF/MU REU NET 2 ■■■ NETn 6 3 Overview • Forwarding vs Routing – forwarding: to select an output port based on destination address and routing table – routing: process by which routing table is built • Network as a Graph A 4 2 1 B C 6 1 3 9 E F 1 D • Problem: Find lowest cost path between two nodes • Factors – static: topology – dynamic: load Summer 2014 NSF/MU REU 7 Routing Algorithm Classification Global or decentralized information? Global: • all routers have complete topology, link cost info • “link state” algorithms Decentralized: • router knows physically-connected neighbors, link costs to neighbors • iterative process of computation, exchange of info with neighbors • “distance vector” algorithms Summer 2014 NSF/MU REU 8 4 Dijkstra’s Algorithm 1 Initialization: 2 N = {A} 3 for all nodes v 4 if v adjacent to A 5 then D(v) = c(A,v) 6 else D(v) = infinity 7 8 Loop 9 find w not in N such that D(w) is a minimum 10 add w to N 11 update D(v) for all v adjacent to w and not in N: 12 D(v) = min( D(v), D(w) + c(w,v) ) 13 /* new cost to v is either old cost to v or known 14 shortest path cost to w plus cost from w to v */ 15 until all nodes in N Summer 2014 NSF/MU REU 9 Dijkstra’s algorithm: example Step 0 1 2 3 4 5 start N A AD ADE ADEB ADEBC ADEBCF D(B),p(B) D(C),p(C) D(D),p(D) D(E),p(E) D(F),p(F) 2,A 1,A 5,A infinity infinity 2,A 4,D 2,D infinity 2,A 3,E 4,E 3,E 4,E 4,E 5 2 A 2 1 Summer 2014 B D 3 C 3 1 5 F 1 E NSF/MU REU 2 10 5 Route Propagation • Know a smarter router – – – – hosts know local router local routers know site routers site routers know core router core routers know everything • Autonomous System (AS) – corresponds to an administrative domain – examples: University, company, backbone network – assign each AS a 16-bit number • Two-level route propagation hierarchy – interior gateway protocol (each AS selects its own) – exterior gateway protocol (Internet-wide standard) Summer 2014 NSF/MU REU 11 Inter-AS routing in the Internet: BGP R4 R5 R3 BGP AS1 AS2 (RIP intra-AS routing) (OSPF intra-AS routing) BGP R1 R2 AS3 (OSPF intra-AS routing) Figure 4.5.2-new2: BGP use for inter-domain routing Adapted from Rose Summer 2014 NSF/MU REU 12 6 Reliable Byte-Stream (TCP) Slides adapted from Larry Peterson Outline Connection Establishment/Termination Sliding Window Revisited FTP HTTP Flow Control Adaptive Timeout TCP NV TFTP UDP IP NET1 Summer 2014 NET 2 ■■■ NSF/MU REU NETn 13 Simple Demultiplexor (UDP) • • • • Unreliable and unordered datagram service Adds multiplexing: (port, host) pair No flow control Endpoints identified by ports – Use well-known port • Header format 0 16 31 SrcPort DstPort Length Checksum Data Summer 2014 NSF/MU REU 14 7 TCP Overview • Connection-oriented • Byte-stream • Full duplex • Flow control: keep sender from overrunning receiver • Congestion control: keep sender from overrunning network – app writes bytes – TCP sends segments – app reads bytes Application process Application process Write bytes Read bytes TCP TCP Send buffer Receive buffer Segment Summer 2014 Segment ■■■ Segment Transmit segments NSF/MU REU 15 Segment Format 0 10 4 16 31 SrcPort DstPort SequenceNum Acknowledgment HdrLen 0 Flags AdvertisedWindow Checksum UrgPtr Options (variable) Data Summer 2014 NSF/MU REU 16 8 Sliding Window Revisited Sending application Receiving application TCP TCP LastByteWritten LastByteAcked LastByteRead LastByteSent NextByteExpected (a) • Sending side • Receiving side – LastByteAcked < = LastByteSent – LastByteSent < = LastByteWritten – buffer bytes between LastByteAcked and LastByteWritten Summer 2014 LastByteRcvd (b) – LastByteRead < NextByteExpected – NextByteExpected < = LastByteRcvd +1 – buffer bytes between NextByteRead and LastByteRcvd NSF/MU REU 17 Congestion Control Slides adapted from Larry Peterson Outline Queuing Discipline Reacting to Congestion Avoiding Congestion FTP HTTP NV TFTP UDP TCP IP NET1 NET 2 ■■■ NETn Resource allocation? Summer 2014 NSF/MU REU 18 9 Issues • Two sides of the same coin – pre-allocate resources so as to avoid congestion – control congestion if (and when) it occurs Source 1 10-M bp s Et hern et Router 1.5-Mbps T1 link Source 2 ps -Mb 100 I FDD Destination Bottleneck router • Two points of implementation – hosts at the edges of the network (transport protocol) – routers inside the network (queuing discipline) • Underlying service model – best-effort (assume for now) – multiple qualities of service (not to be covered) Summer 2014 NSF/MU REU 19 Queuing Discipline • First-In-First-Out (FIFO) – does not discriminate between traffic sources • Fair Queuing (FQ) – explicitly segregates traffic based on flows – ensures no flow captures more than its share of capacity – variation: weighted fair queuing (WFQ) • Problem? – Packet length variation Flow 1 – Needs virtually bit-by-bit round-robin. Flow 2 Round-robin service Flow 3 Flow 4 Summer 2014 NSF/MU REU 20 10 TCP Congestion Control: Additive Increase/Multiplicative Decrease (AIMD) • Objective: adjust to changes in the available capacity • New state variable per connection: CongestionWindow – limits how much data source has in transit MaxWin = MIN(CongestionWindow, AdvertisedWindow) EffWin = MaxWin - (LastByteSent LastByteAcked) • Idea: – increase CongestionWindow when congestion goes down – decrease CongestionWindow when congestion goes up Summer 2014 NSF/MU REU 21 AIMD (cont) Source Destination • Algorithm – increment CongestionWindow by one packet per RTT (linear increase) – divide CongestionWindow by two whenever a timeout occurs (multiplicative decrease) Summer 2014 NSF/MU REU 22 11 AIMD (cont) • Trace: typical sawtooth behavior CongestionWindow 70 60 50 40 30 20 10 1.0 2.0 3.0 Summer 2014 4.0 5.0 6.0 Time (seconds) 7.0 8.0 9.0 NSF/MU REU 10.0 23 Congestion Avoidance • TCP’s strategy – control congestion once it happens – repeatedly increase load in an effort to find the point at which congestion occurs, and then back off • Alternative strategy – predict when congestion is about to happen – reduce rate before packets start being discarded – call this congestion avoidance, instead of congestion control • Two possibilities – router-centric: DECbit and RED Gateways – host-centric: TCP Vegas Summer 2014 NSF/MU REU 24 12 Random Early Detection (RED) • Notification is implicit – just drop the packet (TCP will timeout) – could make explicit by marking the packet • Early random drop – rather than wait for queue to become full, drop each arriving packet with some drop probability whenever the queue length exceeds some drop level Summer 2014 NSF/MU REU 25 Application Layer Slides adapted from Kurose and Ross, Chapter 2 Computer Networking: A Top Down Approach Featuring the Internet, 3rd edition. Jim Kurose, Keith Ross Addison-Wesley, July 2005. FTP HTTP NV TFTP UDP TCP IP NET1 Summer 2014 NSF/MU REU NET 2 ■■■ NETn 26 13 Outline • Content distribution • Principles of app layer protocols – clients and servers – Network Web caching – Content distribution networks – P2P file sharing • Web and HTTP • Electronic Mail – SMTP, POP3, IMAP Summer 2014 NSF/MU REU 27 Security Slides adapted from Larry Peterson Outline Encryption Algorithms Authentication Protocols Message Integrity Protocols Key Distribution Firewalls Summer 2014 NSF/MU REU 28 14 History • • • • • • • • • Telephone (1876, Alexander Graham Bell, AT&T ) Radio,TV (early 20th century) Digital revolution (second half of the 20th century) ARPAnet/early Internet (1969) Personal Computer (late 1970s, IBM, Apples, Intel, Microsoft) Cell phone (late 1970s) WWW/Internet (mid 90s) Laptop/PDA/smartphone/iPod/iPhone/iPad (1990s-2014) Plenty of new opportunities – – – – – • Qualcomm, Yahoo, eBay, Amazon, Google ! Skype (free Internet telephony company, using peer-to-peer networking) PPLive: http://www.pplive.com/en/index.html YouTube: http://www.youtube.com/, Netflix Facebook, Twitter what is now/next? – Convergence of computers, telecom and consumer electronics • Huge market – Apple changed its name in 2007 – Social networking, Cloud & Big Data – Internet of Things Summer 2014 NSF/MU REU Site 29 The Beautiful Web 4.0 3.0 2.0 1.0 30 15 References • • • Peterson and Davie, Computer Networks: A Systems Approach (4th edition), Morgan Kaufmann, ISBN-10: 0123705487 ISBN-13: 9780123705488. J. F. Kurose and K. W. Ross, Computer Networking: a Top-town Approach Featuring the Internet, Addison-Wesley, ISBN: 0-32122735-2. A. S. Tanenbaum, Computer Networks, Prentice Hall, ISBN: 0-13066102-3. Summer 2014 NSF/MU REU 33 17