Section 4 - Networks
Section 4 - Networks
Faculty of Engineering
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?
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 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
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
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
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.