Computer networking (TDDE25): Part 2 Niklas Carlsson, Associate - - PowerPoint PPT Presentation

computer networking tdde25 part 2
SMART_READER_LITE
LIVE PREVIEW

Computer networking (TDDE25): Part 2 Niklas Carlsson, Associate - - PowerPoint PPT Presentation

Computer networking (TDDE25): Part 2 Niklas Carlsson, Associate Professor http://www.ida.liu.se/~nikca/ Roadmap: Application layer Principles of Network Applications Application Architectures Application Requirements Web and


slide-1
SLIDE 1

Computer networking (TDDE25): Part 2 …

Niklas Carlsson, Associate Professor http://www.ida.liu.se/~nikca/

slide-2
SLIDE 2

Roadmap: Application layer

  • Principles of Network Applications

– Application Architectures – Application Requirements

  • Web and HTTP
  • FTP
  • Electronic Mail

– SMTP, POP3, IMAP

  • DNS
  • P2P Applications
  • Socket Programming with UDP and TCP
slide-3
SLIDE 3

Some Network Applications

slide-4
SLIDE 4

Creating a Network App

slide-5
SLIDE 5

Application Architectures

slide-6
SLIDE 6

Client-Server Architecture

slide-7
SLIDE 7

P2P Architetcure

slide-8
SLIDE 8

Processes communicating

Process: program running within a host.

  • processes in different hosts

communicate by exchanging messages Client-server paradigm client process: process that initiates communication server process: process that waits to be contacted

8

slide-9
SLIDE 9

Sockets

slide-10
SLIDE 10

Addressing Process

slide-11
SLIDE 11

App-Layer Protocol Defines:

slide-12
SLIDE 12

What Transport Service does an App Need?

slide-13
SLIDE 13

Transport Service Requirements: Common Apps

slide-14
SLIDE 14

Internet Transport Protocol Services

Transport Control Protocol User Datagram Protocol

slide-15
SLIDE 15

15

Internet apps: application, transport protocols

Application e-mail remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] proprietary (e.g., RealNetworks, youtube, netflix, spotify) proprietary (e.g., Dialpad, skype) Underlying transport protocol

slide-16
SLIDE 16

16

Internet apps: application, transport protocols

Application e-mail remote terminal access Web file transfer streaming multimedia Internet telephony Application layer protocol SMTP [RFC 2821] Telnet [RFC 854] HTTP [RFC 2616] FTP [RFC 959] proprietary (e.g., RealNetworks, youtube, netflix, spotify) proprietary (e.g., Dialpad, skype) Underlying transport protocol TCP TCP TCP TCP TCP (or UDP) UDP or TCP typically UDP

slide-17
SLIDE 17

Securing TCP

/TLS

slide-18
SLIDE 18

Roadmap

  • Principles of Network Applications

– App Architectures – App Requirements

  • Web and HTTP
  • FTP
  • Electronic Mail

– SMTP, POP3, IMAP

  • DNS
  • P2P Applications
  • Socket Programming with UDP and TCP
slide-19
SLIDE 19

The Web and HTTP

URL: Uniform Resource Locator HTML: Hypertext Markup Language

slide-20
SLIDE 20

Hypertext Links & URLs

<IMG src="http://www.ninthwonder.com/~miko/counter.gif?name=idocsguide" ALT="counter">

<A HREF="http://www.ida.liu.se/fred/resumepage.html">my resume</A>

Linking to other URL’s: Acquiring Images:

<APPLET CODE="http://www.ida.liu.se/tutorial/MyApplet.class" WIDTH=200 HEIGHT=50> <PARAM NAME=TEXT VALUE="Hi There"> <P>Hi There!<P> </APPLET>

Executing Applets:

slide-21
SLIDE 21

HTTP Overview

slide-22
SLIDE 22

HTTP Overview

slide-23
SLIDE 23

23

Network View: HTTP and TCP

  • TCP is a connection-oriented protocol

SYN SYN/ACK ACK GET URL YOUR DATA HERE FIN FIN/ACK ACK Web Client Web Server

slide-24
SLIDE 24

HTTP Connections

slide-25
SLIDE 25

HTTP Request Message

slide-26
SLIDE 26

HTTP Request Message: General Format

slide-27
SLIDE 27

Uploading “Form” Input

slide-28
SLIDE 28

Method Types

June 1997 HTTP/2

2015: RFC published + supported by major browsers Similar basic features as HTTP 1.1, but also performance related enhancements, including (but not limited to):

  • Server push
  • Multiplexing (to avoid head-of-line blocking)
  • Header compression
slide-29
SLIDE 29

29

Trying out HTTP (client side) for yourself

  • 1. Telnet to your favorite Web server:

Opens TCP connection to port 80 (default HTTP server port) at www.eurecom.fr. Anything typed in sent to port 80 at www.eurecom.fr telnet www.eurecom.fr 80

  • 2. Type in a GET HTTP request:

GET /~ross/index.html HTTP/1.0

By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to HTTP server

  • 3. Look at response message sent by HTTP server!
slide-30
SLIDE 30

HTTP Response Message

slide-31
SLIDE 31

31

HTTP Response Status Codes

  • 1XX: Informational (def’d in 1.0, used in 1.1)

100 Continue, 101 Switching Protocols

  • 2XX: Success

200 OK, 206 Partial Content

  • 3XX: Redirection

301 Moved Permanently, 304 Not Modified

  • 4XX: Client error

400 Bad Request, 403 Forbidden, 404 Not Found

  • 5XX: Server error

500 Internal Server Error, 503 Service Unavailable, 505 HTTP Version Not Supported

slide-32
SLIDE 32

32

HTTP Response Status Codes

  • 1XX: Informational (def’d in 1.0, used in 1.1)

100 Continue, 101 Switching Protocols

  • 2XX: Success

200 OK, 206 Partial Content

  • 3XX: Redirection

301 Moved Permanently, 304 Not Modified

  • 4XX: Client error

400 Bad Request, 403 Forbidden, 404 Not Found

  • 5XX: Server error

500 Internal Server Error, 503 Service Unavailable, 505 HTTP Version Not Supported

slide-33
SLIDE 33

Web caches (proxy server)

  • user sets browser: Web

accesses via cache

  • browser sends all HTTP

requests to cache

– object in cache: cache returns object – else cache requests object from origin server, then returns object to client

Goal: satisfy client request without involving origin server

client

Proxy server

client

  • rigin

server

  • rigin

server

Application 2-33

slide-34
SLIDE 34

34

Content distribution networks (CDNs)

  • The content providers are the

CDN customers. Content replication

  • CDN company installs hundreds of

CDN servers throughout Internet – in lower-tier ISPs, close to users

  • CDN replicates its customers’

content in CDN servers. When provider updates content, CDN updates servers

Different approaches …

  • rigin server

in North America CDN distribution node CDN server in S. America CDN server in Europe CDN server in Asia

slide-35
SLIDE 35

35

Cookies: keeping “state”

Many major Web sites use cookies Four components:

1) cookie header line in the HTTP response message 2) cookie header line in HTTP request message 3) cookie file kept on user’s host and managed by user’s browser 4) back-end database at Web site

Example:

– User visits a specific e- commerce site …

slide-36
SLIDE 36

36

Cookies: keeping “state” (cont.)

client server

usual http request msg usual http response +

Set-cookie: 1678 server creates ID 1678 for user

Cookie file amazon: 1678 ebay: 8734 Cookie file ebay: 8734

slide-37
SLIDE 37

37

Cookies: keeping “state” (cont.)

client server

usual http request msg usual http response +

Set-cookie: 1678

usual http request msg

cookie: 1678

usual http response msg

cookie- specific action server creates ID 1678 for user

Cookie file amazon: 1678 ebay: 8734 Cookie file ebay: 8734

slide-38
SLIDE 38

38

Cookies: keeping “state” (cont.)

client server

usual http request msg usual http response +

Set-cookie: 1678

usual http request msg

cookie: 1678

usual http response msg

cookie- specific action server creates ID 1678 for user

Cookie file amazon: 1678 ebay: 8734 Cookie file ebay: 8734 Cookie file amazon: 1678 ebay: 8734

  • ne week later:
slide-39
SLIDE 39

39

Cookies: keeping “state” (cont.)

client server

usual http request msg usual http response +

Set-cookie: 1678

usual http request msg

cookie: 1678

usual http response msg usual http request msg

cookie: 1678

usual http response msg

cookie- specific action cookie- spectific action server creates ID 1678 for user

Cookie file amazon: 1678 ebay: 8734 Cookie file ebay: 8734 Cookie file amazon: 1678 ebay: 8734

  • ne week later:
slide-40
SLIDE 40

40

Cookies (continued)

What cookies can bring:

  • authorization
  • shopping carts
  • recommendations
  • user session state (Web e-

mail) Cookies and privacy: cookies permit sites to learn a lot about you you may supply name and e-mail to sites search engines use redirection & cookies to learn yet more advertising companies

  • btain info across

sites

aside

slide-41
SLIDE 41

Roadmap

  • Principles of Network Applications

– App Architectures – App Requirements

  • Web and HTTP
  • FTP
  • Electronic Mail

– SMTP, POP3, IMAP

  • DNS
  • P2P Applications
  • Socket Programming with UDP and TCP
slide-42
SLIDE 42

FTP: File Transfer Protocol

slide-43
SLIDE 43

Mail Access Protocols

slide-44
SLIDE 44

Roadmap

  • Principles of Network Applications

– App Architectures – App Requirements

  • Web and HTTP
  • FTP
  • Electronic Mail

– SMTP, POP3, IMAP

  • DNS
  • P2P Applications
  • Socket Programming with UDP and TCP
slide-45
SLIDE 45

DNS: Domain Name System

Internet hosts:

– IP address (32 bit) - used for addressing datagrams – “name”, e.g., www.yahoo.com - used by humans

DNS: provides translation between host name and IP address

– distributed database implemented in hierarchy of many name servers – distributed for scalability & reliability

45

slide-46
SLIDE 46

Distributed, Hierarchical Database

  • Root servers and TLD servers typically do not contain

hostname to IP mappings; they contain mappings for locating authoritative servers.

Root DNS Servers com DNS servers ca DNS servers edu DNS servers poly.edu DNS servers umass.edu DNS servers yahoo.com DNS servers amazon.com DNS servers ucalgary.ca DNS servers TLD Servers usask.ca DNS servers

46

slide-47
SLIDE 47

DNS: Root Name Servers

slide-48
SLIDE 48

requesting host

example.liu.se gaia.cs.umass.edu

root DNS server local DNS server

dns.liu.se

1 2 3 4 5 6

authoritative DNS server dns.cs.umass.edu

7 8 TLD DNS server

DNS Infrastructure

  • Host at liu.se wants IP

address for gaia.cs.umass.edu

  • Infrastructure:

– Client resolver – Local DNS server – Authoritative DNS Server – Root DNS Server – Top-Level Domain DNS Server

  • Transport protocol?

48

slide-49
SLIDE 49

requesting host

example.liu.se gaia.cs.umass.edu

root DNS server local DNS server

dns.liu.se

1 2 3 4 5 6

authoritative DNS server dns.cs.umass.edu

7 8 TLD DNS server

DNS Infrastructure

  • Host at liu.se wants IP

address for gaia.cs.umass.edu

  • Infrastructure:

– Client resolver – Local DNS server – Authoritative DNS Server – Root DNS Server – Top-Level Domain DNS Server

  • Transport protocol?

– UDP (port: 53)

49

slide-50
SLIDE 50

DNS Records

slide-51
SLIDE 51

Inserting Records into DNS

Authoritative name server

,

mail server

slide-52
SLIDE 52

Roadmap

  • Principles of Network Applications

– App Architectures – App Requirements

  • Web and HTTP
  • FTP
  • Electronic Mail

– SMTP, POP3, IMAP

  • DNS
  • P2P Applications
  • Socket Programming with UDP and TCP
slide-53
SLIDE 53

Socket Programming

slide-54
SLIDE 54

Socket Programming

slide-55
SLIDE 55
  • UDP: no “connection” between client & server

– no handshaking before sending data – sender explicitly attaches IP destination address and port # to each packet – rcvr extracts sender IP address and port# from received packet

  • UDP: transmitted data may be lost or received out-of-order
  • Application viewpoint:

– UDP provides unreliable transfer of groups of bytes (“datagrams”) between client and server

Socket Programming with UDP

slide-56
SLIDE 56

Client/Server Socket Interaction: UDP

Address family: IPv4, Socket type: datagrams UDP

slide-57
SLIDE 57

Socket Programming with TCP

slide-58
SLIDE 58

Client/Server Socket Interaction: TCP

Wait for new connections on serversocket

slide-59
SLIDE 59

Transport Layer

slide-60
SLIDE 60

Transport Services and Protocols

slide-61
SLIDE 61

Transport vs. Network Layer

slide-62
SLIDE 62

62

Two Basic Transport Features

  • Demultiplexing: port numbers
  • Error detection: checksums

Web server (port 80)

Client host Server host 128.2.194.242

Echo server (port 7)

Service request for 128.2.194.242:80 (i.e., the Web server)

OS Client

IP payload detect corruption

slide-63
SLIDE 63

Demultiplexing Traffic

63

Endpoints identified by <src_ip, src_port, dest_ip, dest_port> Network Transport Application P1 P2 P3 P4 P6 P7 P5 Host 1 Host 2 Host 3

Unique port for each application Applications share the same network Server applications communicate with multiple clients

slide-64
SLIDE 64

Two Main Transport Layers

  • User Datagram Protocol (UDP)

– Just provides demultiplexing and error detection – Header fields: port numbers, checksum, and length – Low overhead, good for query/response and multimedia

  • Transmission Control Protocol (TCP)

– Adds support for a “stream of bytes” abstraction – Retransmitting lost or corrupted data – Putting out-of-order data back in order – Preventing overflow of the receiver buffer – Adapting the sending rate to alleviate congestion – Higher overhead, good for most statefull applications

64

slide-65
SLIDE 65

Network Layer

slide-66
SLIDE 66

Network Layer

slide-67
SLIDE 67

Two Key Network Layer Functions

slide-68
SLIDE 68

Interplay between Routing and Forwarding

slide-69
SLIDE 69

Network Layer Service Model

slide-70
SLIDE 70

How do we find a path?

slide-71
SLIDE 71

Routing on a Graph

  • Goal: determine a “good” path through the

network from source to destination

  • What is a good path?

– Usually means the shortest path – Load balanced – Lowest $$$ cost

  • Network modeled as a graph

– Routers  nodes – Link  edges

  • Edge cost: delay, congestion level, etc.

A B C D E F 5 2 3 5 2 1 1 2 3 1

slide-72
SLIDE 72

72

Hierarchical addressing: route aggregation

“Send me anything with addresses beginning 200.23.16.0/20”

200.23.16.0/23 200.23.18.0/23 200.23.30.0/23

Fly-By-Night-ISP Organization 0 Organization 7 Internet Organization 1 ISPs-R-Us “Send me anything with addresses beginning 199.31.0.0/16”

200.23.20.0/23

Organization 2

. . . . . .

ISP has an address block; it can further divide this block into sub blocks and assign them to subscriber organizations.

slide-73
SLIDE 73

Link Layer

slide-74
SLIDE 74

Link Layer

slide-75
SLIDE 75

Link Layer

slide-76
SLIDE 76

Where is the link layer implemented?

slide-77
SLIDE 77

Adaptors Communicating

slide-78
SLIDE 78

78

MAC Addresses(2/3)

Each adapter on LAN has unique LAN address

Broadcast address = FF-FF-FF-FF-FF-FF = adapter

1A-2F-BB-76-09-AD 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 71-65-F7-2B-08-53

LAN (wired or wireless)

slide-79
SLIDE 79

79

LAN Address (3/3)

  • MAC address allocation administered by IEEE
  • manufacturer buys portion of MAC address space
  • MAC flat address provides portability

– can move LAN card from one LAN to another – different than with IP addresses!

slide-80
SLIDE 80

80

Address Resolution Protocol (ARP)

  • Every host maintains an ARP table

– (IP address, MAC address) pair

  • Consult the table when sending a packet

– Map destination IP address to destination MAC address – Encapsulate and transmit the data packet

  • But, what if the IP address is not in the table?

– Sender broadcasts: “Who has IP address 1.2.3.156?” – Receiver responds: “MAC address 58-23-D7-FA-20-B0” – Sender caches the result in its ARP table

slide-81
SLIDE 81

81

ARP: Address Resolution Protocol

  • Each IP node (Host, Router)
  • n LAN has ARP table
  • ARP Table: IP/MAC address

mappings for some LAN nodes

< IP address; MAC address; TTL>

TTL (Time To Live): time after which address mapping will be forgotten (typically 20 min)

Question: how to determine MAC address of B knowing B’s IP address?

1A-2F-BB-76-09-AD 58-23-D7-FA-20-B0 0C-C4-11-6F-E3-98 71-65-F7-2B-08-53

LAN

237.196.7.23 237.196.7.78 237.196.7.14 237.196.7.88

slide-82
SLIDE 82

Link Layer Services

slide-83
SLIDE 83

Link Layer Services

slide-84
SLIDE 84
slide-85
SLIDE 85

Connecting the pieces

slide-86
SLIDE 86

Three Kinds of Identifiers (+ports)

Host Name IP Address MAC Address Example www.cs.princeton.edu 128.112.7.156 00-15-C5-49-04-A9 Size Hierarchical, human readable, variable length Hierarchical, machine readable, 32 bits (in IPv4) Flat, machine readable, 48 bits Read by Humans, hosts IP routers Switches in LAN Allocation, top-level Domain, assigned by registrar (e.g., for .edu) Variable-length prefixes, assigned by ICANN, RIR, or ISP Fixed-sized blocks, assigned by IEEE to vendors (e.g., Dell) Allocation, low-level Host name, local administrator Interface, by DHCP

  • r an administrator

Interface, by vendor

86

slide-87
SLIDE 87

Learning a Host’s Address

  • Who am I?

– Hard-wired: MAC address – Static configuration: IP interface configuration – Dynamically learned: IP address configured by DHCP

  • Who are you?

– Hard-wired: IP address in a URL, or in the code – Dynamically looked up: ARP or DNS

87

me you adapter adapter

slide-88
SLIDE 88

88

Mapping Between Identifiers

  • Dynamic Host Configuration Protocol (DHCP)

– Given a MAC address, assign a unique IP address – … and tell host other stuff about the Local Area Network – To automate the boot-strapping process

  • Address Resolution Protocol (ARP)

– Given an IP address, provide the MAC address – To enable communication within the Local Area Network

  • Domain Name System (DNS)

– Given a host name, provide the IP address – Given an IP address, provide the host name

slide-89
SLIDE 89

89

Dynamic Host Configuration Protocol

arriving client DHCP server Host learns IP address, Subnet mask, Gateway address, DNS server(s), and a lease time.

slide-90
SLIDE 90
slide-91
SLIDE 91

Courses about Computer Networks

  • TDTS06 Computer Networks (6hp)

– D program: Recommended elective …

  • TDDE35 Large-scale Systems (11hp)

– U program: Second year course covering computer networking, distributed systems, multicore, embedded systems, and a project

  • TDTS21 Advance Networking (6p)

– Pre-requirement: Introductory networking course; e.g., TDDE35 (U), TDTS04 (IP, C, …), TDTS06 (D, Y, …), TDTS11 (IT)

  • Thesis opportunities

– Companies often have projects – I have research projects (on these and related topics, including novel multimedia streaming solutions, cloud, IoT, data analytics/mining, network security, social networking, …)

slide-92
SLIDE 92
slide-93
SLIDE 93

Extra slides …

slide-94
SLIDE 94

FTP: Commands and Responses

slide-95
SLIDE 95
slide-96
SLIDE 96

Socket Programming

slide-97
SLIDE 97

Socket Programming

slide-98
SLIDE 98
  • UDP: no “connection” between client & server

– no handshaking before sending data – sender explicitly attaches IP destination address and port # to each packet – rcvr extracts sender IP address and port# from received packet

  • UDP: transmitted data may be lost or received out-of-order
  • Application viewpoint:

– UDP provides unreliable transfer of groups of bytes (“datagrams”) between client and server

Socket Programming with UDP

slide-99
SLIDE 99

Client/Server Socket Interaction: UDP

Address family: IPv4, Socket type: datagrams UDP

slide-100
SLIDE 100

Example App: UDP Client

slide-101
SLIDE 101

Example App: UDP Server

slide-102
SLIDE 102

Socket Programming with TCP

slide-103
SLIDE 103

Client/Server Socket Interaction: TCP

Wait for new connections on serversocket

slide-104
SLIDE 104

Example App: TCP Client

Address family: IPv4, Socket type: TCP # of bytes

slide-105
SLIDE 105

Example App: TCP Server

slide-106
SLIDE 106
slide-107
SLIDE 107

FTP: File Transfer Protocol

slide-108
SLIDE 108

FTP: Separate Control/Data Connections

slide-109
SLIDE 109

Roadmap

  • Principles of Network Applications

– App Architectures – App Requirements

  • Web and HTTP
  • FTP
  • Electronic Mail

– SMTP, POP3, IMAP

  • DNS
  • P2P Applications
  • Socket Programming with UDP and TCP
slide-110
SLIDE 110

Electronic Mail

slide-111
SLIDE 111

Electronic Mail: Mail Servers

slide-112
SLIDE 112

Electronic Mail: SMTP [RFC 2821]

slide-113
SLIDE 113

Scenario: Alice Sends Message to Bob

UA: User agent

slide-114
SLIDE 114

Sample SMTP Interaction

S: Server C: Client

Both are mailservers!

slide-115
SLIDE 115

Try SMTP Interaction!

prompt$ telnet mail.liu.se 25 Trying 130.236.27.19... Connected to mail.liu.se (130.236.27.19). Escape character is '^]'. 220 HC3-2010.ad.liu.se Microsoft ESMTP MAIL Service ready at Fri, 25 Sep 2015 07:51:45 +0200 HELO 250 HC3-2010.ad.liu.se Hello [130.236.180.74] QUIT 221 2.0.0 Service closing transmission channel Connection closed by foreign host. prompt$

slide-116
SLIDE 116

SMTP: Comparison with HTTP

slide-117
SLIDE 117

Mail Message Format

slide-118
SLIDE 118

Mail Access Protocols