Chapter 9 Caching, NAT - PowerPoint PPT Presentation

About This Presentation
Title:

Chapter 9 Caching, NAT

Description:

SQUID caching proxies are common freeware ... NATs are lower level (IP and TCP) vs. Proxies (HTTP) NATs are arguably faster than higher-layer proxies ... – PowerPoint PPT presentation

Number of Views:92
Avg rating:3.0/5.0
Slides: 18
Provided by: profri
Category:
Tags: nat | caching | chapter | proxies

less

Transcript and Presenter's Notes

Title: Chapter 9 Caching, NAT


1
Chapter 9Caching, NAT
  • Professor Rick Han
  • University of Colorado at Boulder
  • rhan_at_cs.colorado.edu

2
Announcements
  • HW 4 due April 16
  • Programming Assignment 3 tonight
  • Next, Caching, NAT

3
Recap of Previous Lecture
  • HTTP
  • Proxies
  • Reasons to use Caching advantages, Security,
    Protocol translation
  • Prefetching
  • GET, POST, PUT
  • Load Balancing
  • HTTP Redirect for load balancing
  • DNS
  • Returns a list of IP addresses matching a name
  • DNS round robin on order of IP addresses, Akamai
  • Routing-based techniques
  • SMTP, MIME

4
Caching Policy at Proxy
  • Relevant HTTP fields
  • Request
  • If-Modified-Since
  • Response
  • Last-Modified
  • Expires
  • Caching proxy doesnt cache pages with
  • Pragma no-cache header field
  • WWW-Authenticate or Authorization headers
  • Server and proxy clocks must be reliable

5
Caching Policy at Proxy (2)
  • Browser has its own browser cache.
  • Browser sends a conditional GET with
    If-Modified-Since header field when
  • a user hits Reload, or
  • a page expired in browser cache, or
  • browser set to always ask for a page,
  • A conditional GET will only succeed in returning
    a page if that page has been modified since the
    If-Modified-Since date.
  • Otherwise, get back a status code 304 Not
    Modified
  • Caching proxy receives a conditional GET what
    is its policy?

6
Caching Policy at Proxy (3)
  • If page not in proxys cache, or cached page has
    expired, or if cached page was Last-Modified
    earlier than requests If-Modified-Since date,
    then
  • Forward Conditional GET to server. If server
    finds its page was Last-Modified earlier than
    If-Modified-Since date, then servers response to
    proxy is status 304 Not Modified
  • Proxy returns status 304 Not Modified to client
  • Else, server returned fresher page, so proxy
    caches it and returns it to client
  • Else
  • return cached page to client (its not expired
    and its freshly modified)

7
Caching Policy at Proxy (4)
  • Summary
  • cached page returned only if not expired and new
    enough (recently modified), otherwise return
    fresher page from server or status 304 message
  • Expires header may be missing, so proxy has
    to guess a probable expiration date
  • If Last-Modified is recent, then guess the page
    is changing frequently, so choose a quick
    expiration date
  • Chaining of caches is allowed, e.g. Browser cache
    chained with Proxy caches
  • SQUID caching proxies are common freeware
  • based on Harvest caches developed in part at the
    University of Colorado, see http//www.squid-cache
    .org

8
More on MIME
  • Displaying non-ASCII character sets
  • augment MIME type and subtype with a qualifying
    parameter
  • Content-type text/plain charset"utf-8"
  • lthtmlgtltheadgtltmeta http-equiv"Content-Type"
    content"text/htmlcharsetbig5"gtlt/headgt
  • Some other character set codes are
  • korean for Korean KSC 5601, big5 for Chinese
    big5, x-euc-jp for Japanese EUC, iso-2022-jp for
    Japanese JIS, utf-8 for UniCode
  • MIME also supports non-ASCII headers, RFC 2047

9
Well-Known TCP Ports
  • Many application-level protocols rely on
    client-server paradigm
  • Server or daemon should be up and running on a
    well-known port
  • Client then contacts server on well-known
    destination TCP port
  • Clients source TCP port can be any above the
    reserved limit of 1023, for safety choose gt 5000
  • IANA reserved/well-known TCP ports
  • 80 http
  • 20 ftp-data, 21 ftp control
  • 23 telnet
  • 25 smtp

10
Network Address Translation (NAT)
LAN
External
  • Enables reuse of IP addresses, gets around IPs
    limited 32-bit address space
  • TCP-level semantic knowledge is required
  • TCP/IP source
  • Wants to send to cnn.com
  • creates packet ltIP sender, TCP sender port, IP
    dest, TCP dest portgt
  • NAT has a local IP LAN address and an external IP
    address

11
NAT (2)
NAT Network Addr Trans
TCP/IP destination cnn.com
TCP/IP source
LAN
External
  • NAT receives packet and
  • Replaces IP sender addr with its own external IP
    address
  • Replaces TCP sender port with its own TCP source
    port, chosen from a list of available source
    ports
  • Sends packet to destination
  • Stores a mapping of ltsender IP, sender TCP portgt
    to ltNAT IP, NAT TCP src portgt

12
NAT (3)
NAT Network Addr Trans
TCP/IP destination cnn.com
TCP/IP source
LAN
External
  • When a reply packet is received from cnn.com on
    NAT TCP src port
  • NAT substitutes the original senders IP sender
    address and TCP sender port
  • Even if two sources on same LAN choose the same
    TCP sending port, theyll differ in their IP
    addresses input/output mapping still unique
  • Extends IP address spaces by qualifying addresses
    with TCP port s

13
NAT (4)
LAN
External
  • NAT needs to modify IP address and TCP port and
    TCP/IP checksums
  • Adds latency
  • The type of NAT described thus far is called a
    Dynamic NAT
  • Internal hosts can use any non-reserved IP
    address to connect to external hosts
  • External hosts dont know about internal IP
    addresses NATs as masquerading firewalls!

14
NAT (5)
  • Static NATs allow an external client to connect
    to an internal TCP/IP server, e.g. a Web server,
    at a specific address
  • External host cant just send a Web request to
    NATs external IP address, port 80, because NAT
    wont know to which internal host to route the
    http request
  • Static NAT allocates a fixed IP address for the
    Web server and constructs a static mapping from
    ISP-assigned external IP to internal IP
  • Static NAT also called inbound mapping

15
NAT (6)
  • Static NATs work with FTP and other application
    layer protocols as well
  • Static NATs introduce security risk allowing
    unknown outsiders to connect into a local
    computer
  • Configure your NAT router to have two Ethernet
    LAN ports with separate IP addresses
  • Place machines you wish to be public on one IP
    addresses, and keep private hosts on 2nd IP
    address

16
NAT (7)
NAT Network Addr Trans
TCP/IP source
LAN
  • NATs can be used a load balancers too
  • TCP/IP Packets into a NAT are rewritten with the
    IP address and TCP port of the most lightly
    loaded destination
  • Reply packets from destination also rewritten by
    NAT on way back to source

17
NAT (8)
LAN
External
  • Comparing NATs and Proxies
  • Similar architecture of intermediary between
    client and server
  • NATs are lower level (IP and TCP) vs. Proxies
    (HTTP)
  • NATs are arguably faster than higher-layer
    proxies
  • NATs are transparent to source and destination
    nodes, whereas HTTP clients are explicitly aware
    that there is an HTTP proxy intermediary in their
    path to the HTTP server
Write a Comment
User Comments (0)
About PowerShow.com