* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Protocol Stack
Survey
Document related concepts
Multiprotocol Label Switching wikipedia , lookup
TCP congestion control wikipedia , lookup
Asynchronous Transfer Mode wikipedia , lookup
Remote Desktop Services wikipedia , lookup
Distributed firewall wikipedia , lookup
Piggybacking (Internet access) wikipedia , lookup
Computer network wikipedia , lookup
List of wireless community networks by region wikipedia , lookup
Network tap wikipedia , lookup
Wake-on-LAN wikipedia , lookup
Airborne Networking wikipedia , lookup
Zero-configuration networking wikipedia , lookup
Deep packet inspection wikipedia , lookup
Cracking of wireless networks wikipedia , lookup
Recursive InterNetwork Architecture (RINA) wikipedia , lookup
Transcript
Today’s Lecture • Network applications 18-345: Introduction to Telecommunication Networks Lectures 2: Protocol Stack • Requirements • Latency and bandwidth • Internet architecture • Protocols • A layered design • Life of a packet Peter Steenkiste Spring 2015 www.cs.cmu.edu/~prs/nets-ece • Network utilities 1 2 Applications and Application Protocols Client-Server Paradigm • Application: communicating, distributed processes Typical network app has two pieces: client and server Client: • Running in network hosts in “user space” • Exchange messages to implement app • e.g., email, file transfer, the Web application transport network data link physical • Initiates contact with server (“speaks first”) • Typically requests service from server, • For Web, client is implemented in browser; for e-mail, in mail reader • Application protocols • One “piece” of an app • Define messages exchanged by apps and actions taken • User services provided by lower layer protocols Server: application transport network data link physical application transport network data link physical • Provides a service to client • e.g., Web server sends requested Web page, mail server delivers e-mail 3 application transport network data link physical request reply application transport network data link physical 4 Page 1 Yesterday’s Applications FTP: The File Transfer Protocol • FTP: transfer files to a host • No distributed file systems! • Mostly replaced by “the web” – http FTP user interface FTP client user at host • Telnet: use a computer remotely • Similar to ssh today (minus the security) file transfer FTP server remote file system local file system • Transfer file to/from remote host • Client/server model that allows a host (client) to transfer a file to/from another host (server) • Application is a minimal wrapper - a command line “user interface” • Mail: exchange electronic e-mail • Similar today (kind of) • Initially host-to-host: [email protected] • All the heavy lifting is done in the protocol implementation • Project: will learn about HTTP • Already very useful! • Same idea but much richer functionality 5 6 Ftp Commands, Responses FTP: Separate Control, Data Connections Sample Commands: • Ftp client contacts ftp server at port 21, specifying TCP as transport protocol • Two parallel TCP connections opened: • TCP control connection port 21 Control: exchange commands, responses between client, server. “out of band control” • Data: file data to/from server • sent as ASCII text over control channel • USER username • PASS password FTP client TCP data connection port 20 • LIST return list of files in current directory FTP server • RETR filename retrieves (gets) file • Ftp server maintains “state”: current directory, earlier authentication Sample Return Codes • status code and phrase • 331 Username OK, password required • 125 data connection already open; transfer starting • 425 Can’t open data connection • 452 Error writing file • STOR filename stores (puts) file onto remote host 7 8 Page 2 Today’s Applications Requirements • Amazon, Facebook, etc. • Performance: latency and throughput • Network reliability • What matters most? • 2009 quote: “Amazon found every 100ms of latency cost them 1% in sales” • Network service must always be available • Security: for users and the network itself • Video streaming • Privacy, authentication, deal with various attacks, … • Attacks on the network, versus enabled by the network • Accounts for very high percentage of bandwidth • Interactive versus broadcast versus playback • What matters most? • Scalability. • Scale to large numbers of users, traffic flows, … • Skype audio and video conferencing • Manageability: monitoring, enforcing policies, billing, … • Traditional telephone app • What matters most? 9 10 Transport Service Requirements of Common Apps What Service Does an Application Need? Data loss Timing • Some apps (e.g., audio) can tolerate some loss • Other apps (e.g., file transfer, telnet) require 100% reliable data transfer • Some apps (e.g., Internet telephony, interactive games) require low delay to be “effective” • Most apps are flexible Application file transfer e-mail web documents real-time audio/ video stored audio/video interactive games financial apps Bandwidth • Some apps (e.g., multimedia) require minimum amount of bandwidth to be “effective” • Other apps (“elastic apps”) make use of whatever bandwidth they can get 11 Data loss Bandwidth Time Sensitive no loss no loss no loss loss-tolerant elastic elastic elastic audio: 5Kb-1Mb video:10Kb-5Mb same as above few Kbps elastic no no no yes, 100’s msec loss-tolerant loss-tolerant no loss yes, few secs yes, 100’s msec yes and no 12 Page 3 A Closer Look at Packet Delay Cut-through • Sum of a number of different delay components. • Propagation delay on each link. Prop + xmit 2*(Prop + xmit) 2*prop + xmit Store & Forward Packet Delay Components • Proportional to the length of the link • Transmission delay on each link. • Proportional to the packet size and 1/link speed • Processing delay on each router. • Depends on the speed of the router When does cut-through matter? • Queuing delay on each router. • Depends on the traffic load and queue size Next: Routers have finite speed (processing delay) D B C B A A Routers may buffer packets (queueing delay) 13 14 A Word about Units Application-level Delay • What do “Kilo” and “Mega” mean? • Depends on context • Storage works in powers of two. • 1 Byte = 8 bits • 1 KByte = 1024 Bytes • 1 MByte = 1024 Kbytes Delay of one packet • Networks work in decimal units. Average sustained throughput • Network hardware sends bits, not Bytes • 1 Kbps = 1000 bits per second • To avoid confusion, use 1 Kbit/second • Why? Historical: CS versus ECE. Size Delay* + Throughput Units: seconds + bits/(bits/seconds) * For minimum sized packet 15 16 Page 4 Some Examples A Closer Look at Throughput • How long does it take to send a 100 Kbit file? • • When streaming packets, the network works like a pipeline. Assume a perfect world • Is the transfer latency or throughput limited? • What about a 10 Kbit file? Throughput Latency • All links forward different packets in parallel • Throughput is determined by the slowest stage. 100 Kbit/s 1 Mbit/s 100 Mbit/s 500 sec 1.0005 0.1005 0.0105 0.1005 0.0006 0.0015 10 msec 1.01 0.11 0.02 0.11 0.0101 0.011 100 msec 0.2 1.1 0.11 0.2 0.1001 0.101 • Called the bottleneck link • Does not matter why the link is slow! • Low link bandwidth • Many users sharing the link bandwidth 50 37 30 104 59 17 267 17 18 Bandwidth Sharing Fair Sharing of Bandwidth • Bandwidth received on the bottleneck link determines BW end-to-end throughput. • Router before the bottleneck 100 link decides how much bandwidth each user gets. • • All else being equal, fair means that users get equal treatment. • Users that try to send at a higher rate will see packet loss • User bandwidth can fluctuate quickly as flows are added or end, or as flows change their transmit rate. Sounds fair • When things are not equal, we need a policy that determines who gets how much bandwidth. • • Time • 19 Users who pay more get more bandwidth Users with a higher “rank” get more bandwidth Certain classes of applications get priority BW 100 Time 20 Page 5 But It is Not that Simple Today’s Lecture • Network applications • Requirements • Latency and bandwidth • Internet architecture • Protocols • A layered design • Life of a packet Bottleneck • Network utilities 21 22 Lots of Protocols (and Acronyms!) • • • • • • • • • • • What are Protocols? IP: Internet protocol UDP: User datagram protocol TCP: Transmission control protocol FTP: File transfer protocol SMTP: Simple mail transfer protocol HTTP: Hypertext transfer protocol ARP: Address resolution protocol BGP: Border gateway protocol ICMP: Internet control message protocol DHCP: Dynamic host configuration protocol And many more … • An agreement between parties on how communication should take place Friendly greeting • Module in layered structure Muttered reply • Protocols define: Interface to peer (syntax & semantics) • • • Actions taken on receipt of a messages Format and order of messages Error handling, termination, ordering of requests, etc. • Example: Buying airline ticket Destination? Pittsburgh Thank you 23 24 Page 6 Solution #1 How to Design a Network? • Has many users • Offers diverse services • Mixes very diverse technologies Operating System Application Links • Components built by many companies • Diverse ownership • Can evolve over time TCP Router Software Operating System (many protocols) Application Tw. Pair FTP Wireless HTTP UDP The Network Coax DNS Computer Network Interface Router Hardware Computer Bridge HW/SW 25 26 Solution #2? Web Optical Telnet Web Protocol Software Voice FTP Solution #3 Telnet Voice Web Video FTP Telnet Voice Intermediate Layer Tw. Pair Coax Optical Wireless Tw. Pair 27 28 Page 7 Coax Optical Wireless Protocol and Service Levels Types of Protocols host host host Application host host host host Application Channel • Core network: responsible for transferring data between a sending and receiving host. • End-to-end protocols: present a network service to applications and users. Host to Host • May add value to the core network protocols Hardware • Driven by differences in constraints: scalability, power, management, speed, etc. Layering: modular approach to network functionality 30 29 Layering Characteristics A Layer Network Model • Each layer relies on services from layer below and exports services to layer above • Interface defines interaction with peer on other hosts – called protocols • Modules hide implementation - layers can change without disturbing other layers (black box) The Open Systems Interconnection (OSI) Model 7 Application Application 6 Presentation Presentation 5 Session Session 4 Transport Transport 3 Network Network Network Network 2 Data link Data link Data link Data link 1 Physical Physical Physical Physical 32 31 Page 8 OSI Model: 7 Protocol Layers Different Sources of Components • • • • • • • • Application: web server/browser, mail, distributed game,.. • Presentation/session Physical: how to transmit bits Data link: how to transmit frames Network: how to route packets Transport: how to send packets end2end Session: how to tie flows together Presentation: byte ordering, security Application: everything else • Often part of application • Transport/network • Typically part of the operating system • Datalink • Often written by vendor of the network interface hardware • TCP/IP has been amazingly successful, and it is not based on a rigid OSI model. The OSI model has been very successful at shaping thought • Physical • Hardware: card and link Application Presentation Session Transport Network Data link Physical 34 33 The Internet Engineering Task Force Application & Upper Layers • Standardization is key to network interoperability • Application Layer: Provides services that are frequently required by applications: DNS, web acess, file transfer, email… • Presentation Layer: machineindependent representation of data… • Session Layer: dialog management, recovery from Mostly errors, … incorporated into Application Layer • The hardware/software of communicating parties are often not built by the same vendor yet they can communicate because they use the same protocol Application Application Application Application Layer Layer Presentation library Layer sockets Session Transport Layer Layer Transport Layer • Internet Engineering Task Force • Based on working groups that focus on specific issues • Request for Comments • Document that provides information or defines standard • Requests feedback from the community • Can be “promoted” to standard under certain conditions • consensus in the committee • interoperating implementations • Project 1 will look at the Internet Relay Chat (IRC) RFC 35 36 Page 9 Life of Packet Layer Encapsulation User A Application User B Presentation Get index.html Session Transport Connection ID Network Data Link Source/Destination Physical Link Address Host Bridge/Switch Router/Gateway Host 37 38 Multiplexing and Demultiplexing • There may be multiple implementations of each layer. • Multiple choices at each layer TCP TCP IP IP • How does the receiver know what version of a layer to use? • Each header includes a demultiplexing field that is used to identify the next layer. • Filled in by the sender • Used by the receiver • Multiplexing occurs at multiple layers. E.g., IP, TCP, … Protocol Demultiplexing FTP HTTP NV TCP V/HL TOS ID TTL UDP Length IPX Flags/Offset Prot. TFTP H. Checksum NET1 Source IP address Network IP Type Field Protocol Field TCP/UDP IP NET2 … NETn Port Number Destination IP address Options.. 39 40 Page 10 Server and Client The Internet Protocol Suite Server and Client exchange messages over the network through a common Socket API FTP Clients Server user space ports HTTP NV TCP Socket API TCP/UDP IP IP Ethernet Adapter Ethernet Adapter UDP TCP UDP Narrow Waist IP TCP/UDP Applications TFTP Data Link kernel space NET1 NET2 … NETn Physical The Hourglass Model The waist facilitates interoperability … but evolution is hard hardware 41 IP based on a Minimalist Approach Today’s Lecture • Dumb network • Network applications • IP provide minimal functionalities to support connectivity 42 • Requirements • Latency and bandwidth • Addressing, forwarding, routing • Smart end system • Transport layer or application performs more sophisticated functionalities • Internet architecture • Flow control, error control, congestion control • A layered design • Protocols • Life of a packet • Advantages • Accommodate heterogeneous technologies (Ethernet, modem, satellite, wireless) • Support diverse applications (telnet, ftp, Web, X windows) • Decentralized network administration • Network utilities 44 45 Page 11 Network tools • • • • • ping • Application to determine if host is reachable • Based on Internet Control Message Protocol • ICMP informs source host about errors encountered in IP packet processing by routers or by destination host • ICMP Echo message requests reply from destination host • PING sends echo message & sequence # • Determines reachability & round-trip delay • Sometimes disabled for security reasons ping traceroute ipconfig tcpdump … 46 ipconfig traceroute • Find route from local host to a remote host • Time-to-Live (TTL) • Utility in Microsoft Windows to display TCP/IP information about a host • Many options • IP packets have TTL field that specifies maximum # hops traversed before packet discarded • Each router decrements TTL by 1 • When TTL reaches 0 packet is discarded • Simplest: IP address, subnet mask, default gateway for the host • Information about each IP interface of a host • Traceroute • • • • Send UDP to remote host with TTL=1 First router will reply ICMP Time Exceeded Message Send UDP to remote host with TTL=2, … Each step reveals next router in path to remote host • DNS hostname, IP addresses of DNS servers, physical address of network card, IP address, … • Renew IP address from DHCP server • tracert (windows), tracepath (linux) Page 12 tcpdump and Network Protocol Analyzers netstat • Queries a host about TCP/IP network status • Status of network drivers & their interface cards • tcpdump program captures IP packets on a network interface (usually Ethernet NIC) • Filtering used to select packets of interest • Packets & higher-layer messages can be displayed and analyzed • tcpdump basis for many network protocol analyzers for troubleshooting networks • We use the open source Ethereal analyzer to generate examples (or wireshark, etc.) • www.ethereal.com • #packets in, #packets out, errored packets, … • State of routing table in host • TCP/IP active server processes • TCP active connections How the layers work together: Network Analyzer Example Top Pane shows frame/packet Ethereal windows sequence Middle Pane shows encapsulation for a given frame Internet User clicks on http://www.nytimes.com/ Ethereal network analyzer captures all frames observed by its Ethernet NIC (or Wireshark) Sequence of frames and contents of frame can be examined in detail down to individual bytes Bottom Pane shows hex & text Page 13 Top pane: frameTCP sequence Connection DNS Query Setup Middle pane: Encapsulation HTTP Request & Response Ethernet Frame Ethernet Destination and Source Addresses Protocol Type Middle pane: Encapsulation MiddleAnd pane: a lot ofEncapsulation other stuff! TCP Segment IP Packet Source and Destination Port Numbers IP Source and Destination Addresses GET HTTP Request Protocol Type Page 14