CS 5523 Operating Systems: Network Instructor: Dr. Tongping Liu Thank Dr. Dakai Zhu, Dr. Palden Lama for providing their slides. CS5523: Operating Systems @ UTSA 1
What are the Problems? A OS Tongping Liu, Assistant Professor, CS Dept UTSA, x5550 network B OS Process A want to send process B a message Ø Tongping Liu, Assistant Professor,CS Dept. UTSA, x5550 Application-level agreement Ø Which part is what (name, title, contact) Network: actual message transmission Ø Issues with addressing, performance, scalability, reliability, security CS5523: Operating Systems @ UTSA 2
Outline: Network Communication Layered network models Ø OSI 7-layer model (Open System Interconnection) Ethernet: local area network Inter-network Protocols (IP) Ø Addressing and routing etc. TCP/UDP protocols Ø communication ports and sockets Multicast: more than one recipients CS5523: Operating Systems @ UTSA 3
Layered Structure and ISO OSI Model Layered structure: layer n uses layer n-1 services Protocols: pairs of software in send/receive nodes Layers Applic ation Pres ent ation Ses sion Transport Network Data l ink Ø Specify the sequence of messages for transmission Ø Specify the format, contents and meanings of data in messages Message sent Message received Phy sic al Sender Communic at ion medium Rec ipi ent CS5523: Operating Systems @ UTSA 4
Summary for OSI Protocols Layer Description Examples Application Presentation Session Transport Protocols that are designed to meet the communication requirements of specific applications, often defining the interface to a service. Protocols at this level transmit data in a network representation that is independent of the representations used in individual computers, which may differ. Encryption is also performed in this layer, if required. At this level reliability and adaptation are performed, such as detection of failures and automatic recovery. This is the lowest level at which messages (rather than packets) are handled. Messages are addressed to communication ports attached to processes, HTTP, FTP, SMTP, CORBA IIOP Secure Sockets ( SSL),CORBA Data Rep. TCP, UDP Network Data link Physical Transfers data packets between computers in a specific network. In a WAN or an internetwork this involves the generation of a route passing through routers. In a single LAN no routing is required. Responsible for transmission of packets between nodes that are directly connected by a physical link. In a WAN transmission is between pairs of routers or between routers and hosts. In a LAN it is between any pair of hosts. The circuits and hardware that drive the network. It transmits sequences of binary data by analogue signalling, using amplitude or frequency modulation of electrical signals (on cable circuits), light signals (on fibre optic circuits) or other electromagnetic signals (on radio and microwave circuits). IP, ATM virtual circuits Ethernet MAC, ATM cell transfer, PPP Ethernet base- band signalling, ISDN CS5523: Operating Systems @ UTSA 5
Commonly Used Layer Structure La yers Me ssag e Application Transport TCP & UDP In tern etwo rk pr otocols In tern etwo rk Net work inter face Underlyin g ne twor k IP In tern etwo rk pa ckets Ethernet Net work- specif ic packe ts Underlyin g ne twor k pr otocols CS5523: Operating Systems @ UTSA 6
Outline: Network Communication Layered network models Ø OSI 7-layer model (Open System Interconnection) Ethernet: local area network Inter-network Protocols (IP) Ø Addressing and routing etc. TCP/UDP protocols Ø communication ports and sockets Multicast: more than one recipients CS5523: Operating Systems @ UTSA 7
Ethernet: Local Area Network (LAN) not me Shared medium Shared medium: Carrier Sensing Multi-Access. Ø CSMA/CD: collision detection Every Ethernet interface has a unique 48 bit address (a.k.a. hardware address). Ø Example: C0:B3:44:17:21:17 Addresses are assigned to vendors by a central authority (IEEE to manufacturers) CS5523: Operating Systems @ UTSA 8
Wireless LAN Lapto ps A B C rad io obs truction Palmtop D E Wir eless LA N Server Base station/ access point LA N CS5523: Operating Systems @ UTSA 9
Approaches for Packet Delivery Datagram (vs. mailed letters) Ø each packet contains full network address of source-todestination; Ø no setup of paths, one-at-a-time, hop-by-hop transmission of packets, Ø unreliable, e.g., Internet IP datagram in network layer Virtual circuits (vs. phone call) Ø set up end-to-end path, packets contains virtual circuit #, Ø more reliable, Ø links can be shared CS5523: Operating Systems @ UTSA 10
Outline: Network Communication Layered network models Ø OSI 7-layer model (Open System Interconnection) Ethernet: local area network Inter-network Protocols (IP) Ø Addressing and routing etc. TCP/UDP protocols Ø communication ports and sockets Multicast: more than one recipients CS5523: Operating Systems @ UTSA 11
What is IP? Internet Protocol Ø packet delivery service (host-to-host). Ø translation on data-link protocols (Ethernet). IP provides connectionless, unreliable delivery of IP datagram. Ø Connectionless: each datagram is independent. Ø Unreliable (best effort): no guarantee for datagrams to be delivered correctly or at all. CS5523: Operating Systems @ UTSA 12
IP Packet IP address of source header IP address of destination up to 64 kilobytes VERS HL Service Fragment Length Datagram ID FLAG Fragment Offset TTL Protocol Header Checksum Source Address Destination Address Options (if any) data 1 byte 1 byte 1 byte 1 byte Data CS5523: Operating Systems @ UTSA 13
IP Address Requirements Universal any host must be able to send packets to any other host in the internet. Routing - include information that makes routing feasible and efficient Address Space large and efficient IP addresses are assigned by a central authority (American Registry for Internet Numbers) CS5523: Operating Systems @ UTSA 14
Internet Addresses Logical addresses (0.0.0.0 ~255.255.255.255) Ø 32 bits (4 billion, population in early 80s) Includes a network ID and a host ID. Ø Network ID is assigned to an organization by the authority Ø Host IDs are assigned locally by a system administrator Different classes of addresses Ø Class A ü 128 possible network IDs and over 4 million host IDs per network ID Ø Class B ü 16K possible network IDs and 64K host IDs per network ID Ø Class C ü over 2 million possible network IDs and about 256 host IDs per network ID CS5523: Operating Systems @ UTSA 15
Internet Addresses (cont.) octet 1 octet 2 octet 3 Netwo rk ID Hos t ID Cl ass A: 1 to 127 0 to 255 0 to 255 0 to 255 Netwo rk ID Hos t ID Cl ass B: 128 to 191 0 to 255 0 to 255 0 to 255 Netwo rk ID Hos t ID Cl ass C: 192 to 223 0 to 255 0 to 255 1 to 254 Mu lt i cas t a dd ress Cl ass D (mu lti cas t): 224 to 239 0 to 255 0 to 255 1 to 254 Ran ge of ad dre sse 1.0.0.0 to 127.255.255.255 128.0.0.0 to 191.255.255.255 192.0.0.0 to 223.255.255.255 224.0.0.0 to 239.255.255.255 Cl ass E (rese rve d): 240 to 255 0 to 255 0 to 255 1 to 254 128.0.0.0 to 247.255.255.255 CS5523: Operating Systems @ UTSA 16
Routing Problem: Where to Send? Decide the route for each packet Ø necessary in MANs and WANs Update knowledge of the network Ø Adaptive/dynamic routing is usually used: traffic patterns, topological changes Routing decision Ø hop-by-hop, with period update and distribution of traffic data, e.g., the distance-vector, dynamic, distributed algorithm CS5523: Operating Systems @ UTSA 17
Routing in Wide Area Networks (WANs) A 1 B Hosts or local networks 3 D Links 6 E 4 5 2 C Routers CS5523: Operating Systems @ UTSA 18
CS5523: Operating Systems @ UTSA 19 Routing Tables Routings from D Routings from E To Link Cost To Link Cost A B C D E 3 3 6 local 6 1 2 2 0 1 A B C D E 4 4 5 6 local 2 1 1 1 0 Routings from A Routings from B Routings from C To Link Cost To Link Cost To Link Cost A B C D E local 1 1 3 1 0 1 2 1 2 A B C D E 1 local 2 1 4 1 0 1 2 1 A B C D E 2 2 local 5 5 2 1 0 2 1
IP Routing Routing algorithms: Ø RIP: routing information protocol Ø RIP-2: better multicasting, authentication Ø Open shortest path first (OSPF) Default routes CS5523: Operating Systems @ UTSA 20
Interaction with Link Layer: ARP ARP: address resolution protocol For given IP address, ARP is used to find out the Ethernet address of the destination Ø Broadcast protocol Ø The right one responds. Ø Not for every IP datagram routers remember addresses CS5523: Operating Systems @ UTSA 21
ARP Example others HEY - Everyone please listen! Will 129.115.177.56 please send me your Ethernet address? Router not me Hi Blue! I m 129.115.177.56, and my Ethernet address is 00:0C:F1:98:B3:DE CS5523: Operating Systems @ UTSA 22
Programmer's View of TCP/IP Application TCP Application UDP IP Transport layer: TCP (Transmission Control Protocol): connection-oriented stream service UDP(User Datagram Protocol): connectionless datagram service CS5523: Operating Systems @ UTSA 23
Outline: Network Communication Layered network models Ø OSI 7-layer model (Open System Interconnection) Ethernet: local area network Inter-network Protocols (IP) Ø Addressing and routing etc. TCP/UDP protocols Ø communication ports and sockets Multicast: more than one recipients CS5523: Operating Systems @ UTSA 24
Concept of Ports 16 bits, allow different applications on the same computer to share network resources simultaneously. Ø well-known ports: 1 1023 ü Telnet server: port 23; FTP server: port 21; HTTP server: port 80 Ø registered ports: 1024 49151 Ø dynamic or private ports: 49152-65535 socket any port agreed port socket client message other ports server Internet address = 138.37.94.248 Internet address = 138.37.88.249 CS5523: Operating Systems @ UTSA 25
Socket Abstraction A socket must be bound to a local port Endpoints for communication between processes Socket pair - (local IP address, local port, foreign IP address, foreign port) uniquely identifies a communication CS5523: Operating Systems @ UTSA 26
TCP: Transmission Control Protocol TCP is connection-oriented. Ø 3-way handshake used for connection setup Ø Acknowledge each pack (pigback) (Active) Client Syn (Passive) Server (Active) Client Data:N (Passive) Server Syn + Ack (Data :N+1) Ack Ack Connection Setup 3-way handshake Acknowledgement data packets CS5523: Operating Systems @ UTSA 27
TCP Characteristics Provides bi-directional stream of bytes between two distributed components. Buffers at both sides Reliable but slow protocol. Ø Acknowledgements indicate delivery of data à retransmitted after a timeout. Ø Checksums are used to detect corrupted data. Ø Sequence numbers à missing, or mis-sequenced data. Ø (Sliding-Window-based) Flow control prevents over-run of receiver CS5523: Operating Systems @ UTSA 28
TCP Socket Primitives Primitive Socket Bind Listen Accept Connect Send Recv Close Function Create a new communication endpoint Attach a local address to a socket Announce willingness to accept connections Block caller until a connection request arrives Actively attempt to establish a connection Send some data over the connection Receive some data over the connection Release the connection CS5523: Operating Systems @ UTSA 29
Client-Server Using TCP Socket CS5523: Operating Systems @ UTSA 30
UDP (User Datagram Protocol) Pass a message from one to another component Ø abstraction is a datagram Sender creates a socket bound to (local port, local IP address) Ø Sender can use the socket to send to any destination Ø destination (host, port) is explicitly included in messages Receiver must have a socket bound to the specified port and receive from any Ø receive(buffer) doesn t specify which senders Ø anyone can send CS5523: Operating Systems @ UTSA 31
UDP Characteristics Restricted message length Unreliable (but fast) protocol: 10% loss Ø Omission failures: optional checksum Ø Messages can be delivered out of order Application enhancements Ø Timeouts resend to prevent indefinite waiting Ø Queuing at receiver Ø Packet numbering etc. CS5523: Operating Systems @ UTSA 32
Outline: Network Communication Layered network models Ø OSI 7-layer model (Open System Interconnection) Ethernet: local area network Inter-network Protocols (IP) Ø Addressing and routing etc. TCP/UDP protocols Ø communication ports and sockets Multicast: more than one recipients CS5523: Operating Systems @ UTSA 33
Multicast Communication: More Receivers Broadcast sends a single message from one process to all processes (hosts) Multicast sends a single message from one process to members of a group of processes (hosts) What are needed? Ø Address to identify all members in the group Ø Multicast routers to forward multicast packet CS5523: Operating Systems @ UTSA 34
Uses of Multicast and Its Effects Fault tolerance based on replicated services Ø Requests multicast to group of servers Discovery in spontaneous networking Ø Locate available discovery services Performance from replicated data Ø Multicast changes to all replicas Propagation of event notifications in a distributed environment Ø News group: news à group of interested users CS5523: Operating Systems @ UTSA 35
Multicast IP address octet 1 octet 2 octet 3 Netwo rk ID Hos t ID Cl ass A: 1 to 127 0 to 255 0 to 255 0 to 255 Netwo rk ID Hos t ID Cl ass B: 128 to 191 0 to 255 0 to 255 0 to 255 Netwo rk ID Hos t ID Cl ass C: 192 to 223 0 to 255 0 to 255 1 to 254 Mu lt i cas t a dd ress Cl ass D (mu lti cas t): 224 to 239 0 to 255 0 to 255 1 to 254 Ran ge of ad dre sse 1.0.0.0 to 127.255.255.255 128.0.0.0 to 191.255.255.255 192.0.0.0 to 223.255.255.255 224.0.0.0 to 239.255.255.255 Cl ass E (rese rve d): 240 to 255 0 to 255 0 to 255 1 to 254 128.0.0.0 to 247.255.255.255 224.0.0.0 to 224.0.0.255 (224.0.0.0/24) à local subnet multicast traffic 224.0.1.0 to 238.255.255.255 à globally scoped addresses 239.0.0.0 to 239.255.255.255 (239.0.0.0/8) à administratively scoped addresses, boundary CS5523: Operating Systems @ UTSA 36
IP Multicast Process Each multicast address à identify a group Internet Group Membership Protocol (IGMP) Ø Processes register a group with local router using IGMP Router update its multicast routing table Processes send message to a group Ø Do not need to be a member Router forward multicast messages CS5523: Operating Systems @ UTSA 37
Multicast Architecture CS5523: Operating Systems @ UTSA 38
Summary Layered network models Ø OSI 7-layer model Ethernet: local area network Inter-network Protocols (IP) Ø Addressing and routing etc. TCP/UDP protocols Ø communication ports and sockets Multicast: more than one recipients CS5523: Operating Systems @ UTSA 39