Session 2. Application and Layered Architectures Dongsoo S. Kim Electrical and Computer Engineering. Indiana U. Purdue U. Indianapolis Intro to Computer Communication Networks Communication Networks Various services and flexibility Network architectures n n Grouping a set of related function to a layer A set of protocols Advantage of layered architectures n n Simplification Flexibility Interface vs. Interface Monolithic ECE/IUPUI Layered 2-2 1 Intro to Computer Communication Networks Example of Protocol Interaction between two peer entities Server/Client n Server – a process waiting a request w Listening a specific port in TCP/IP w Httpd (Apache™ ) , telnetd, ftpd, … n Client – a process making a request w A request to server address and the port number w Netscape™ , telnet, gftp, ws_ftp, … A connection in a server/client model is a 5-tuple n n Protocol type, Source address, Destination address Source port number, destination port number ECE/IUPUI 2-3 Intro to Computer Communication Networks Example of Protocol, http (1) Server Listening on port 80 Connection established Send a result code HTTP/1.1 200 Client Request to 134.68.80.4:80 Waiting… Connection established Send a request GET/index.html HTTP 1.0 Read and send the file <html> <head> … Interpret and display the html Disconnect the connection ECE/IUPUI 2-4 2 Intro to Computer Communication Networks Example of Protocol, http (2) Need a connection-oriented service & a reliable underlying layer HTTP Server Protocol HTTP Client Interface Interface 80 #n TCP Protocol TCP ECE/IUPUI 2-5 Intro to Computer Communication Networks Other Examples DNS (Domain Name System) n n n Convert an IP name to an IP address, or vice versa netlab.ece.iupui.edu ↔ 134.68.80.4 UDP/IP - Connectionless SMTP (Simple Mail Transfer Protocol) n n TCP connection to local SMTP server Work as if connectionless for forwarding the message to remote SMTP server ECE/IUPUI 2-6 3 Intro to Computer Communication Networks OSI Reference Model International Organization for Standardization / Open System Interconnection (IOS/OSI) Reference model, but not a real implementation A process on one machine at layer n n n Communicates with a peer process on the other machine By exchanging PDU (Protocol Data Unit) PDU contains a header and a payload called SDU (Service Data Unit ) n n Header – control information Payload – do not care Layer n protocol - A set of rules governing the behavior of the layer n Terminal A Terminal B n-PDU n-SDU H Layer n Entity Layer n Entity H n-SDU n-PDU ECE/IUPUI 2-7 Intro to Computer Communication Networks Interface and Service Communication between two peer processes is not physical The layer n+1 uses the services provided by layer n through layer n interface, called SAP (Service Access Point). Terminal A Terminal B (n+1)-PDU layer n+1 layer n+1 (n+1)-PDU n-SAP n-SDU n-SAP H layer n layer n H ECE/IUPUI n-SDU n-PDU 2-8 4 Intro to Computer Communication Networks Segmentation and Reassembly Maximum PDU size of Ethernet is 1500 bytes How can we send information larger than the maximum thru Ethernet? Segmentation n The layer n in a terminal can segment its payload into small pieces Reassembly n The layer n in the other terminal put together the small pieces in a payload. Host A Host B (n+1)-PDU n-SDU H n-SDU H (n+1)-PDU n-SDU H n-SDU H n-SDU H n-SDU H ECE/IUPUI 2-9 Intro to Computer Communication Networks ISO/OSI Reference Model International Standard Organization / Open Systems Interconnection 7 Layers Principles n n n n n n A layer should be created where a different level of abstraction is needed. Each layer should perform a well defined function. The function of each layer should be chosen with an eye toward defining internationally standardized protocols. The layer boundaries should be chosen to minimize the information flow across the interfaces. The number of layers should be large enough that distinct function need not be thrown together in the same layer out of necessity. The number of layers should be small enough that the architecture does not become unwieldy. ECE/IUPUI 2-10 5 Intro to Computer Communication Networks OSI 7 Layer Reference Model Application Protocol Layer 7 Application Layer 6 Presentation Layer 5 Session Layer 4 Transport Layer 3 Network Network Network Network Layer 2 Data Link Data Link Data Link Data Link Layer 1 Physical Physical Physical Physical ECE/IUPUI Presentation Protocol Session Protocol Transport Protocol Communication network boundary Application Presentation Session Transport Network layer host-router protocol Data link layer host -router protocol Physical layer host-router protocol 2-11 Intro to Computer Communication Networks The Physical Layer Deal with the transfer of raw bits over communication channel Electrical aspects n n Voltage level Signal duration Mechanical aspects n n Socket type Number of pines Examples n n n n Twisted copper wire – telephone wire, 10/100BaseT, … Coaxial cable – CATV, 10Base2, 10Base5, … Radio – cellular phone, 802.11, LMDS, … Optical fiber – WDM, DWDM, ECE/IUPUI 2-12 6 Intro to Computer Communication Networks The Data Link Layer Deal with the transfer of frames Framing information n Boundary of the frame w n n w w n attaching special bit patterns to the beginning and end of the frame Control and address information Check bit for recovering from transmission errors acknowledge frames handle with damaged, lost, and duplicate frames Flow controls w prevent a fast transmitter from drowning a slow receiver in data Broadcast networks n n control access to the shared channel LAN w w Sub-layer: Medium Access Control layer (MAC) One-to-one communication over broadcast medium Examples n n n HDLC – High-level Data Link Control PPP – Point-to-Point Protocol SONET – Synchronous Optical Network ECE/IUPUI 2-13 Intro to Computer Communication Networks The Network Layer Transfer of data (packet) over networks Routing n n n n n Select a path from the source to the destination thru many intermediate network components as switches and routers. Static routing vs. dynamic routing Deal with congestion – temporary traffic surges in a network components forming bottlenecks Differentiation of packet types Heterogeneous Network w Different address scheme w Maximum Transfer Unit (MTU) n Political routing w Inter-office emails between Microsoft branches shouldn’t pass through Netscape’s routers. Billing ECE/IUPUI 2-14 7 Intro to Computer Communication Networks The Transport Layer Responsible for the end-to-end transfer of message Segmentation and reassembly Error-free transfer n n n Error detection and recovery Sequencing Flow control Establishing and releasing connections n n Multiple connections for high throughputs Multiplexing a connection among many session layers for reducing the cost Type of Services n n Connection-oriented services – error-free point-to-point channel Connectionless services – no guarantee on the correct delivery of the message Example n Unix socket interface ECE/IUPUI 2-15 Intro to Computer Communication Networks The Session Layer Enhance a reliable transfer service Control how data is exchanged n manage dialogue control w full duplex w half duplex Examples n Log in to a remote system Transfer a file between two machine Token management n Synchronization n n w both side do not attempt the same operation at the same time. w w w w ECE/IUPUI Two-hour file transfer with one-hour mean time crashes The whole transfer would start over again Insert checkpoints into the data stream After a crash, continue after the last checkpoint 2-16 8 Intro to Computer Communication Networks The Presentation Layer Concern with the syntax and sematic of the information Overcome the difference in data representation Resolve machine-dependencies Character code n ASCII, EBCDIC, Unicode, … Big endian or little endian 32-bit word like an integers SUN Sparc, MIPS 4 3 2 1 Intel x86, Dec Alpha 1 2 3 4 The POWER Processor can be configured as either big endian or little endian ECE/IUPUI 2-17 Intro to Computer Communication Networks The Application Layer To provide network services Example n n HTTP – web browsing application FTP – File transfer between two different systems w different file name convention w different ways of representing text lines n n SMTP – Electronic mail Virtual terminals – vt100, TN 3270, xterm ECE/IUPUI 2-18 9 Intro to Computer Communication Networks Data Transmission in OSI Model sending process data Application data Presentation AH Application data Session PH data Transport Presentation SH data Network Data Link receivng process data DT Physical Session TH Transport NH data Network DH Bits Data Link Physical actual data transmission path ECE/IUPUI 2-19 Intro to Computer Communication Networks TCP/IP Architecture History n Successor of ARPANET (Defense Advanced Research Project Agency) Principles n Robustness w If failures occurs in the network, the packets are routed around the failure point. w Multiple paths and globally unique address. n n n Flexibility – No Data link layer or physical layer defined Packet switching networks Best-effort connectionless in the Network layer w “I will do my best to transfer your data, though I cannot guarantee their quality and delivery ” w IP packets are exchanged between routers without a connection setup. n Two services in the Transport layer w TCP – reliable connection -oriented transfer w UDP – unreliable connectionless transfer Applications n remote login, e-mail, file transfer, network management ECE/IUPUI 2-20 10 Intro to Computer Communication Networks OSI Model vs. TCP/IP OSI TCP/IP Application Application Presentation Not present in the model Session Transport TCP,UDP Network IP Data Link Network Interface Layer Physical ECE/IUPUI 2-21 Intro to Computer Communication Networks Protocols and Networks in TCP/IP TELNET FTP SMTP TCP DNS RTP Application UDP IP Transport ICMP Network ARP X.25 ECE/IUPUI ATM FR ETHER Network Interface 2-22 11 Intro to Computer Communication Networks TCP/IP Protocol Each host (NIC) is assigned by a globally unique IP address (32-bit) n n IP address = network address + host address A net mask is used to calculate them Each host (NIC) is also assigned by a machine address, or a physical address n n n Meaningful in one network by router Ethernet uses 6-octect (48-bit). ATM uses 16-octect. Router – consists of two or more network interfaces app TCP IP NI app TCP IP NI router IP NI NI ECE/IUPUI 2-23 Intro to Computer Communication Networks TCP/IP in a Network data data IP (1,2) IP (1,3) data 1,2 1,3 data NI 3487 data ECE/IUPUI 3487 6537 1,2 1,3 NI 6537 2-24 12 Intro to Computer Communication Networks TCP/IP thru a Router data data Router Host A IP (1,2) data IP (1,1) 1,2 2,5 data NI 3487 Host B NI 6543 1,2 2,5 data NI 1002 3487 6543 data IP (2,5) (2,3) 1,2 2,5 NI 3903 data 1002 3903 ECE/IUPUI 2-25 Intro to Computer Communication Networks TCP/IP in a System Data Source Port #, Destin Port # Source IP addr , IP Destin IP addr , Header Protocol type Source PH addr , Destin PH addr , Network protocol type ECE/IUPUI Ethernet Header TCP Header TCP Payload IP Payload Ethernet Payload Ethernet Tail 2-26 13 Intro to Computer Communication Networks Server in TCP/IP A process waiting a packet on a specific port number Duplicate a connection after establishing Connection? n 5 tuple – (PT, SA, SP, DA, DP) n A server waits on (pt, sa, sp, any -DA, any -DP) n Upon a request from the client, any -DA and any -DP are filled with specific value. w protocol type, source address, source port, destin address, destin port. Server Port Number – 0 to 1023 are reserved to well-known services. Protocol Reserved Port # Comments FTP 21 File Transfer telnet 23 remote login SMTP 25 E-mail DNS 53 Domain name system HTTP 80 World Wide Web ECE/IUPUI 2-27 Intro to Computer Communication Networks Berkeley Socket API – interface available to programmer n n socket(), bind(), listen(), accept(), connect(), sendto(), recvfrom(), htonl(), htons(), ntohl(), ntohs() Utility function - gethostbyname(), gethostbyaddr() Support multiple communication protocols n n n n Internet Domain Unix Domain Xerox NS Domain (XNS) ATM Domain (Recent progress in several implementation) References n Richard Stevens, “Unix Network Programming” ECE/IUPUI 2-28 14