EECE 350 – Computer Networks Textbook Computer Networking: A Top Down Approach 6th edition Jim Kurose, Keith Ross Addison-Wesley, 2012 Many slides are based on material provided by the authors. The authors retain the copyright to their material. Online and computer tools Moodle Python http://www.pythonlearn.com http://www.learnstreet.com/lessons/python OPNET Wireshark Other tools Focus is on the Internet Largest network of networks that connects everything Huge impact changed the way we consume and produce information changed the way we relate to each other can you imagine life without it? Pope Francis on January 23, 2014 • “This is something truly good, a gift from God” What is the Internet: “nuts and bolts” view millions PC server wireless laptop smartphone of connected computing devices: hosts = end systems running network apps communication wireless links wired links links fiber, copper, radio, satellite transmission rate: bits per second Packet router switches: forward “packets” (chunks of data) routers and switches mobile network global ISP home network regional ISP institutional network ISP: Internet Service Provider What is the Internet: “nuts and bolts” view The Internet Protocol (IP) is a protocol, or set of rules, for routing and addressing packets of data so that they can travel across networks and arrive at the correct destination. Internet: “network of networks” mobile network Interconnected ISPs protocols control sending, receiving of messages e.g., TCP, IP, HTTP, 802.11 global ISP Internet standards home network RFC: Request for comments IETF: Internet Engineering Task Force IEEE An ISP (internet service provider) is a company that provides individuals and organizations access to the internet and other related services. An internet standard (STD) is a specification that has been approved by the Internet Engineering Task Force (IETF). Such standard helps to promote a consistent and universal use of the internet worldwide. institutional network regional ISP What is the Internet: a service view Infrastructure that provides services to applications Web, VoIP, messaging, email, games, e-commerce, video, social networks, … provides a platform for apps through a programming interface (API) hooks that allow sending and receiving app programs to “connect” to Internet provides service options, analogous to postal service mobile network global ISP home network institutional network regional ISP What is a protocol? human protocols: “what’s the time?” “I have a question” introductions … specific messages sent … specific actions taken when messages received, or other events network protocols: machines rather than humans all communication activity in Internet governed by protocols protocols define format and order of messages sent and received among network entities, and actions taken on message transmission, receipt, or other event What is a protocol? a human protocol and a computer network protocol: Hi connection request Hi connection response Got the time? GET http://www.aub.edu.lb 12:30 <file> time Network Scale Networks can be classified by their scale: Scale Type Vicinity PAN (Personal Area Network) Building LAN (Local Area Network) City MAN (Metropolitan Area Network) Country WAN (Wide Area Network) Planet The Internet (network of networks) CN5E by Tanenbaum & Wetherall, © Pearson EducationPrentice Hall and D. Wetherall, 2011 Personal Area Network Connect devices over the range of a person Example of a Bluetooth (wireless) PAN: CN5E by Tanenbaum & Wetherall, © Pearson EducationPrentice Hall and D. Wetherall, 2011 Local Area Networks Connect devices in a home or office building Called enterprise network in a company Wireless LAN with Wi-Fi (802.11) Wired LAN with “switched Ethernet” CN5E by Tanenbaum & Wetherall, © Pearson EducationPrentice Hall and D. Wetherall, 2011 Metropolitan Area Networks Connect devices over a metropolitan area Example MAN based on cable TV: CN5E by Tanenbaum & Wetherall, © Pearson EducationPrentice Hall and D. Wetherall, 2011 Wide Area Networks (1) Connect devices over a country Example WAN connecting three branch offices: CN5E by Tanenbaum & Wetherall, © Pearson EducationPrentice Hall and D. Wetherall, 2011 Wide Area Networks (2) An ISP network is also a WAN Customers buy connectivity from the ISP to use it CN5E by Tanenbaum & Wetherall, © Pearson EducationPrentice Hall and D. Wetherall, 2011 Internet Challenges There are many challenges that make designing the Internet harder than just sending bits on a wire and that make the study of computer networks more interesting… Following 10 slides based on Dr. Scott Shenker’s EE 122 course at Berkeley Scale Billions of Internet human users…. Potentially hundreds of billions of devices Diversity of end systems Cell phones / smartphones Tablets Laptops/PCs Televisions Gaming consoles Sensing devices Picture frames Security systems Supercomputer clusters Automobiles Power grid …… Diversity of application requirements Size of transfers Bi-directionality (or not) Latency sensitive (or not) Tolerance to jitter (or not) Tolerance to packet drop (or not) Need for reliability (or not) Multipoint (or not) ….. Dynamic Range Round-trip times (latency) from 10 secs to secs 5 orders of magnitude Data rates (bitrate) from kbps (kilo bits per second) to 100 Gbps 8 orders of magnitude Queuing delays in the network vary from 0 to several secs Packet loss varies from 0 to more than 90% ….. Ad hoc deployment Can’t assume carefully managed deployment Network must work without planning! Ad Hoc deployment. Principle. This type of deployment allows you to distribute your application on an iPhone or iPad device. Networks contain many components Links Interfaces Fibers Ethernet card Switches/routers Large router Wireless card Coaxial Cable 22 Small switch They can all fail…. Consider communication that uses 50 components Assume that each works correctly 99% of the time What is the likelihood that communication fails? Answer: success requires that they all function, so failure probability = 1 – (.99)50 ≈ 39.5% Approximately 40% probability of failure Even if components are 99.9% reliable, failure probability is still close to 5% Must design the system to expect failure in components but not fail as a system! Physics challenge - Speed of Light Question: how long does it take light to travel from Beirut to Paris? Answer: Distance Beirut Paris: 2,840 km Traveling at 300,000 km/s: 9.5 msec Implications for Networking Question: how many cycles does your PC execute before it can possibly get a reply to a message it sent to a web server in Paris? Answer: Round trip takes 20 msec (optimistic) PC runs at (say) 2.4 GHz 2,400,000,000 cycles/s ✕ 0.02 sec = 48,000,000 cycles A long time even on Local Area Networks with a round trip time in microseconds Summary The Internet is a large complicated system that must meet an unprecedented variety of challenges Scale Diversity Dynamic range Ad hoc deployment Failures … Security … Politics How do we deal with complexity Divide the problem into smaller more manageable parts Complex problem transformed into several less complex problems Design exercise Design a postal system for people in Lebanon to exchange (paper) messages Layered network architecture your application different entities with different IP addresses within each entity we sub entities that will be differentiated by mini IP addresses. -point to point connectivity -hardware connectivity Example of a layered network system From Computer Networks: A Systems Approach, 5e. Copyright © 2010, Elsevier Inc. Protocols - again interface: virtual connection point Protocols define the interfaces between the layers in the same system and with the layers of the peer system Each protocol object has two different interfaces service interface: operations on this protocol b/w layer and layer peer-to-peer interface: messages exchanged with within same layer peer Protocols form the building blocks of a network architecture From Computer Networks: A Systems Approach, 5e. Copyright © 2010, Elsevier Inc. Interfaces Service and Peer Interfaces From Computer Networks: A Systems Approach, 5e. Copyright © 2010, Elsevier Inc. Protocol Layers Protocol layering is the main structuring method used to divide up network functionality. • Each protocol talks virtually to its peer but physically it is talking to the layer under it • • • Each layer directly communicates only by using the one below Lower layer services are accessed by an interface At bottom, messages are carried by the “medium” how are you sending the message, ie: how many volts in a bit, or ethernet lower layers are providing services to the upper layers, and upper layers are using the services of the lower layers CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 OSI Reference Model ISO: International Standards Organization OSI: Open Systems Interconnection A principled 7-layer model to connect different systems – Provides functions needed by users merged – Converts different representations it's any application u are using , ie whatsapp, facebook.... how to present the data – Manages synchronization, check-pointing will give each application that's using the internet an address( port numbers) ie, my email client to his email client(specific) – Provides end-to-end delivery dividing apps – Sends packets over multiple links – Sends frames of information point to point, from one hardware address to another one – Sends bits as signals how are you actually sending,ie signals.... it is end to end, but also host to host kind of protocol; its responsibilty is to send packets to the multiple links, it should be able to know the best , fastest route; it is able to route packets from any source to any destination. ISO/OSI Seven-Layer Reference Model this is the router, it has 3 layers From Computer Networks: A Systems Approach, 5e. Copyright © 2010, Elsevier Inc. Description of Layers in ISO/OSI we go bottom up Physical Layer (Layer 1) Handles the transmission of raw bits over a communication link (medium) Data Link Layer (Layer 2) mac address Collects a stream of bits into a larger aggregate called a frame Hardware/software • Network adapter and device driver implement the protocol in this layer Frames are delivered over a single link Network Layer (Layer 3) those 3 layers are available in any networking device Handles “routing” among nodes within a network Unit of data exchanged between nodes in this layer is called a packet (datagram on the Internet) The lower three layers are implemented on all network nodes From Computer Networks: A Systems Approach, 5e. Copyright © 2010, Elsevier Inc. Description of Layers Transport Layer (Layer 4) Implements process-to-process end-to-end communication “channel” Unit of data exchange in this layer is called a message or segment Session Layer (Layer 5) http... Concerned with synchronization and check-pointing Presentation Layer (Layer 6) Concerned about the format of data exchanged between peers Application Layer (Layer 7) Standardize application messages The transport layer and the higher layers run only on hosts and not on the intermediate nodes Internet network architecture Application (Layer 7): network applications HTTP, SMTP No Layer 6, no Layer 5 Transport (Layer 4): process-process data transfer TCP, UDP Network (Layer 3): routing of packets or datagrams from source to destination IP, routing protocols Link (Layer 2): data transfer between neighboring network elements Ethernet, 802.11 (Wi-Fi), PPP Physical (Layer 1): bits on medium Application Transport Network Link Physical mac:hardware address IP: virtual address of the machine port nb differentiates b/w the different addresses Encapsulation source message segment HTt H M M datagram H HN n HT M frame HL HN HT M application transport network link physical i write the message. it is given to the servers, the transport layer will encapsulate it and add a header( sar esma segment l message) it adds a port number, with a source and a destination. it goes to the network layer, the segment becomes a datagram. we add another header( IP address of source (ana), and destination(final). now in the link layer, it becomes a frame, so it's gonna add both mac addresses of source and destination we check if It has seen this IP before( within my network), then it will directly allow it, else it will check for a default gateway(router), then we take it to the link layer,and it will add its mac address and the other mac address M HT M H’N HT M H’L H’N HT M destination H’N HT M application transport network link physical H’L H’N HT M layers 1 and 2 are point to point, layers 3, 4 , 5 are end to end network link physical HN HT M Layer-3 router to the switch if there was one the router will take it in, will decapsulate it, and we give it to the network layer that will check the IP address. Again: OSI reference model always 7 layers for this reference model Network standardization Standards define what is needed for interoperability Some of the many standards bodies: Body Area Examples ITU Telecommunications G.992, ADSL H.264, MPEG4 IEEE Communications 802.3, Ethernet 802.11, Wi-Fi IETF Internet RFC 2616, HTTP/1.1 RFC 1034/1035, DNS W3C Web HTML5 standard CSS standard Others? CN5E by Tanenbaum & Wetherall, © Pearson EducationPrentice Hall and D. Wetherall, 2011 k is always 1000 except for file sizes, because of the storage of bits in memory is to the power of 2 ONLY for file sizes Metric units b:bit -1Kb=1024 bits=2^10 bits -1Mb= 2^20 bits The main prefixes we use: Prefix Exp. 1B(1 byte)= 8 bits prefix exp. K(ilo) or k 103 m(illi) 10-3 M(ega) 106 μ(micro) 10-6 G(iga) 109 n(ano) 10-9 Use powers of 10 in networks • Example: 1 Mbps = 1,000,000 bits per second • Frame of size 4 kbit = 4000 bits • Frame of size 1 kB = 1000 bytes = 8000 bits “B” is for bytes, “b” is for bits Do not confuse with memory/file sizes • KB there is 1024 bytes CN5E by Tanenbaum & Wetherall, © Pearson EducationPrentice Hall and D. Wetherall, 2011 Switching in networks Network core consists of a mesh of interconnected nodes (switches, routers, …) Two main switching techniques Circuit Switching (telephone networks) Packet Switching (Internet) Circuit switching End-end resources allocated to, reserved for “call” between source & destination: In diagram, each link has four sub-links. call gets 2nd sub-link in top link and 1st sub-link in right link. Resources also allocated in switches dedicated resources: no sharing circuit-like (guaranteed) performance properties 1- no sharing 2- Need a set up Circuit switching (2) circuit sub-link is idle if not used by call (no sharing) Call setup often required Commonly used in traditional telephone networks Circuit switching: FDM and TDM Example: Frequency Division Multiplexing 4 users Every user is given a certain frequency that is allowed to send on it the whole time total bandwidth frequency Time Division Multiplexing time Every user is allowed to send on all frequencies but on a certain time frequency time 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 Mbps Each link uses TDM with 20 time-slots It takes 500 msec to establish the end-to-end circuit Solution Initial time to setup circuit = Tsetup = 500 msec. Ttransmission = time needed to transmit N bits over circuit = N (bits) R (bits per second) What is R in this case? All links are 1 Mbps, but there are 20 time-slots Each call or circuit gets 106/20 = 50 000 bps Ttransmission = 640 000 / 50 000 = 12.8 sec Total time to send = Tsetup + Ttransmission = 13.3 sec When does the file arrive completely at destination? the propagation delay is directly dependent on the distance between the two points, and the sped of the signal within the medium. Propagation delay A propagation B time needed for dprop=signal to travel in = Distance from A to B (m) medium Signal speed in medium (m/sec) from A to B Signal speed is usually c = speed of light, down to 0.6c Example: what is the propagation delay in a 1000 km fiber, with a signal speed of 0.67c? dprop = 106 m /(0.67✕3✕108 m/sec) = 4.975 msec Space-time graph A B going down is the actual time Assumes setup messages are very small (have zero transmission time) propagate Also assumes that propagation delays are the same in the two directions sender's perspective ma fiya propagation time Example 2^20x8 bits Sending 1 MByte file over 1 Mbps link versus 1 Gbps link, both with 100 ms Round Trip Time (RTT) set up time Where did RTT come from? work done in a period of time Compare effective “Throughput” from sender’s perspective: Transfer Size / (total) Transfer Time Transfer Time = Tsetup + Ttransmission (setup message size is very small) = RTT + TransferSize/BitRate 1 Mbps case: Transfer Time = 100 msec + 220 x 8 / 106 = 0.1 + 8.39 = 8.49 s Throughput = 220 x 8 / 8.49 s = 0.99 Mbps … 99% of link bit rate 1 Gbps case: Transfer Time = 100 msec + 220 x 8 / 109 = 108.4 ms Throughput = 220 x 8 / 0.1084 s = 77.4 Mbps … only 8% of link bit rate Packet switching Packet-switching: hosts break application data into packets Host sends packets into network Packets forwarded from one router to the next, across links, on path from source to destination Each packet transmitted at full link capacity Sending packets of data host sending function: takes application message breaks into smaller chunks, forms packets, of length L bits transmits packet into network at full link transmission rate Rf full link bitrate packet transmission time = two packets, L bits each 2 1 Rf: Full link bitrate host time needed to transmit L-bit packet over link = L (bits) Rf (bits/sec) Packet switching: Store-and-Forward L bits per packet source 3 2 1 Rf1 bps takes L /Rf seconds to transmit (push out) L-bit packet onto link at Rf bps Store-and-Forward: entire packet must arrive at intermediate node (router) before it can be transmitted on next link Rf2 bps destination For N links and N – 1 routers: - The packet will be transmitted N times - Total transmission time is L /Rf1+ L /Rf2+…+ L /RfN Packet switching: processing and queuing delays B R = 1.5 Mbps D queue of packets waiting for output link E processing C R = 100 Mbps A packets need to be “looked at”, checked, and processed the time this takes is referred to as Processing Delay queuing if arrival rate to link exceeds its transmission rate for a period of time, packets will “queue”, wait to be transmitted on link this is referred to as Queuing Delay Packet switching: queuing delay and loss A B C R = 100 Mb/s R = 1.5 Mb/s D queue of packets waiting for output link queuing and loss: when packets queue, they are stored in a memory (buffer) buffer space is limited, and packets can be dropped (lost) if buffer memory fills up E Four sources of packet delay transmission A B propagation nodal processing queueing delay = dproc + dqueue + dtransmission + dpropagation dproc: processing time check packet for errors determine output link dqueue: queueing delay time waiting in output queue for transmission depends on congestion level of node/router Four sources of packet delay transmission A B propagation nodal processing queueing dtotal = dproc + dqueue + dtransmission + dpropagation dtransmission: transmission delay L: packet length (bits) Rf: link bitrate (bps) dtransmission = L/Rf dpropagation: propagation delay d: length of physical link in m s: propagation speed in medium (~2 to 3x108 m/sec) dpropagation = d/s Note on jitter Variation in delay between packets is called jitter important for audio/video applications how do we deal with jitter? Packets 4 3 Interpacket gap 2 1 4 Network 3 2 1 Packet switching versus circuit switching packet switching allows more users to use network! example: 1 Mbps link each user: • 100 kbps when “active” N users 1 Mbps link circuit-switching: Can support 1000 kbps / 100 kbps = 10 users with dedicated resources But each user is active 15% of the time packet switching: with 26 users, probability > 10 active at same time is 0.00074 Q: how did we get 0.00074? Q: what happens if > 10 users? This corresponds to just one minute in a 24 hour period. Psending[Users_, n_, p_] := Binomial[Users, n] p^n (1 - p)^(Users - n) TotalUsers = 26; ProbOneUserSending = 0.15; ProbMoreThan10 = Sum[Psending[TotalUsers, i, ProbOneUserSending], {i, 11, TotalUsers}]; MinutesPerDay = ProbMoreThan10*24*60 Out = 1.06803 Packet switching versus circuit switching is packet switching always “better?” great for bursty data resource sharing simpler excessive congestion possible: packet delay and loss protocols needed for reliable data transfer, congestion control – tend to complicate things Q: How to provide circuit-like behavior? bandwidth guarantees needed for audio/video apps challenging problem