ACSC424 NETWORK APPLICATION PROGRAMMING Kyriacou E. Frederick University Cyprus communication examples
The OSI reference model (proposed by ISO) Application A Application B 2 Application Application Presentation Presentation Session Session Communication Data Link Data Link Data Link Data Link Physical Physical Physical Physical Electrical and/or Optical Signals This figure (& next several) copied from A. Leon-Garcia and I. Widjaja, "Communication s Figure 2.6
Peer-to-peer communication 3 Two communicating entities are called peers. Communication between layer n+1 peers is virtual and is carried by layer n service Two meanings of peer-to-peer: peer: point-to-point (hop-by-hop) (lower 3 layers): end-to-end (user-to-user) (upper layers): Connection oriented peer-to-peer: Data link layer (point-to-point) t i t) protocol layer (end-to-end) protocol one direct link network
Peer-to-peer protocol across a single hop 1. take packets 2. form frame (a) 3. transfer through Physical layer A Packets Data link Physical Frames Packets Data link Physical 5. deliver to network layer B 4. Pass up (b) 4 1 2 3 2 1 Medium 1 2 3 2 1 A B 2 1 1 Physical layer entity 2 Several pairs of data link & physical entities Data link layer entity 3 layer entity Only one network layer entity, a router may connect several different networks Figure 5.2
Peer-to-peer protocol operating end-to-end across network Messages Messages Segments End system α Data link Physical Data link Physical Data link Physical Data link Physical End system Β 5 Figure 5.3
1. 4 not in middle C 2.Data go up and down in router 3. Different paths 4. Out of order, delay, 1 2 3 2 1 duplicate, lost End System α End System β 4 3 2 1 1 2 3 2 1 Medium 1 2 3 2 1 1 2 3 4 A B 2 1 1 Physical layer entity 3 layer entity 6 3 layer entity 2 Data link layer entity Peer-to-peer protocol operating end-to-end across network 4 layer entity Figure 5.4
Headers and trailers added to data 7 Application A Application data data ah Application B Application Presentation data ph Presentation Session data sh Session data th data nh Data Link dt data dh Data Link Physical bits Physical Figure 2.9
TCP/ network architecture 8 Application Application Internet Internet Interface Interface (a) (b) TCP/ model does not require strict layering Figure 2.10
TCP/ architecture-- Internet layer Machine A 9 Application Internet Interface Router/Gateway Internet Interface Machine B Application Internet Interface 1 2 1. Transfer of information across networks through gateways/routers 2. Corresponding to OSI network layer: routing and congestion control 3. Global unique address and packets 4. Best-effort connectionless packet transfer: no setup, routed independently, robust, out of order, duplicate, or lose of packet Figure 2.11
TCP/ architecture-- interface layer Machine A 10 Application Machine B Application packet kt Internet Interface packet Router/Gateway Internet Interface packet Internet Interface packet Packet of network1 Packet of network1 Packet of network2 Packet of network2 1 2 1. Concerned with network-specific aspects of the transfer of packets 2. Corresponding to part of OSI network layer and data link layer 3. Different network interfaces: X.25, ATM, frame relay, Ethernet, etc Figure 2.11
An internet consisting of an Ethernet LAN and a point-to-point link (a) (1,1) (2,1) 11 router s (1,3) r Ethernet w PPP (2,2) (b) (1,2) Server HTTP HTTP PC TCP Router TCP Net Interface Net Interface Net Interface Ethernet PPP Figure 2.13
(1,1) (2,1) 12 router s (1,3) r Ethernet w PPP (2,2) (1,2) PPP is also a specific network address: network ID + host ID, such as (1,1),(2,2) Physical address (such as s, r, ): For Ethernet, each machine in a Ethernet has a NIC card with a global unique flat 48-bit address For PPP, no need for physical address Router has two addresses: (1,3), (2,1) Figure 2.13
Example 1:Workstation sends a datagram to the server (a) (1,1) (2,1) 13 router s (1,3) r Ethernet w (1,2) (b) (2,2) PPP 1. Workstation finds server s and physical address 2. entity forms and passes packet down to Ethernet driver along with physical addresses r, s 3. Ethernet driver forms Ethernet frame and broadcast 4. Server NIC captures the frame due to its address s 5. Find it is an so pass up to entity Workstation HTTP HTTP Server TCP TCP (1,2)(1,1) data Ethernet driver Ethernet driver (1,2)(1,1) data w,s, (1,2)(1.1) 1) data Ethernet w,s, (1,2)(1.1) data Figure 2.13
14 Example1 Workstation sends a datagram to the server (cont.) How H does workstation ti know the server s address? First search in its cache, if not found, query by DNS and cache it entity in workstation knows that the server is in the same network, why? Because of the same network ID How to know the server s physical address? looks up its mapping table to try to find server s physical address s. if server s physical address is not known, by ARP (Address Resolution Protocol) to find it.
(a) (1,1) Example 2: server sends a datagram to PC (2,1) 15 router s (1,3) r (b) Server (1,1)(2,2) 1)(2 2) data Ethernet s,r, (1,1)(2,2) data HTTP TCP w Net Interface (1,2) Ethernet PPP (2,2) 1. Server forms packet with PC as destination 2. Server sends packet to router first by broadcast 3. Router finds the packet is not for itself, so sends to PC 4. PC finds the packet is for it,so pass on to upper layer (1) packet is the same all the way, but frames are not (2) Addresses in frame is different from ones in packet (2) Router has two network interfaces HTTP PC Router Net InterfaceS (1,1)(2,2) data r,pc, (1,1)(2,2) data PPP TCP Net Interface Figure 2.13 (1,1)(2,2
Example2: server sends datagram to PC (cont.) 16 How to routing, i e., why server knows to send the packet to the router first? Look up routing table, in detail, by complete destination address, if not found by network ID of destination address, if not found the default router is selected. (In this example, we assume the router r is the default router). For a PPP frame, there is no need for physical address in the other end. The address of a home computer connected to the Internet through modem is dynamically assigned (DHCP).
Header Header contains source and destination physical addresses; network protocol type Ethernet Header Frame Check Sequence datagram is encapsulated in an Ethernet frame 17 Figure 2.14
Big picture: web document browsing 18 Suppose a user on PC clicks a link of a document contained in the server, and HTTP client passes a request to TCP layer asking for setting up a TCP connection, and the TCP connection between the PC and the server has been established (How? Discuss later). The http client then passes http request message (such as GET /.) to TCP layer, what will happen??
Big picture: web document browsing 19 The ppp driver (data link entity) in PC forms a PPP frame and sends the frame to the other end of the PPP link, i.e., router The router extracts packet (from the PPP frame), makes routing decision according on destination address (1,1), forms an Ethernet frame (encapsulating the packet) and broadcasts it onto Ethernet The server NIC captures the frame, extracts the packet and passes it to entity, then to TCP entity and then to HTTP server Finally the server retrieves the document and puts it in HTTP response packet and sends back to PC.
Big picture: web document browsing HTTP request is passed down HTTP Request c, 80 Header contains source and destination port numbers TCP Header (2,2)(11),TCP Header contains source and destination addresses; transport protocol type Header Header contains source and destination physical addresses; network protocol type 20 pc,r, ppp Header Frame Check Sequence Figure 2.15
App. HTTP SMTP DNS RTP TCP UDP TCP/UDP Provides a network independent platform Internet provides independence from underlying networks Interface 1 Interface 2 Interface 3 (e.g., Ethernet driver) (e.g., PPP driver) 21 TCP/ protocol graph Figure 2.12
Internet security protocols at layers 22 Application SSH, SFTP, PGP, PEM, HTTPS SSL/TLS, SSH Internet Sec Interface Security in data link layer? Other security systems: Kerberos, X.509 Figure 2.10
Terms about Internet security 23 HTTPS: Secure Hypertext Transfer Protocol an application layer protocol for WWW using a Secure Socket (SSL). SSL: Secure Socket, a transport layer protocol Similar to socket but adding encryption and authentication TLS: Security A transport layer protocol The IETF version of SSL
Terms about Internet security 24 SSH: Secure SHell An application layer protocol (initially) Replace telnet, rlogin, ftp Generalized as a transport t layer protocol PGP: Pretty Good Privacy An application layer protocol Embedded in email such as elm Flexible public key certificate and verification
Terms about Internet security 25 PEM: Privacy Enhanced Mail An application protocol For secure email Strict hierarchy in public key certificate Sec: Internet Protocol Security A network layer protocol Contains two parts (may use separately) AH: Authentication Header ESP: Encapsulation Security Payload
Terms about Internet security 26 IKE: Internet Key Exchange, Establishing key used in Sec. PKI: Public Key Infrastructure Refer to the widespread d availability of public keys and certificates t ISAKMP: Internet Security Association and Key Management Protocol. Kerberos: A system for authentication based on secret keys OAKLEY An IETF protocol that provides s mechanism that two authenticated parties can agree on secure and secret keying material