Professional Documents
Culture Documents
2ECEg 4191 Chapter 2 - Application Layer
2ECEg 4191 Chapter 2 - Application Layer
2ECEg 4191 Chapter 2 - Application Layer
clients:
communicate with server
may be intermittently
client/server
connected
may have dynamic IP
addresses
do not communicate directly
with each other
application application
socket controlled by
process process app developer
transport transport
network network controlled
link
by OS
link Internet
physical physical
www.ju.edu.et/jit/pic.gif
host name path name
time
6. Steps 1-5 repeated for each of 10
jpeg objects
ebay 8734
usual http request msg Amazon server
cookie file creates ID
usual http response
1678 for user create backend
ebay 8734
set-cookie: 1678 entry database
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
usual http response msg action
Lecture Outline:-
• Web Caches
• DNS
•
ripe isi sun tislabs
moon •
net domain www disi
ftp
• www
ws2 ws1
Jump to first
page
Concept: Zones and Delegations
Zones are “administrative spaces”
Zone administrators are responsible for
portion of a domain’s name space
Authority is delegated from a parent and to a
child net zone
•
ne ed co
net domain • • m
•
t u google
ripe.net zone •
rip is sun tislab
e i moons •
ww dis
disi.ripe.net zone ww
•
w ft i
p ws ws w
Jump to first
page
DNS: services, structure
DNS services
hostname to IP address
translation
host aliasing why not centralize DNS?
• Example:
• single point of failure
• www.yahoo.com
• traffic volume, millions of
• tokiyo.yahoo.com mail, http…requests
(set of IP addresses for one
• distant centralized database
canonical name)
load distribution • maintenance
• replicated Web servers:
many IP addresses A: Therefore, a centralized
correspond to one name database approach
doesn’t scale!
Each ISP also has a Local DNS server (default name server)
DNS query and reply messages are sent within UDP datagrams to port 53.
53
Application 2-36
DNS: Root name servers
contacted by local name server that cannot resolve name
root name server:
1. contacts authoritative name server if name mapping is not known
2. gets mapping
3. returns mapping to local name server
a Verisign, Dulles, VA
c Cogent, Herndon, VA (also LA)
d U Maryland College Park, MD
g US DoD Vienna, VA k RIPE London (also 16 other locations)
h ARL Aberdeen, MD
j Verisign, ( 21 locations) i Autonomica, Stockholm (plus 28 other locations)
e NASA Mt View, CA
m WIDE Tokyo (also Seoul, Paris, SF)
f Internet Software C. Palo Alto, CA (and 36
other locations)
13 root name
servers worldwide
b USC-ISI Marina del Rey, CA
l ICANN Los Angeles, CA
Application 2-37
TLD and Authoritative Servers
Top-level domain (TLD) servers:
responsible for com, org, net, edu, and all top-level
country domains, e.g.: uk, fr, ch, jp, nz
Network Solutions maintains servers for com TLD
Educause for edu TLD
Authoritative DNS servers:
organization’s DNS servers, providing authoritative
hostname to IP mappings for organization’s servers
(e.g., Web, mail).
can be maintained by organization or service provider
Application 2-38
Local Name Server
does not strictly belong to hierarchy
each ISP (residential ISP, company, university)
has one
also called “default name server”
server
when host makes DNS query, query is sent to its
local DNS server
acts as proxy, forwards query into hierarchy of DNS
servers
Application 2-39
DNS in action
What happens when a user wants to view a
website (e.g. www.networkutopia.com)?
2: Application Layer 40
DNS
i.e. Name Server responsible for COM
Root DNS
Server
Top-Level Domain
(TLD) DNS Server
Dns1.networkutopia.com
Local DNS
Server IP: 212.212.212.1
Authoritative DNS Server (primary)
1
Dns2.networkutopia.com
Authoritative DNS Server (secondary)
Requesting
host
Destination
Host
2: Application Layer 41
DNS
i.e. Name Server responsible for COM
Root DNS
Server
Top-Level Domain
(TLD) DNS Server
2
Dns1.networkutopia.com
Local DNS
Server IP: 212.212.212.1
Authoritative DNS Server (primary)
1
Dns2.networkutopia.com
Authoritative DNS Server (secondary)
Requesting
host
Destination
Host
2: Application Layer 42
DNS
i.e. Name Server responsible for COM
Root DNS
Server
Top-Level Domain
(TLD) DNS Server
2 3
Dns1.networkutopia.com
Local DNS
Server IP: 212.212.212.1
Authoritative DNS Server (primary)
1
Dns2.networkutopia.com
Authoritative DNS Server (secondary)
Requesting
host
Destination
Host
2: Application Layer 43
DNS
i.e. Name Server responsible for COM
Root DNS
Server
Top-Level Domain
(TLD) DNS Server
4
2 3
Dns1.networkutopia.com
Local DNS
Server IP: 212.212.212.1
Authoritative DNS Server (primary)
1
Dns2.networkutopia.com
Authoritative DNS Server (secondary)
Requesting
host
Destination
Host
2: Application Layer 44
DNS
i.e. Name Server responsible for COM
Root DNS
Server
Top-Level Domain
(TLD) DNS Server
4
2 3 5
Dns1.networkutopia.com
Local DNS
Server IP: 212.212.212.1
Authoritative DNS Server (primary)
1
Dns2.networkutopia.com
5. Resource Records Authoritative DNS Server (secondary)
(networkutopia.com, Dns1.networkutopia.com, NS)
Requesting
host
(Dns1.networkutopia.com, 212.212.212.1, A)
Destination
...etc. Host
2: Application Layer 45
DNS
i.e. Name Server responsible for COM
Root DNS
Server
Top-Level Domain
(TLD) DNS Server
4
2 3 5
Dns1.networkutopia.com
Local DNS
Server IP: 212.212.212.1
6 Authoritative DNS Server (primary)
1
Dns2.networkutopia.com
www.networkutopia.com?
www.networkutopia.com
Requesting
host - give me a Type A Resource
Destination
Record Host
2: Application Layer 46
DNS
i.e. Name Server responsible for COM
Root DNS
Server
Top-Level Domain
(TLD) DNS Server
4
2 3 5
Dns1.networkutopia.com
Local DNS
Server 6 IP: 212.212.212.1
Authoritative DNS Server (primary)
7
1
Dns2.networkutopia.com
Authoritative DNS Server (secondary)
Requesting
host
Destination
Host
4
2 3 5
Dns1.networkutopia.com
Local DNS
Server 6 IP: 212.212.212.1
Authoritative DNS Server (primary)
7
1 8 Dns2.networkutopia.com
Authoritative DNS Server (secondary)
8. IP address of www.networkutopia.com
Requesting
host
is 212.212.71.4
Destination
Host
2: Application Layer 48
DNS
i.e. Name Server responsible for COM
Root DNS
Server
Top-Level Domain
(TLD) DNS Server
4
2 3 5
Dns1.networkutopia.com
Local DNS
Server 6 IP: 212.212.212.1
Authoritative DNS Server (primary)
7
1 8 Dns2.networkutopia.com
Authoritative DNS Server (secondary)
9
Requesting
host
Destination networkutopia.com
Host IP: 212.212.71.4
2 3
7
6
gaia.cs.umass.edu
(dns1.ethopia.com, 212.212.212.1, A)
application application
socket controlled by
process process app developer
transport transport
network network controlled
link
by OS
link Internet
physical physical
Application Example:
1. client reads a line of characters (data) from its
keyboard and sends data to server
2. server receives the data and converts characters to
uppercase
3. server sends modified data to client
4. client receives modified data and displays line on
its screen
Application Layer 2-55
Socket programming with UDP
UDP: no “ connection” between client & server
no handshaking before sending data
sender explicitly attaches IP destination address and
port # to each packet
receiver 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
write reply to
serverSocket read datagram from
specifying clientSocket
client address,
port number close
clientSocket
Application 2-57
Example app: UDP client
Python UDPClient
include Python’s socket
library from socket import *
serverName = ‘hostname’
serverPort = 12000
create UDP socket for clientSocket = socket(AF_INET,
server
SOCK_DGRAM)
get user keyboard
input message = raw_input(’Input lowercase sentence:’)
Attach server name, port to
message; send into socket
clientSocket.sendto(message.encode(),
(serverName, serverPort))
read reply characters from
modifiedMessage, serverAddress =
socket into string
clientSocket.recvfrom(2048)
print out received string
and close socket
print modifiedMessage.decode()
clientSocket.close()
Application Layer 2-58
Example app: UDP server
Python UDPServer
from socket import *
serverPort = 12000
create UDP socket serverSocket = socket(AF_INET, SOCK_DGRAM)
bind socket to local port
number 12000 serverSocket.bind(('', serverPort))
print (“The server is ready to receive”)
loop forever
while True:
Read from UDP socket into
message, getting client’s
message, clientAddress = serverSocket.recvfrom(2048)
address (client IP and port) modifiedMessage = message.decode().upper()
send upper case string serverSocket.sendto(modifiedMessage.encode(),
back to this client
clientAddress)
write reply to
connectionSocket read reply from
clientSocket
close
connectionSocket close
clientSocket