World Wide Web - Part II: Indian Institute of Technology Kharagpur
World Wide Web - Part II: Indian Institute of Technology Kharagpur
1
How a Web Server Works?
• Simple requirements:
¾Able to accept HTTP requests, and
respond to them.
¾Support for GET and HEAD, possibly
also POST.
¾Able to handle server-side scripts.
Executables residing on the server.
They get executed when specified.
Their output sent back to the client;
typically as a HTML page.
2
Directory Structure
HTTP Root
Web
Folders
3
Default Web Page
• Server-side scripts
¾A file that is to be executed by the
server, and the output sent back to the
client.
• How does the server know?
¾Two ways:
GET command with a “?”.
POST command.
4
GET Command with a “?”
POST Command
5
POST Command :: Example
Points to Note
6
Proxy Server
Introduction
7
Where it is located?
User
agent
User
agent Access
Rules
Cache
• Request forwarding
¾Primary function.
¾Acts as a rudimentary firewall.
• Access control
¾Allow or deny accesses, based on
Contents
Location
• Cache management
¾Efficient utilization of bandwidth.
¾Faster access.
8
Network Address Translator
(NAT)
What is NAT?
9
Where does NAT reside?
NAT
Private
Network Internet
• Static NAT
¾Used to map an unregistered IP address to
a registered IP address.
¾One-to-one mapping.
N registered addresses for N machines.
• Dynamic NAT
¾Used to map an unregistered IP address to
a registered IP address.
From a given pool of registered IP addresses.
¾Addresses are assigned dynamically.
Any number of internal computers.
A limit N to the number communicating at a time.
10
Various Forms of NAT (contd.)
• Overloading
¾A special form of dynamic NAT.
¾Used to map multiple unregistered IP
addresses to a single registered IP address
by using different ports.
Also called port address translation
(PAT).
Each computer on the private network
gets translated to the same IP address,
but with a different port number
assignment.
¾Widely used.
NAT Overloading ….
11
• Notations:
¾Stub domain: the internal or the private
network.
¾Address translation table (ATT):
maintained by router/NAT for address and
port mapping.
• Easy to implement dynamic NAT.
¾Address translation table need only
contain IP address mappings.
Private to public, and vice versa.
No port numbers needed.
• The scenario:
¾Internal network has non-routable IP
addresses.
¾NAT-enabled router contains a registered IP
address assigned by IANA.
¾An internal host X tries to connect to, say,
an outside Web server.
¾The router receives the packet from X.
12
¾The router will now:
Save IP address and port number from
X’s packet to an ATT.
In the packet, replace the IP address with
the router’s IP address.
Replace the port number with a port
number from the ATT (look for match).
For new connection, generate a unique
port number.
13
¾The ATT looks like:
14
Which addresses to use inside?
• Class A (one)
10.0.0.0 to 10.255.255.255
• Class B (sixteen)
172.16.0.0 to 172.31.255.255
• Class C (256)
192.168.0.0 to 192.168.255.255
15
Other Benefits of NAT
16
SOLUTIONS TO QUIZ
QUESTIONS ON
LECTURE 11
17
Quiz Solutions on Lecture 11
18
Quiz Solutions on Lecture 11
19
Quiz Solutions on Lecture 11
20
QUIZ QUESTIONS ON
LECTURE 12
21
Quiz Questions on Lecture 12
22