0% found this document useful (0 votes)
21 views12 pages

Lecture Notes Computer Networks

The document provides an overview of computer networking and distributed systems. It discusses topics like DNS, HTTP, web caching, email protocols and standards. It also covers network layer protocols like IP and transport layer protocols.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
21 views12 pages

Lecture Notes Computer Networks

The document provides an overview of computer networking and distributed systems. It discusses topics like DNS, HTTP, web caching, email protocols and standards. It also covers network layer protocols like IP and transport layer protocols.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 12

Lecture notes on

Rechnernetze und verteiltes System


(Computer Networking and Distributed System)

Ngoc Hai Nguyen


hai.nguyen@campus.lmu.de
Sommersemester 2023

1
Contents
1 Application Layer 3
1.1 DNS - Domain Name System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 The Web and HTTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.1 Overview of HTTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.2 Non-Persistent and Persistent Connections . . . . . . . . . . . . . . . . . . . . . . 3
1.2.3 HTTP Message Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.4 User-Server Interaction: Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2.5 Web Caching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3 Electronic Mail in the Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.3.1 STMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.3.2 Comparison with HTTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.3 Mail Message Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.3.4 Mail Access Protocols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

2 The Network Layer 12


2.1 The Internet Protocol (IP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.1.1 IPv4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2
1 Application Layer
1.1 DNS - Domain Name System
1.2 The Web and HTTP
1.2.1 Overview of HTTP
• The HyperText Transfer Protocol (HTTP), the Web’s application-layer protocol, is at the
heart of the Web. It is defined in [RFC 1945] and [RFC 2616]. HTTP is implemented in two pro-
grams: a client program and a server program. The client program and server program, executing
on different end systems, talk to each other by exchanging HTTP messages. HTTP defines the
structure of these messages and how the client and server exchange the messages.
• A Web page consists of objects. An object is simply a file-such as an HTML file, a JPEG image, a
Java applet, or a video clip-that is addressable by a single URL. Most Web pages consist of a base
HTML file and several referenced objects. Each URL has two components: the hostname of the
sever that houses the object and the object’s path name.

• HTTP defines how Web request Web pages from Web servers and how servers transfer Web pages
to clients.When a user requests a Web page (for example, clicks on a hyperlink), the browser sends
HTTP request messages for the objects in the page to the server. The server receives the requests
and responds with HTTP response messages that contain the objects.
• HTTP uses TCP as its underlying transport protocol, that provides a reliable data transfer
service to HTTP.
• HTTP is said to be a stateless protocol. HTTP sever maintains no information about the clients.

1.2.2 Non-Persistent and Persistent Connections


• Non-persisten connection: TCP connection transports exactly one request message and one re-
sponse message, it is closed after the server sends the object-the connection does not persist for
other objects. Some objects are obtained over parallel TCP connections. Degree of parallelism can
be configured by the browsers.The use of parallel connections shortens the response time.
• Persistent connection: All the request and their corresponding responses will be sent over the same
TCP connection. The server leaves the TCP connection open after sending a response. The HTTP
server closes a connection when it isn’t used for a certain time.

• The default mode of HTTP uses persistent connections with pipelining.

1.2.3 HTTP Message Format

GET /somedir/page.html HTTP/1.1


Host: www.someschool.edu
Connection: close
User-agent: Mozilla/5.0
Accept-language: fr

• Request Messages: Request line + Header Lines.


Request Line: The method field(GET, POST, HEAD, PUT, DELETE), the URL field, and the
HTTP version field.
Header Lines:
By including the Connection: close header line, the browser is telling the server that it doesn’t
want to bother with persistent connections; it wants the server to close the connection after sending
the requested object

3
The header line Host: www.someschool.edu specifies the host on which the object resides
The User-agent: header line specifies the user agent, that is, the browser type that is making the
request to the server. Here the user agent is Mozilla/5.0, a Firefox browser
The GET method is used when the browser requests an object, with the requested object identi-
fied in the URL field. In this example, the browser is requesting the object /somedir/page.html
the Accept-language: header indicates that the user prefers to receive a French version of the
object, if such an object exists on the server; otherwise, the server should send its default version.

• Response messages:

HTTP/1.1 200 OK
Connection: close
Date: Tue, 18 Aug 2015 15:44:04 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Tue, 18 Aug 2015 15:11:03 GMT
Content-Length: 6821
Content-Type: text/html
(data data data data data ...)

• Status line: the protocol version field, a status code, and a corresponding status message.
• Header lines:

– The Connection: close header line to tell the client that it is going to close the TCP
connection after sending the message.
– The Date: header line indicates the time and date when the HTTP response was created
and sent by the server. Note that this is not the time when the object was created or last
modified; it is the time when the server retrieves the object from its file system, inserts the
object into the response message, and sends the response message
– The Server: header line indicates that the message was generated by an Apache Web server
– The LastModified: header line indicates the time and date when the object was created or
last modified. The Last-Modified: header, which we will soon cover in more detail, is critical
for object caching, both in the local client and in network cache servers (also known as proxy
servers).
– The Content-Length: header line indicates the number of bytes in the object being sent.

4
– The Content-Type: header line indicates that the object in the entity body is HTML text.
(The object type is officially indicated by the Content-Type: header and not by the file
extension.)
• Some common status codes and associated phrases include:

– 200 OK: Request succeeded and the information is returned in the response.
– 301 Moved Permanently: Requested object has been permanently moved; the new URL is
specified in Location : header of the response message. The client software will automatically
retrieve the new URL.
– 400 Bad Request: This is a generic error code indicating that the request could not be
understood by the server
– 404 Not Found: The requested document does not exist on this server.
– 505 HTTP Version Not Supported: The requested HTTP protocol version is not supported
by the server.

• Entity body:The entity body is the meat of the message—it contains the requested object itself
(represented by data data data data data ... ).
How does a browser decide which header lines to include in a request message? How does a
Web server decide which header lines to include in a response message? A browser will generate
header lines as a function of the browser type and version (for example, an HTTP/1.0 browser will
not generate any 1.1 header lines), the user configuration of the browser (for example, preferred
language), and whether the browser currently has a cached, but possibly out-of-date, version of the
object. Web servers behave similarly: There are different products, versions, and configurations,
all of which influence which header lines are included in response messages.

1.2.4 User-Server Interaction: Cookies


• HTTP server is stateless(no recording user data).

• But Cookies allow sites to keep track of users.


• Example:
• Cookies can be used to identify a user. The first time a user visits a site, the user can provide
a user identification (possibly his or her name). During the subsequent sessions, the browser
passes a cookie header to the server, thereby identifying the user to the server. Cookies can
thus be used to create a user session layer on top of stateless HTTP.

5
• Cookie technology has four components: (1) a cookie header line in the HTTP response message;
(2) a cookie header line in the HTTP request message; (3) a cookie file kept on theuser’s end system
and managed by the user’s browser; and (4) a back-end database at the Web site.
• Cookies can also be considered as an invasion of privacy. Using a combination of cookies and
user-supplied account information, a Web site can learn a lot about a user and potentially sell this
information to a third party.

1.2.5 Web Caching


• A Web cache—also called a proxy server—is a network entity that satisfies HTTP requests on
the behalf of an origin Web server.
• The Web cache has its own disk storage and keeps copies of recently requested objects in this
storage, when a user’s browser sends a request for an object, it is first directed to the Web cache.
• Example:

6
• A Web cache can substantially reduce the response time for a client request and traffic on an
institution’s access link to the internet.The institution does not have to upgrade bandwidth as
quickly, thereby reducing costs. Furthermore, it can reduce Web traffic in the internet as a whole.

• The traffic intensity on the LAN is: 0.15


Whereas the traffic intensity on the access link is 1.
One possible solution is to increase the access rate from 15 Mbps to 100 Mbps. This will lower the
traffic intensity on the access link to 0.15. In this case the total response time will roughly be two
sec, that is, the internet delay. But in order to upgrade its access link to 100 Mbps it will be very
expensive.
The second solution is installing a Web cache in the institutional network. It will give a average

7
delay of slightly greater then 1.2 sec. And the cost is low.

The Conditional GET

• Problem: The copy of an object residing in the cache may be stale, the object housed in the Web
server may have been modified since the copy was cached at the client.

• Therfore conditional GET. An HTTP request message is a so-called conditional GET message if
(1) the request message uses the GET method and (2) the request message includes an If-Modified-
Since: header line.
• Example, a proxy cache sends a request message to a Web server:

GET /fruit/kiwi.gif HTTP/1.1


Host: www.exotiquecuisine.com
If-modified-since: Wed, 9 Sep 2015 09:23:24

The Web Server sends a response message with the requested object to the cache:

HTTP/1.1 304 Not Modified


Date: Sat, 10 Oct 2015 15:39:29
Server: Apache/1.3.0 (Unix)
(empty entity body)

1.3 Electronic Mail in the Internet


• The Internet mail system has 3 major components: user agents, mail servers, The Simple
Mail Transfer Protocol (SMTP)

8
• A typical message starts its journey in the sender’s user agent, travels to the sender’s mail server,
and travels to the recipient’s mail server, where it is deposited in the recipient’s mailbox.
• It uses the reliable data transfer service of TCP. SMTP has two sides: a client side, which executes
on the sender’s mail server, and a server side, which executes on the recipient’s mail server.

1.3.1 STMP
• SMTP requires binary multimedia data to be encoded to ASCII before being sent over SMTP; and
it requires the corresponding ASCII message to be decoded back to binary after SMTP transport.
• SMTP does not normally use intermediate mail servers for sending mail, even when the two mail
servers are located at opposite ends of the world
• How SMTP transfers a message:
First, the client SMTP (running on the sending mail server host) has TCP establish a connection
to port 25 at the server SMTP (running on the receiving mail server host). If the server is down,
the client tries again later. Once this connection is established, the server and client perform
some application-layer handshaking—just as humans often introduce themselves before transferring
information from one to another, SMTP clients and servers introduce themselves before transferring
information. During this SMTP handshaking phase, the SMTP client indicates the email address
of the sender (the person who generated the message) and the e-mail address of the recipient.
Once the SMTP client and server have introduced themselves to each other, the client sends the
message. SMTP can count on the reliable data transfer service of TCP to get the message to the
server without errors. The client then repeats this process over the same TCP connection if it has
other messages to send to the server; otherwise, it instructs TCP to close the connection.

9
• Example transcript of messages exchanged between SMTP client and server:

S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you
C: MAIL FROM: <alice@crepes.fr>
S: 250 alice@crepes.fr ... Sender ok
C: RCPT TO: <bob@hamburger.edu>
S: 250 bob@hamburger.edu ... Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 hamburger.edu closing connection

1.3.2 Comparison with HTTP


• HTTP is a mainly a pull protocol– someone loads information on a Webserver and users use
HTTP to pull the information from the server at their convenience. SMTP is primarily a push
protocol– the sending mail server pushes the file to the receiving mail server.

• SMTP requires each message, including the body of each message, to be in 7-bit ASCII format.If
the message contains characters that are not 7-bit ASCII (for example, French characters with
accents) or contains binary data (such as an image file), then the message has to be encoded into
7-bit ASCII. HTTP data does not impose this restriction.
• HTTP encapsulates each object in its own HTTP response message. SMTP places all of the
message’s objects into one message

1.3.3 Mail Message Formats


A header containing peripheral information precedes the body of the message itself. This peripheral
information is contained in a series of header lines, which are defined in RFC 5322. The header lines and
the body of the message are separated by a blank line (that is, by CRLF ). A typical message header
looks like this:

10
From: alice@crepes.fr
To: bob@hamburger.edu
Subject: Searching for the meaning of life.

1.3.4 Mail Access Protocols


How does a recipent like Bob, running a user agent on his local PC, obtain his messages, which are sitting
in a mail server within Bob’s ISP? Note that Bob’s user agent can’t use SMTP to obtain the messages
because obtaining the messages is a pull operation, whereas SMTP is a push protocol.
Some popular mail access protocols, Post Office Protocol—Version 3 (POP3), Internet Mail
Access Protocol (IMAP), and HTTP. A mail access protocol, such as POP3, is used to transfer
mail from the recipient’s mail server to the recipient’s user agent

POP3

• With the TCPconnection established, POP3 progresses through three phases: authorization, trans-
action, and update.

telnet mailServer 110


+OK POP3 server ready
user bob
+OK
pass hungry
+OK user successfully logged on

• Downloading and delete or download and keep. The transaction will look like this:

C: list (list the size of each of the stored messages)


S: 1 498
S: 2 912
S: .
C: retr 1
S: (blah blah ...
S: .................
S: ..........blah)
S: .
C: dele 1
C: retr 2
S: (blah blah ...
S: .................
S: ..........blah)
S: .
C: dele 2
C: quit
S: +OK POP3 server signing off

• A problem with this download-and-delete mode is that the recipient, Bob, may be nomadic and
may want to access his mail messages from multiple machines, for example, his office PC, his home
PC, and his portable computer.

11
• In the download-and-keep mode, the user agent leaves the messages on the mail server after down-
loading them. In this case, Bob can reread messages from different machines; he can access a
message from work and access it again later in the week from home.
IMAP

• The POP3 protocol does not provide any means for a user to create remote folders and assign
messages to folders.
• An IMAP server will associate each message with a folder; when a message first arrives at the server,
it is associated with the recipient’s INBOX folder. The recipient can then move the message into
a new, user-created folder, read the message, delete the message, and so on. The IMAP protocol
provides commands to allow users to create folders and move messages from one folder to another.
IMAP also provides commands that allow users to search remote folders for messages matching
specific criteria. Note that, unlike POP3, an IMAP server maintains user state information across
IMAP sessions—for example, the names of the folders and which messages are associated with
which folders.

Web-Based E-mail

The user agent is an ordinary Web browser, and the user communicates with its remote mailbox via
HTTP.
Alice’s mail server, however, still sends messages to, and receives messages from, other mail servers using
SMTP.

2 The Network Layer


2.1 The Internet Protocol (IP)
2.1.1 IPv4

12

You might also like