0% found this document useful (0 votes)
18 views

Section 4 - Networks

The MAIL FROM: command in SMTP specifies the email address of the sender for the purpose of delivering the email. It is used between mail servers during the transfer of email messages. The From: header field in the email message itself specifies the email address of the sender for the end recipient. It is part of the email message that gets delivered to the recipient's mailbox. So in summary: - MAIL FROM: in SMTP - Specifies the sender's email address for delivery purposes between mail servers - From: in email message - Specifies the sender's email address for the end recipient in the delivered email message itself.

Uploaded by

sherifasker2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Section 4 - Networks

The MAIL FROM: command in SMTP specifies the email address of the sender for the purpose of delivering the email. It is used between mail servers during the transfer of email messages. The From: header field in the email message itself specifies the email address of the sender for the end recipient. It is part of the email message that gets delivered to the recipient's mailbox. So in summary: - MAIL FROM: in SMTP - Specifies the sender's email address for delivery purposes between mail servers - From: in email message - Specifies the sender's email address for the end recipient in the delivered email message itself.

Uploaded by

sherifasker2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

AinShams University

Faculty of Engineering

CSE 351s: Computer networks


Section 4 Class textbook:
Computer Networking: A Top-
Down Approach (8th ed.)
Eng. Noha Wahdan J.F. Kurose, K.W. Ross
Pearson, 2020
http://gaia.cs.umass.edu/kurose_ross
Domain Name System
(DNS)
• An application-layer protocol translates web server’s name to its
corresponding IP address.
• A distributed database implemented in a hierarchy of DNS servers
• DNS protocol runs over UDP and uses port 53
DNS used by App layer protocols
What Happens when a browser requests www.someschool.edu/index.html.
1. The same user machine runs the client side of the DNS application.
2. The browser extracts the hostname, www.someschool.edu, from the URL
and passes the hostname to the client side of the DNS application.
3. The DNS client sends a query containing the hostname to a DNS server.
4. The DNS client eventually receives a reply, which includes the IP address
for the hostname.
5. Once the browser receives the IP address from DNS, it can initiate a TCP
connection to the HTTP server process located at port 80 at that IP address.
DNS: a distributed, hierarchical database
Root DNS Servers Root
… …
.com DNS servers .org DNS servers .edu DNS servers Top Level Domain
… … … …
yahoo.com amazon.com pbs.org nyu.edu umass.edu
DNS servers DNS servers DNS servers DNS servers DNS servers Authoritative

Client wants IP address for www.amazon.com; 1st approximation:


▪ client queries root server to find .com DNS server
▪ client queries .com DNS server to get amazon.com DNS server
▪ client queries amazon.com DNS server to get IP address for www.amazon.com
Transport Layer: 3-4
DNS records
DNS: distributed database storing resource records (RR)
RR format: (name, value, type, ttl)

type=A type=CNAME
▪ name is hostname ▪ name is alias name for some “canonical”
▪ value is IP address (the real) name
▪ www.ibm.com is really servereast.backup2.ibm.com
type=NS ▪ value is canonical name
▪ name is domain (e.g., foo.com)
▪ value is hostname of
type=MX
authoritative name server for ▪ value is name of SMTP mail
this domain server associated with name
Sheet 2: Question 7
Is it possible for an organization’s Web server and mail server to have the same
alias for a hostname (for example, foo.com)? What would be the type for the RR
that contains the hostname of the mail server?

Yes, an organization’s mail server and Web server can have the same alias for a
hostname.
The MX record is used to map the mail server’s hostname to its IP address.
Sheet 2: Question 18
Suppose you can access the caches in the local DNS servers of your department.
Can you propose a way to roughly determine the Web servers (outside your
department) that are most popular among the users in your department?
Explain.

We can periodically take a snapshot of the DNS caches in those local DNS
servers. The Web server that appears most frequently in the DNS caches is the
most popular server.
This is because if more users are interested in a Web server, then DNS requests
for that server are more frequently sent by users. Thus, that Web server will
appear in the DNS caches more frequently.
Sheet 2: Question 19
Suppose that your department has a local DNS server for all computers in the
department. You are an ordinary user (i.e., not a network/system administrator).
Can you determine if an external Web site was likely accessed from a computer
in your department a couple of seconds ago? Explain.

Yes, we can use dig to query that Web site in the local DNS server.
For example, “dig cnn.com” will return the query time for finding cnn.com. If
cnn.com was just accessed a couple of seconds ago, an entry for cnn.com is
cached in the local DNS cache, so the query time is very small (~0msec).
Otherwise, the query time is large.
Hint: On Windows, you can use the command:
powershell "Measure-Command { nslookup www.IndiaMART.com}"
Sheet 2: Question 10
Consider an HTTP client that wants to retrieve a Web document at a given URL.
The IP address of the HTTP server is initially unknown. What transport and
application-layer protocols besides HTTP are needed in this scenario?

• Application layer protocols: DNS and HTTP.


• Transport layer protocols: UDP for DNS; TCP for HTTP.
Sheet 2: Question 13
Suppose within your Web browser you click on a link to obtain a Web page. The IP
address for the associated URL is not cached in your local host, so a DNS lookup is
necessary to obtain the IP address. Suppose that n DNS servers are visited before
your host receives the IP address from DNS; the successive visits incur an RTT of
RTT1, . . . , RTTn. Further suppose that the Web page associated with the link
contains exactly one object, consisting of a small amount of HTML text. Let RTT0
denote the RTT between the local host and the server containing the object.
Assuming zero transmission time of the object, how much time elapses from when
the client clicks on the link until the client receives the object?
• The total amount of time to get the IP address is RTT1 + RTT2 + ….. + RTTn .
• Once the IP address is known, RTT0 elapses to set up the TCP connection and
another RTT0 elapses to request and receive the small object.
• The total response time is:
• 2 RTT0 + RTT1 + RTT2 + ….. + RTTn .
Mail access protocols
user
e-mail access user
SMTP SMTP protocol
agent agent
or HTTP (e.g., IMAP,
HTTP)

sender’s e-mail receiver’s e-mail


server server

▪ SMTP: delivery/storage of e-mail messages to receiver’s server


▪ mail access protocol: retrieval from server
• IMAP: Internet Mail Access Protocol [RFC 3501]: messages stored on server, IMAP
provides retrieval, deletion, folders of stored messages on server
▪ HTTP: gmail, Hotmail, Yahoo! Mail, etc. provides web-based interface on
top of STMP (to send), IMAP (or POP) to retrieve e-mail messages
SMTP RFC (5321) “client”
SMTP server
“server”
SMTP server

▪ uses TCP to reliably transfer email message


initiate TCP
from client (mail server initiating connection
connection) to server, port 25 RTT
TCP connection
▪ direct transfer: sending server (acting like client) initiated
to receiving server
▪ three phases of transfer 220
• SMTP handshaking (greeting) SMTP HELO
handshaking
• SMTP transfer of messages 250 Hello
• SMTP closure
▪ command/response interaction (like HTTP) SMTP
• commands: ASCII text transfers
• response: status code and phrase time
Sample SMTP interaction
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello
C: MAIL FROM: <[email protected]>
S: 250 [email protected]... Sender ok
C: RCPT TO: <[email protected]>
S: 250 [email protected] ... 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
Mail message format

▪ header lines, e.g., header


blank
• To: line
• From:
• Subject:
these lines, within the body of the email body
message area different from SMTP MAIL
FROM:, RCPT TO: commands!
▪ Body: the “message” , ASCII characters only
Sheet 2: Question 6
Suppose Alice, with a Web-based e-mail account (such as Hotmail or Gmail),
sends a message to Bob, who accesses his mail from his mail server using IMAP.
Discuss how the message gets from Alice’s host to Bob’s host. Be sure to list the
series of application-layer protocols that are used to move the message between
the two hosts.
The message is first sent from Alice’s host to her mail server over HTTP. Alice’s
mail server then sends the message to Bob’s mail server over SMTP. Bob then
transfers the message from his mail server to his host over IMAP.
Sheet 2: Question 16
What is the difference between MAIL FROM: in SMTP and From: in the mail
message itself?

The MAIL FROM: in SMTP is a command from the SMTP client that identifies the
sender of the mail message to the SMTP server.
The From: on the mail message itself is NOT an SMTP command, but rather is
just a line in the body of the mail message
Sheet 2: Question 17
How does SMTP mark the end of a message body?
How about HTTP?
Can HTTP use the same method as SMTP to mark the end of a message body?
Explain.

• SMTP uses a line containing only a period to mark the end of a message
body.
• HTTP uses “Content-Length header field” to indicate the length of a message
body.
• No, HTTP cannot use the method used by SMTP, because HTTP message could
be binary data, whereas in SMTP, the message body must be in 7-bit ASCII
format.
Throughput
Rs < Rc What is average end-end throughput?

Rs bits/sec Rc bits/sec

Rs > Rc What is average end-end throughput?

Rs bits/sec Rc bits/sec

bottleneck link
link on end-end path that constrains end-end throughput
Introduction: 1-18
Throughput: network scenario
▪ per-connection end-
Rs end throughput:
Rs Rs min(Rc,Rs,R/10)
▪ in practice: Rc or Rs is
R often bottleneck
Rc Rc
Rc

10 connections (fairly) share


backbone bottleneck link R bits/sec
Introduction: 1-19
File distribution: client-server vs P2P
Q: how much time to distribute file (size F) from one server to
N peers?
• peer upload/download capacity is limited resource
us: server upload
capacity
di: peer i download
file, size F u1 d1 u2 capacity
us d2
server
di
uN network (with abundant
bandwidth) ui
dN
ui: peer i upload
capacity
File distribution time: client-server
▪ server transmission: must sequentially
send (upload) N file copies:
F
• time to send one copy: F/us us
• time to send N copies: NF/us di
network
ui
▪ client: each client must download
file copy
• dmin = min client download rate
• min client download time: F/dmin

time to distribute F
to N clients using Dc-s = max{NF/us,,F/dmin}
client-server approach

increases linearly in N
File distribution time: P2P
▪ server transmission: must upload at
least one copy:
F
• time to send one copy: F/us us

▪ client: each client must download di


network
file copy ui
• min client download time: F/dmin
▪ clients: as aggregate must download NF bits
• max upload rate (limiting max download rate) is us + Σui

time to distribute F
to N clients using DP2P = max{F/us,,F/dmin,,NF/(us + Σui)}
P2P approach
increases linearly in N …
… but so does this, as each peer brings service capacity
Sheet 2: Question 20
Consider distributing a file of F = 20 Gbits to N peers. The server has an upload
rate of us = 30 Mbps, and each peer has a download rate of di = 2 Mbps and an
upload rate of u. For N = 10, 100, and 1000 and u = 300 Kbps, 700 Kbps, and 2
Mbps, prepare a chart giving the minimum distribution time for each of the
combinations of N and u for both client-server distribution and P2P distribution.

F Us=
20 Gbits 30 Mbps
di = 2 Mbps
network
ui = 300 Kbps, 700 Kbps,
and 2 Mbps
Sheet 2: Question 20 - client-server
u N
10 100 1000
NF/us F/dmin NF/us F/dmin NF/us F/dmin
300 kbps 6,666.67 10,000 66,666.67 10,000 666,666.67 10,000

700 kbps 6,666.67 10,000 66,666.67 10,000 666,666.67 10,000

2 Mbps 6,666.67 10,000 66,666.67 10,000 666,666.67 10,000

F Us=
30 Mbps
time to distribute F to N clients using 20
client-server approach Gbits di = 2 Mbps
network
Dc-s = max{NF/us,,F/dmin} ui = 300 Kbps, 700
Kbps, and 2 Mbps
Sheet 2: Question 20 – P2P
u N
10 100 1000
F/us F/dmin NF/(us + Σui) F/us F/dmin NF/(us + Σui) F/us F/dmin NF/(us + Σui)

300 kbps 666.67 10,000 6,060.60 666.67 10,000 33,333.33 666.67 10,000 60,606.06

700 kbps 666.67 10,000 5,405.41 666.67 10,000 20,000 666.67 10,000 27,397.26

2 Mbps 666.67 10,000 4,000 666.67 10,000 8,695.65 666.67 10,000 9,852.22

F Us=
30 Mbps
time to distribute F to N clients 20
di = 2 Mbps
Gbits
using P2P approach
network
DP2P = max{F/us,,F/dmin,,NF/(us + Σui)} ui = 300 Kbps, 700
Kbps, and 2 Mbps
Client-server vs. P2P: example
3.5
Minimum Distribution Time P2P
3
Client-Server
2.5

1.5

0.5

0
0 5 10 15 20 25 30 35

N
P2P file distribution: BitTorrent
▪ file divided into 256Kb chunks
▪ peers in torrent send/receive file chunks
tracker: tracks peers torrent: group of peers
participating in torrent exchanging chunks of a file

Alice arrives …
… obtains list
of peers from tracker
… and begins exchanging
file chunks with peers in torrent
Sheet 2
At any given instant of time, a peer in a torrent has a subset of chunks and will
know which chunks its neighbors have. With this information, how does it decide
which chunks it should request first from its neighbors? To which of its neighbors
should it send requested chunks?

• Rarest first
• 4 top priority peers (Calculated every 10 seconds) + 1 random peer
optimistically unchoked (every 30 seconds).
Sheet 2: Question 8
Consider a new peer Alice that joins BitTorrent without possessing any chunks.
Without any chunks, she cannot become a top-four uploader for any of the
other peers, since she has nothing to upload. How then will Alice get her first
chunk?

She will get her first chunk as a result of her being selected by one of her
neighbors as a result of an "optimistic un-choke" for sending out chunks to her.
According to BitTorrent mechanism, Alice may obtain first chunk from other
peers which randomly select top four up-loaders of the member's peer list every
30 seconds
Sheet 2: Question 22
Suppose Bob joins a BitTorrent torrent, but he does not want to upload any data
to any other peers (so called free-riding).
a. Bob claims that he can receive a complete copy of the file that is shared by
the swarm. Is Bob’s claim possible? Why or why not?

Yes. His first claim is possible, as long as there are enough peers staying in the
swarm for a long enough time. Bob can always receive data through optimistic
unchoking by other peers.
Sheet 2: Question 22 (Continued)
Suppose Bob joins a BitTorrent torrent, but he does not want to upload any data
to any other peers (so called free-riding).
b. Bob further claims that he can further make his “free-riding” more efficient
by using a collection of multiple computers (with distinct IP addresses) in the
computer lab in his department. How can he do that?
His second claim is also true. He can run a client on each host, let each client
“free-ride,” and combine the collected chunks from the different hosts into a
single file. He can even write a small scheduling program to make the different
hosts ask for different chunks of the file.

You might also like