Courses/Computer Science/CPSC 441.W2014

= Links =
 * Idea based on Alexander Bird's Other Information page

Back To Navigation

= Textbook Notes =

Back To Navigation

= Introduction = Hello, my name is Carrie Mah and I am currently in my 3rd year of Computer Science with a concentration in Human Computer Interaction. I am also an Executive Officer for the Computer Science Undergraduate Society. If you have any questions (whether it be CPSC-related, events around the city, or an eclectic of random things), please do not hesitate to contact me.

I hope you find my notes useful, and if there are any errors please correct me by clicking "Edit" on the top of the page and making the appropriate changes. You should also "Watch this page" for the CPSC 441 page to check when I upload notes. Just click "Edit" and scroll down to check mark "Watch this page."

You are welcome to use my notes, just credit me when possible. If you have any suggestions or major concerns, please contact me at cmah[at]ucalgary[dot]ca. Thanks in advance for reading!

= Course Information =

Disclaimer: This is a page created by a student. Everything created and written by me is not associated with the Department of Computer Science or the University of Calgary. I am not being paid to do this nor am getting credit. I was a class scribe for CPSC 457 and enjoyed it so much that I wanted to continue it with a course related to it. I find writing Wiki notes for courses I am not familiar with are helpful for me, so I hope you find these notes helpful. I encourage that you still write your own notes, as it helps you retain information, but my notes are public and free to use!

This course is for W2014, taught by Dr. Carey Williamson.

The course website is here: http://pages.cpsc.ucalgary.ca/~carey/CPSC441

= Week 1 =

Overview of the Internet. LANs and WANs. OSI reference model, Internet TCP/IP Protocol Stack. Client/server paradigm, circuit-switching, packet-switching, Internet structure, networking delays and packet loss.

Definitions

 * Computer Network : A set of autonomous computers that are hooked together somehow so that they can communicate with each other
 * Informal definition: set of computers that are hooked together somehow so that they can communicate
 * Hooked together somehow (wireless network interface, ethernet network, satellite link, fiber optic link), in some form of channel over some medium in which devices can communicate that can send network packets or exchange data in ways more valuable than a single computer


 * Examples:
 * Home network: wireless, desktops, gaming devices (wi-fi), servers, etc.
 * Multiple devices hooked up somehow and they can communicate. Can do more with a network than an individual computer
 * UofC campus network
 * The Internet


 * Protocol : The rules used for communication between two parties
 * The rules for how two entities communicate
 * Specifies types of messages you can send, syntax/format of messages, the order in which the messages might get sent, the timing of messages (what to do when you can't do anything)
 * Computer communication protocols are used in this course
 * Example: humans
 * One protocol: walk towards them, look them in the eye, shake their hand, etc.
 * When you follow the rules, it works well, if you don't it gets wacky
 * Example: if we shake with a left hand, it's hard to establish the connection when you don't follow the rules
 * What messages are responsible, what you do, etc.
 * Finite-state machines, how two machines talk to each other
 * Protocols get organized into a modular, well-defined structure


 * Stack : A pile of things, usually with one thing on top of another
 * Layered way of organizing communication protocols
 * Pile of stuff, where each protocol has a well-defined functionality that builds a service/value that offers up to the stack


 * The Internet is built using a layered stack of communication protocols
 * It takes the 'rat nest' of different protocols, into a 5-layered protocol stack that gives structure some meaning to how devices communicate

Protocols and Applications

 * May recognize:
 * Youtube
 * Point-to-point protocol (ppp): above physical layer used from modem to computer (remember 'dial-up' modems?)
 * Use telephone (analog from humans) and digital input from computer, to analog, through modem
 * How phone talks to modem pool to Internet service provider (on low level)
 * Hypertext Transfer Protocol (Secure) HTTP(S): Getting hypertext from The Internet. It lets you look at web pages, and (secure) would be for encrypted data (like the bank)

Internet Protocol Stack

 * Application users : supports end-user services and network applications
 * HTTP, SMTP, DNS, FTP, NTP
 * Users live at the top of the layer, using things like Youtube, BitTorrent, e-mail
 * Makes use of files - simple application protocols that deal with web pages, messages, video frames, attachments, etc.


 * Transport : end to end data transfer
 * TCP, UDP


 * Network : routing of datagrams from source to destination
 * IPv4, IPv6, BGP, RIP
 * Addressing and routing - where a given web server is and how to get there, breaks data into packets to relevant data


 * Data link : channel access, framing, flow/error control, hop by hop basis
 * PPP, Ethernet, IEEE 802.11b
 * Wi-fi, etc. protocols how to communicate over a single link over the entire Inernet


 * Physical : transmission of bits
 * Digital sends over communication into bits

Example: HTTP and TCP

 * The web uses HTTP and TCP (Transmission Control Protocol)
 * Web client and web server communicate constantly, back and forth
 * SYN first from web client to web server, SYN/ACK back, ACK and GET URL to web server; data appears; then FIN from web server to web client, FIN/ACK back, then ACK to web client


 * When you download a web page, it uses the application layer protocol (HTTP)
 * Underneath, it uses the transport layer (TCP) and it knows how to send data reliably between two computers over The Internet
 * Basically a conversation of "Hello web server, are you there?" "Yes SYN, who wants to know?" "It's me of course?" "What would you like today?" "I would like to get a web page"
 * There's a handshake when you meet, then a goodbye; the middle contains data that does useful stuff
 * Talk to the server: data comes across the network in network packets

Network Packet Structure

 * DataLink Layer Header -> Network Layer Header -> Transport Layer Header -> Payload
 * Packets are sent (envelope, wrapper around payload [message])
 * Payload : user level data
 * Who sent this (IP of website), destination address (of computer)


 * Transport Layer Header : outer wrapper
 * Example: TCP
 * Packets come from a web server, goes to the client browser


 * Network Layer Header : wrapper outside of that
 * Example: IP
 * IP packet of which computer it's going to


 * DataLink Layer Header : outer-most wrapper
 * Example: Wi-Fi, Ethernet
 * Wireless Wi-Fi header that says that packet allows communication

Warriors of the Net

 * Video link
 * Dawn of the net
 * Clicking a link: flow of information, traveling to ‘mail room’ and packages it and sends it
 * Packets limited in size, mail room divides appropriate sizes
 * Label: sender, receiver’s address, type of packet it is
 * Packet to internet: proxy server
 * Packet launched to LAN, a network used to connect all computers for information exchange within walls of building
 * Packet goes to a different network, the router - a systematic organization of packets
 * As packets leave router, they head to corporate Internet (router switch)
 * More efficient than router, routes them to their way – pinball wizard, leading packets on their way


 * As packets arrive to destination, picked up by network interface ready to be sent to the next level (proxy)
 * Proxy used by companies as a middle man to lessen load of connection, and for security reasons


 * Packets are various sizes depending on their content
 * Proxy opens packet, looks for web address (url)
 * If acceptable, packet sent to The Internet
 * Some addresses that don’t make approval of proxy (management, corporate disapproval) are ‘destroyed’


 * Corporate firewall: 2 purposes
 * Prevent nasty thing from The Internet to Intranet, and from Intranet (sensitive info) to Internet


 * Router picks up packet to a row (bandwidth) not broad enough for the road
 * If IP doesn’t acknowledge packet in due time, sends a replacement packet


 * Now, world of The Internet: interconnected networks spanning the world
 * Routers and switches establishes links across network
 * Request ping: mess up unsuspecting homes


 * The World Wide Web/Wait: routes taken may not be fast but it will get there
 * End of destination: another firewall
 * As a data packet, could be bastion of security of dreaded adversary
 * Depends on your intentions
 * Lets in packets that meet its criteria


 * Port 25 used for mail packets, port 80 used for packets from Internet to web server
 * Inside firewall, packets screened more thoroughly
 * Ping of death discuses itself as a packet, but firewall can notice it


 * Journey almost over: to be taken to web server (run on main frame, web cam or computer)
 * One by one, packets are received, opened and unpacked
 * Information it contains (your request) is sent to web server application
 * Packet itself is recycled, ready to be used again and filled with your requested information


 * Addressed, sent out on its way back to you – back the firewall, raptors and onto The Internet
 * Back through corporate firewall, and onto your interface, ready to supply web browser with requested information

Summary

 * This course focuses on the principle underlying the design of modern computer communication networks
 * The Internet and its protocol stack will be used as primary examples

January 10: Introduction Continued
 Networking Basics

Networks Recap

 * Why networks?
 * (1) Information sharing
 * (2) Share resources
 * (3) Remote access
 * (4) Economy of scale
 * Scale up instead of deploying individual machines
 * (5) “Network effect”
 * The whole is greater than the sum of the parts
 * Ex. If you have 3 friends who knows other friends, etc. – big network, access to everyone’s knowledge
 * Drivers of why The Internet was created in the first place


 * Internet “Big Three” for the birth of the internet
 * (1) Remote login
 * Able to access computing resources to somewhere
 * Protocol called rlogin created (telnet, ssh, secure shell)
 * (2) File transfer
 * Take data sets and analyze them using high performance computers in another place – way to move data files back and forth
 * ftp
 * (3) Electronic mail
 * Spinoff of file transfer as e-mail is another file
 * Did not anticipate what e-mail would become – people started using it

Assignment 1 Details

 * Similar to Warriors of Net – looking into packets and have a protocol of which packets are allowed and which are not
 * Need to know:
 * Program in C (first tutorial)
 * Socket programming (second tutorial)
 * Write a server (third tutorial)
 * Know how HTTP works (fourth tutorial)

LANs and WANs

 * Networks come in many shapes and sizes
 * LAN: Local Area Network
 * Limited geographic coverage, 1km or less (e.g. lab, building)
 * Example: Home network, campus network, Ethernet LAN, Wi-Fi


 * MAN: Metropolitan Area Network
 * If City of Calgary had something for downtown – metropolitan area


 * WAN: Wide Area Network
 * Large geographic coverage, 100 km or more (e.g. country, planet)
 * Cross city/provincial/national boundaries and network with a lot of different places
 * Country, planet, variety of technologies (fiber optics, cable, satellite network, different physical layered technology)
 * Different capacities/bandwidth, go different distances (home network)
 * Example: Cybera, cellular networks, Internet


 * Technologies differ (capacity, distance, cost)

Network Diagram
http://i.imgur.com/wxtmdbA.png

Bigger image


 * Network between home and UofC
 * You move around on the roads (links) in cars (packets)
 * On a path, there are links
 * Routes and paths have different speed limits and congestion rate (packet loss/delay)
 * You access a link by an edge
 * Low speed, low volume, access links to network
 * CORE
 * Similar to roads with no traffic lights and 3 lanes


 * Many concepts in computer networks come from other areas
 * Telephone network, postal system similar to this
 * Telephone network:
 * Phones, calls, trunk lines, toll offices, switching
 * Postal system
 * Letters/parcels, addresses, mail carriers, post office
 * Drop in mail, sent somewhere, and postal delivery system drops it off
 * Highway network
 * Cars/buses, streets/highways, congestion, collisions
 * Broadcast TV
 * Channels, stations, TVs, streaming (live/stored)

Communications Networks

 * Phone network vs The Internet
 * Similar goals, different mechanisms
 * Historically different philosophies of how you build
 * Phone: voice and Internet: data


 * “Telco” view (i.e. telecommunications networks to support voice telephony and other types of services, such as fax, data, location, etc.)
 * Telecommunication providers want to support voice
 * Other things like fax machines, data sources, etc. came along


 * Data networking view (i.e. the Internet)
 * Gets files back and forth


 * How to get across geographic locations, diverse climate, etc.?
 * Two approaches share some similar goals and challenges (e.g. scale, geography, heterogeneity), they have quite different underlying assumptions

Telco Networks

 * Over 100 years old
 * Designed for transmission of human voice, and make it transmitted in the same way
 * Take 8-bit sample being transmitted


 * Twisted pair copper wire for residential access
 * “Cheap,” adequate bandwidth, easy to handle


 * Aggregation of multiple calls at toll office for multiplexing/demultiplexing using TDM
 * Low bandwidth required per call (e.g. 64 kbps)
 * Fixed bandwidth required per call
 * Phone network, device is a telephone (cheap) and what comes to your house is a twisted copper wire (cheap) and functionality is minimal (call or answer a call)
 * Inside the network – trunk lines, access lines, toll officers, interexchange points, traffic exchanges, etc.


 * Make edge devices simple, and make the core complicated
 * Design: circuit-switching, telco networks are circuit-switched networks
 * Call routing and circuit allocation decided once per call at time of call arrival
 * End-to-end path allocation, with dedicated circuit (reserved bandwidth) per active call
 * If home phone wanted to call UofC phone, you pick up your handset, enter numbers, asks toll office (links with many wires inside of them, one of which you own) if there’s a way to connect, and it finds a path that works to make the UofC phone ring
 * End to end dedicated connection, in which humans can talk and listen
 * Dedicated circuit/path/wire, that you own for the duration of the call
 * Pay for how many minutes you use that line for


 * When a call is placed: find routing path, establish state information in each of the switches, using a specific line, to know who is talking to who using a specific line
 * This is circuit switching


 * All bits travel same path; stay in same order
 * Call state information crucial in network switches
 * Busy signal if no path possible (blocking <= 2%)
 * Billing model based on time used (in minutes)
 * Single class of service; high reliability (99.99%)
 * Additional services: faxes, modems, mobility…

The Internet

 * About 40 years old
 * Designed for transmission of data
 * Wide range of access technologies, devices
 * Wide range of user and application behavior (unpredictable)
 * Variable-size packets permitted
 * Bursty, variable bandwidth required by apps
 * Aggregation of traffic at routers/switches
 * Transmission links shared on stat mux basis
 * In The Internet, if I am sending data packets from home to UofC:
 * Data packet has a piece of information in front of a header/address of where we’re sending it to, who’s receiving and how big it is
 * Packet transmits to a different router, and router keeps sending them on a path
 * If link crashes, the previous router chooses another
 * Packet at a time, one router at time
 * Connection less protocol


 * Core simple, edge complicated
 * Packet-switched network


 * Connection-less network layer protocol (IP)
 * “Best effort” datagram delivery model
 * Packet routing decided on a per-packet basis
 * No end-to-end path allocation; no reserved bandwidth per active call
 * Packets can travel any path; packets can be delayed, lost, duplicated, re-ordered
 * Minimal state information in network switches
 * Single class of service
 * Billing model? (hours? Packets? Bytes? Bandwidth?)
 * Generate data packets, drop in mailbox and try to get it to destination
 * Service model: best effort
 * The Internet tries its best to deliver packet, some of them will get there and some will not. No guarantee that packet will be sent


 * If route fails, the packet gets dropped and the next packet comes along, with updated routing information
 * When it sees a broken link it goes to a different path


 * Usually the “best effort” routing algorithm yields the shortest path. If packets get lost, update it to go a different way
 * ICMP sends back error messages

Multiplexing

 * Multiplexing: doing more than one thing at the same time
 * Example: Walking and chewing gum

FDM vs TDM Diagram
http://i.imgur.com/uIePmzW.png

Summary

 * Key concepts that underly many of the computer networks that we will talk about:
 * Network edge: end system devices, access links, LAN
 * Network core: aggregation, switching, multiplexing, WAN


 * An ‘internetwork’ is a ‘network of networks’
 * Example: hoe to ISP, connected to Telus


 * ‘The Internet’ is a massive global internetwork
 * Protocols are the glue for putting these together

 Chapter 1


 * Notes adapted from slides created by JFK/KWR and lectures held by Dr. Carey Williamson
 * All material copyright 1996-2012 © J.F Kurose and K.W. Ross, All Rights Reserved

Section 1.1: What Is the Internet?

 * Millions of connected computing devices:
 * Hosts = end systems
 * Running network apps
 * Live at edge of network
 * Runs a full protocol stack so it supports the network application you want to make use of
 * Examples: PC, server, smartphone, tablet, laptop, fridge


 * Communication links
 * A channel, way to get bits from one side to another
 * Examples: physical cable or air (wireless, radio), copper, carrier pigeon; wireless or wired links
 * Transmission rate: has particular distance, capacity (bandwidth), latency (delay), certain transmission time, etc.


 * Packet switches :
 * Forwards packets (chunks of data)
 * Interconnection, internet exchange
 * Routers and switches
 * Router lives in core, knows about links and knows where packets want to go


 * “Fun” internet appliances
 * IP picture frame
 * Internet refrigerator
 * Slingbox: watch, control cable TV remotely
 * Web-enabled toaster and weather forecaster
 * Tweet-a-watt: monitor energy use
 * Internet phones

A “Nuts and Bolts” View

 * Internet : “network of networks”
 * Interconnected ISPs
 * Home network connected to ISP (Shaw, Telus) which runs a network that connects to residential home
 * UofC buys from Telus, which might buy from Bell, which buys from…(etc.)
 * Example: at home, you’re connected to UofC server: link over to ISP, to Telus/UofC backbone into firewall, into CPSC and into file/web server and sending web page back


 * Protocols : these control sending, receiving of messages
 * Define how packets get constructed, who sends them, where they go, what you do when you get them
 * Examples: TCP, IP, HTTP, Skype, 802.11


 * Internet standards :
 * Set of documents called Request for Comments (RFC)
 * Every protocol is defined in an RFC, a public open-source document
 * Internet Engineering Task Force (IETF) have regular meetings to talk about the evolution of The Internet, new protocols, security problems, etc.
 * You can try to submit a protocol yourself

A Service View

 * Hosts, links, routers – communication view
 * Infrastructure that provides services to applications
 * Examples: Web, VoIP, e-mail, games, e-commerce, social nets…


 * Provides programming interface to apps
 * Hooks that allow sending and receiving app programs to “connect” to Internet
 * Provides service options, analogous to postal service


 * Internet has infrastructure that allows you to build applications
 * Public API that allows you to connect to lower-layered protocol and you can build it (how Web, e-mail, gaming, Facebook, Youtube got invented)
 * Enabling platform with protocol standards

What's a Protocol?

 * Protocols define format, order of messages sent and received among network entities and actions taken on message transmission, receipt
 * Human protocols
 * “What’s the time?”
 * “I have a question”
 * Introductions
 * Specific messages sent
 * Specific actions taken when messages received, or other events
 * Example: "Hi," "Hi," "Got the time?" "2 PM"


 * Network protocols
 * Machines rather than humans
 * All communication activity in Internet governed by protocols
 * Example: "TCP connection request" "TCP connection response" "Get " " "

Back To Navigation

= Week 2 =

January 13: Chapter 1 Continued
 Chapter 1: Computer Networks and The Internet


 * Notes adapted from slides created by JFK/KWR and lectures held by Dr. Carey Williamson
 * All material copyright 1996-2012 © J.F Kurose and K.W. Ross, All Rights Reserved

Section 1.2: Network Edge
Network Structure :


 * Network edge
 * Hosts: clients and servers
 * Can run client and server software
 * Servers often in data centers
 * Where most of us live (residential access)


 * Access to network, physical media
 * Wired, wireless communication links
 * Examples: ethernet, fiber, dial-up


 * Network core
 * Interconnected routers
 * Network of networks
 * Owned by big companies, but users can access links with packets

Access Networks and Physical Media

 * How to connect systems to edge router?
 * Residential access nets
 * Institutional access networks (school, company)
 * Mobile access networks


 * Keep in mind of:
 * Bandwidth (bits per second) of access network?
 * Shared or dedicated?

Link Types

 * Talking about link layered protocol
 * Access technologies

Access Net: Digital Subscriber Line (DSL)

 * Use existing telephone line to central office DSLAM (DSL access multiplexer)
 * 2 decades old, way of exploiting existing telephone network and putting data transmission on a different frequency range on a regular voice traffic
 * Voice, data transmitted at different frequencies over dedicated line to central office
 * Data over DSL phone line goes to Internet
 * Voice over DSL phone line goes to telephone net


 * DSL uses phone network infrastructure
 * <2.5 Mbps upstream transmission rate (typically < 1 Mbps)
 * <24 Mbps downstream transmission rate (typically < 10 Mbps)

Access Net: Cable Network

 * Frequency division multiplexing: different channels transmitted in different frequency bands
 * Same with cable TV – puts data on channel or frequency range
 * Different video and data channels – cable modem can shift frequency range depending on bits
 * Shared link, as you and neighbors on the link
 * HFC: hybrid fiber coax
 * Asymmetric: up to 30Mbps downstream transmission rate, 2 Mbps upstream transmission rate


 * Network of cable, fiber attaches homes to ISP router
 * Homes share access network to cable headend
 * Unlike DSL, which has dedicated access to central office

Toys and Gadgets

 * Wfi Access point (ethernet on one side, wireless on the other [with antennas])
 * Wimax – microwave signals to communicate from device to cell tower, connecting into backbone infrastructure of structure
 * Wireless over Wimax link


 * Thickwire Ethernet – yellow
 * 3-com connector, co-axil transmission (70s)


 * Thinwire Ethernet – black
 * Co-axil cable (same cable to Shaw cable), more flexible


 * Twisted Pair – gray
 * Telephone, fax machine
 * Two tips of wires (spun around each other), connector plugs in


 * Ethernet – blue
 * More pairs twisted and packed


 * Ethernet – yellow
 * Category 3 – individual twisted pairs cut up


 * Fiber optic – orange
 * Refined glass, thin strands of class (human hair)
 * Tip has pinpoint hole where fiber is; rest of it is packaging to make fiber safe to handle, and put connectors on

Enterprise access networks (Ethernet)

 * Computer and router connected to ethernet switch (1); institutional mail, web servers connected to ethernet switch (2); both (1) and (2) connected to institutional router, with institutional link to ISP (Internet) leaving the router
 * Typically used in companies, universities, etc.
 * 10 Mbps, 100 Mbps, 1 Gbps, 10 Gbps transmission rates
 * Today, end systems typically connect into Ethernet switch

Wireless Access Networks

 * Shared wireless access network connects end system to router via base station aka ‘access point’
 * Wireless LANs
 * Within building (100 ft)
 * 802.11 b/g (Wi-Fi): 11, 54 Mbps transmission rate


 * Wide-area wireless access
 * Provided by telco (cellular) operator, 10 km
 * Between 1 and 10 Mbps
 * 3G, 4G: LTE

Network Comparison Diagram
http://i.imgur.com/kal9Dci.png

Bigger image

Hosts

 * Sends packets of data
 * Host sending function
 * Takes application message
 * Breaks into smaller chunks, known as packets, of length L bits
 * Transmits packet into access network at transmission rate R
 * Link transmission rate, aka link capacity, aka link bandwidth


 * Packet transmission delay = time needed to transmit L-bit packet into link = L (bits) / R (bits/sec)

New information from January 15 lecture


 * Hosts take application layer to kernel to build/send packets over network
 * Network bandwidth
 * Engineering definition: spectral bandwidth
 * Range within electromagnetic spectrum
 * Expressed in Hertz (Hz)
 * Cycles per second – frequency of waves fluctuating
 * Computer Science definition: data rate
 * Capacity at which information can be sent
 * Expressed in bits per seconds (bps)
 * Related concepts, difference: how bits are encoded
 * If you have a packet of a given size (L), the time needed to transmit it with a given data rate are bps; end up with sec

Transmission Media

 * Guided
 * Physical
 * Guided media : signals propagate in solid media : copper, fiber, coax
 * Bit : propagates between transmitter/receiver pairs
 * Physical link : what lies between transmitter and receiver
 * Examples:
 * Twisted pair (TP) : two insulted copper wires
 * Category 5: 100 Mbps, 1 Gbps Ethernet
 * Category 6: 10 Gbps
 * Cable with physical presence; signals go in one end and out the other, and you know where signal is going
 * Signals in wire, nowhere else
 * Cheapest
 * Coaxial cable : two concentric copper conductors
 * Bidirectional
 * Broadband: multiple channels on cable, HFC
 * Higher transmission rate because better insulation in media
 * Outer protective plastic coating, some woven wire, and cladding, then the core
 * Goes a longer distance than twisted pair
 * Fiber optic cable : glass fiber carrying light pulses, each pulse is a bit
 * Transmit multiple GB of data over extremely long distance (several 100 km)
 * High-speed operation: high-speed point-to-point transmission (e.g., 10’s-100’s Gpbs transmission rate)
 * High data rate of 1 million times a second – light pulse (1 - on, 0 - none)
 * Low error rate:
 * Repeaters spaced far apart
 * Immune to electromagnetic noise


 * Unguided
 * Invisible; transmitting signals on physical layer, may propagate through air or free space
 * Unguided media : signals propagates freely
 * Signal carried in electromagnetic spectrum
 * No physical 'wire', bidirectional
 * Propagation environment effects: reflection, obstruction by objects, interference
 * Radio link types
 * Terrestrial microwave (microwave access link): up to 45 Mbps channels, 50-100 km
 * Example: UofC to Vet college - targeted line of transmission
 * LAN: 11 Mbps, 54 Mbps, 100 m for Wi-Fi (not far)
 * Example: Wireless - laptop emanating signals that propagate through the room (signal goes everywhere in many directions)
 * Connecting to some access point that interprets the signal (omni-directional)
 * Wide-area: 3G cellular (~ few Mbps) - Example: cellular
 * Satellite: Kbps to 45Mbps channel (or multiple smaller channels)
 * Uses specialized equipment, much longer distances
 * Things rotate around Earth, broadcasting a large footprint on Earth; some directional control
 * Since it’s so high in orbit, takes a long time to get signal sending from Earth to space (270 msec end-end delaay, big latency, propagation delays)
 * Carrier pigeon: message on link, hopefully pigeons go to right place

Back To Navigation

Section 1.3: Network Core

 * The Network Core
 * Mesh of interconnected routers
 * Special place where network providers live (Telus, Bell, AT&T)
 * Users live at edge, network providers in core
 * Routers
 * Packet-switching : hosts break application-layer messages into packets
 * Forwards packets from one router to the next, across links on path from source to destination
 * Each packet transmitted at full link capacity
 * Design decision – packet vs context switch (packet is how it works)

Packet-switching: Store-and-forward

 * Takes L/R seconds to transmit (push out) L-bit packets into link R bps
 * Store and forward : entire packet must arrive at router before it can be transmitted on next link
 * End-end delay = 2(L/R)
 * Assuming zero propagation delay


 * One-hop numerical example:
 * L = 7.5 Mbits
 * R = 1.5 Mbps
 * One-hop transmission delay = 5 sec


 * Routers store and forward
 * If packet is coming from wireless interface, wait for entire packet to arrive, store it in device (buffer), and when link on other side (Ethernet) is available, send packet in its entirety at the link rate on other side
 * Receive entire packet before making a decision; needs outbound link to be free

Packet Switching: Queuing Delay, Loss

 * If arrival rate (in bits) to link exceeds transmission rate of link for a period of time:
 * Packets will queue, wait to be transmitted on link
 * Packets can be dropped (lost) if memory (buffer) fills up


 * Packets could arrive more quickly than router is able to send them forward
 * Two hosts sending at high data rate into a router with outbound link of slow capacity
 * Queue of packets build up, and when it gets large, some incoming packets may not fit into buffer and may be thrown out

Packet Switching Diagram
http://i.imgur.com/VyBZfWv.png Bigger Image

Two Key Network-Core Functions

 * Routers route and forwards
 * Functions are slightly different in terms of time scale at which they occur
 * Routing : determines source to destination route taken by packets
 * Done periodically
 * Uses routing algorithms
 * Example: Every day, hour, minute


 * Forwarding : move packets from router’s input to appropriate router output
 * Done for every packet, makes use of database

Routing and Forwarding Diagram
http://i.imgur.com/GgF2sI5.png


 * Packet is blue, has an address
 * It arrives to router where it makes a forwarding decision
 * Looks up address in routing table (tells what header value goes to which output link)
 * Database called routing table
 * Routing computation done on periodic basis
 * Communicates with other routers it’s connected to (who they are, how far they are, how busy it is, cost of link) and builds database with set of routes, populating to the routing table and may affect other routing tables

Alternative Core: Circuit Switching

 * End-end resources allocated to, reserved for “call” between source and destination
 * Slide 28 Diagram
 * Each link from the router has four circuits
 * Call gets 2nd circuit in top link and 1st circuit in right link


 * Dedicated resources: no sharing
 * Circuit-like (guaranteed) performance


 * Circuit segment idle if not used by call (no sharing)
 * Commonly used in traditional telephone networks
 * Example: voice - end-to-end resource allocation every time call arrives

Circuit Switching: FDM versus TDM

 * Recall Multiplexing section
 * Two simple multiple access control techniques
 * Each mobile’s share of the bandwidth is divided into portions for the uplink and the downlink. Also, possibly, out of band signaling
 * As we will see, used in AMPS, GSM, IS-54/136

Packet Switching Versus Circuit Switching

 * Packet switching allows more users to use the network
 * Example:
 * 1 Mb/s link
 * Each user: 100 kb/s when ‘active’ but only active 10% of the time
 * Circuit-switching: 10 users (1 busy, 9 silent, full output link reserved)
 * Packet switching: With 35 users, probability > 10 active at same time is less than 0.0004
 * Can put all users without saturating 1 Mb/s link
 * If individuals operate independently, rare for all users to be busy at the same time
 * Occasional delay, packet loss and interruption of quality of service


 * Is packet switching a ‘slam dunk winner?’
 * Great for bursty data
 * Resource sharing
 * Simpler, no call setup
 * Excessive congestion possible: packet delay and loss
 * Protocols needed for reliable data transfer, congestion control
 * How to provide circuit-like behavior?
 * Bandwidth guarantees needed for audio/video apps


 * Human analogies of reserved resources (circuit switching) versus on-demand allocation (packet-switching)?
 * Example: Hotels, airlines
 * Fly to Orlando: book in advance – reserved resource, plane waiting for you to lead you to destination


 * Example: go to work, multi-plex around each other when driving to destination

Internet Structure: Network of Networks

 * End systems connect to Internet via access ISPs
 * Residential, company and university ISPs


 * Access ISPs in turn must be interconnected
 * So that any two hosts can send packets to each other


 * Resulting network of networks is very complex
 * Evolution was driven by economics and national policies


 * Internet hierarchy of how different pieces fit together
 * Home user subscribe to ISP to get Internet access
 * Telus and Shaw are lowest level of hierarchy – they buy from AT&T, Bell Canada (higher)
 * 1 million different ISPs in different areas; given millions of access ISPs, how to connect them together?
 * Option: simplest way to connect them is to make all ISPs connect to every other access ISP
 * Connecting each access ISP to each other directly doesn’t scale: O(N^2) connections.
 * Too expensive; graph theory argument – every time you add another ISP, you have to add another link
 * Option: connect each access ISP to a global transit ISP? Customer and provider ISPs have economic agreement
 * Special hierarchy, single global ISP willing to aggregate and connect everybody else together
 * Local ISP from access network connects to global ISP and figures out destination router
 * But if one global ISP is viable business, there will be competitors...
 * If being global, multiple companies will compete for space
 * Regional or national in scale, but there's international connectivity
 * Access networks rely on ISPs on that same level – but are not connected; they’re islands
 * But if one global ISP is viable business, there will be competitors...which must be interconnected
 * Closer to reality
 * Peering relationships between big network service providers
 * Peering links exist between the different ISPs
 * Internet exchange points (IXPs) might get mandated by Government controlling packets, or third party providers want to provide connectivity but not involved in ISPs
 * Connecting ISPs without peering relationships
 * … And regional networks may arise to connect access nets to ISPS
 * Localized, regional, international ISPs
 * … And content provider networks (e.g. Google, Microsoft, Akamai) may run their own network, to bring services, content close to end users
 * Content distribution network
 * Companies like limelight that want to provide content efficiently all places on planet with minimal cost


 * At center: small number of well-connected large networks
 * “Tier-1” commercial ISPs (e.g. Level 3, Sprint, AT&T, NTT): national and international coverage
 * Content provider network (e.g. Google): private network that connects IT data centers to Internet, often bypassing tier-1, regional ISPs


 * Users live on bottom, talk to Shaw/Telus
 * Shaw/Telus talks to Bell Canada to get access to national network
 * As you move up, top are the big players (Sprint, AT&T, Level 3)
 * Connect national networks together


 * Point-of-Presence (POP): router for moving traffic to other network providers, as well as others to customer
 * Router to/from backbone, peering connects to/from customers

Internet Structure Diagram
http://i.imgur.com/ZKJzW2f.png Bigger Image

Back to Navigation

How Loss and Delay Occurs

 * Packets queue in router buffers
 * Packet arrival rate to link (temporarily) exceeds output link capacity
 * Packets queue, waits for turn


 * Example
 * Packet at front of buffer: transmitted (delay)
 * Packet behind it: queuing (delay)
 * Free (available) buffers: arriving packets
 * Dropped (loss) if no free buffers
 * If all buffers start to fill up, start throwing away packets (mostly the newest ones incoming)

Four Sources of Packet Delay

 * Nodal processing delay : d_proc
 * Checks bit errors
 * Determines output link
 * Typically less than a msec
 * Need to copy from application layer -> network layer (syscall and data call overhead involved)
 * Processing time that happens in host


 * Queuing delay : d_queue
 * Time waiting at output link for transmission
 * Depends on congestion level of router
 * Waiting turn on network interface to go onto link
 * Highly variable delay
 * Sometimes link is free and you get on Internet with 0 delay; but in worst case could be in a large waiting line (FIFO queue)
 * Usually dominates the calculation


 * Transmission delay : d_trans
 * L: packet length (bits)
 * R: link bandwidth (bps)
 * d_trans = L/R
 * How long it takes to push a packet out to the link
 * If you know size L in bits, divide it by link rate R in bps to get a unit of time (measure of elapsed time from front to last bit of packet)
 * Finite amount of transmission


 * Propagation delay : d_prop
 * d: length of physical link
 * s: propagation speed in medium (~2x10^8 m/sec)
 * d_prop = d/s
 * ‘Speed of light’: finite time of bit from sender to receiver
 * Physical distance and speed of light in that transmission beam

Packet Delay Diagram
http://i.imgur.com/d5TaByz.png

Java Applet Example: Transmission versus Propagation Delay

 * Link
 * Sender on left, receiver on right; can generate and send packets (red thing)
 * Faster: packet is same size in bits, but transmission rate is compressed in time; same propagation delay (receiver same distance)
 * Size of packet changes transmission time, not propagation time
 * 10/10/500: mostly transmission, propagation is minimal (in other examples, propagation was mostly involved)

Calculation Example

 * Assume 1000-byte packet to be sent to ISP which is 12 km away
 * Dialup modem: 56 kbps
 * Processing: 0.00300 sec (normal laptop)
 * Queuing: 0.000000 sec (Internet free)
 * Transmit:
 * L = 8000 bits in 1000 Bytes
 * R = 56 000 bps in 56 kbps
 * 8000/56 000 = 0.142857 sec


 * Propagation:
 * s = 2x10^8 m/sec, 5 ms/km
 * 5x12 = 0.000060 sec


 * Total: 0.143217 sec
 * Transmission dominates
 * Change dial-up to DSL (1 mbps link)
 * Transmission changes
 * R = 1 000 000
 * 8000/1000000 = 0.008000 sec
 * Total: 0.00836 sec (improvement by a factor of 20)


 * Change DSL to Ethernet (10 Mbps)
 * Decrease transmission by a factor of 10: 0.00800 sec
 * Total: 0.001160 sec


 * Packet sent to Toronto which is 3000 km away
 * Propagation delay changes
 * 3000 km /15 000 microsec = 0.15000 sec
 * Total: 0.016100 sec

Caravan Analogy

 * Ten-car caravan – toll booth <- 100 km -> toll booth
 * Cars ‘propagate’ at 100 km/hr
 * Toll booth takes 12 sec to service car (bit transmission time)
 * Car~bit; caravan ~ packet
 * How long until caravan is lined up before 2nd toll booth?
 * Time to ‘push’ entire caravan through toll booth onto highway
 * 12 * 10 = 120 sec
 * Time for last car to propagate from 1st to 2nd toll booth
 * 100 km/(100 km/hr) = 1 hour
 * Answer: 62 minutes


 * Suppose cars now ‘propagate’ at 1000 km/hr
 * Suppose toll booth now takes one min to service a car
 * Will cars arrive to 2nd booth before all cars serviced at 1st booth?
 * Yes. After 7 min, 1st car arrives at 2nd booth; while 3 cars still at 1st booth

Queuing Delay (revisited)

 * R: link bandwidth (bps)
 * L: packet length (bits)
 * a: average packet arrival rate
 * La/R ~0: average queuing delay small
 * La/R -> 1: average queuing delay large
 * La/R > 1: more ‘work’ arriving than can be serviced, average delay infinite

‘Real’ Internet Delays and Routes

 * program: provides delay measurement from source to router along end-end Internet path towards destination
 * For all i:
 * Sends three packets that will reach router i on path towards destination
 * Router i will return packets to sender
 * Sender times interval between transmission and reply

New information from January 15 lecture


 * Does traceroute record one trip or round trip?
 * Slide 9
 * Round trip latency
 * Does not tell you the reverse trip
 * Typically goes back the same way, but sometimes a different way


 * Store and forward vs cut-through routing
 * Store and forward
 * Packet comes into a buffer and queue
 * Cut-through
 * When you see header, can put it directly its output link and simultaneously outbound t
 * Complicated to implement, only works under assumption that output link is vacant at the time packet is coming in, and if input and output link are same speed
 * Difference in speeds is a problem
 * Choose store and forward because:
 * Simpler design; firewall and check packets; throughput difference
 * Simple core, complex edge

Example

 * Diagnoses network performance problems
 * Progressive probing of each router along the way
 * Format: who are you, where are you, how far away you are
 * At step 4: network service provider is bigpipeinc.com
 * Goes to clgrrtr1.canarie.ca then vncv1rtr1, then ubc campus and answer
 * Answer: packet generated at UofC takes about 13-14 ms (3 samples)
 * May be one-way or round-trip – see Friday lecture (this will be updated)
 * May be one-way or round-trip – see Friday lecture (this will be updated)


 * Sometimes don’t want to answer when probed so you get “***”
 * Also may mean no response (probe lost, router not replying)
 * canarie – network provider around Canada
 * About 50 ms, but calculated about 16 ms
 * Difference: rounding errors, speed of Internet, queuing delay, multiple transmission delays (every router needs to process packet)
 * Difference: rounding errors, speed of Internet, queuing delay, multiple transmission delays (every router needs to process packet)


 * 90 ms – goes through different states (leave Calgary -> Vancouver -> Seattle -> Salt Lake -> kans -> chic -> clev
 * Why Seattle?
 * Router told us to – follow the table
 * Peering Relationships: Canarie – anything bound to another country should go to a giga pop (Vancouver, Seattle is closest)
 * Peering Relationships: Canarie – anything bound to another country should go to a giga pop (Vancouver, Seattle is closest)


 * Peering relationship to geant
 * 160ms
 * Toronto: 50 ms, canarie.geant: 140 ms
 * Difference: the ocean (router on one side, router on the other, underneath is transatlantic cable)
 * Difference: the ocean (router on one side, router on the other, underneath is transatlantic cable)


 * 20 ms, North America – Seattle area
 * 20 ms, North America – Seattle area

Java Applet Example: Queuing and Loss

 * Feeding in more quickly than sending – queue build-up (things get slower in terms of queuing delay)
 * Happens about 3% of time on Internet
 * Dropping packets and retransmitting them is usually more efficient and get them retransmitted, than to save everything
 * Depending on implementation, fixed sized buffers (regular) vs variable for different sized packets
 * Not always FCFS – most routers work using ‘drop-tail’ policy (drop newly arrived packet)
 * Can have priorities, different queues, move faster, etc.

Throughput Diagram
http://i.imgur.com/9fIjsuy.png


 * Throughput: rate (bits/time unit) at which bits transferred between sender/receiver
 * Instantaneous: rate at given point in time
 * Average: rate over longer period of time


 * Pipe has different capacity
 * Throughput: whichever is slowest/weakest link


 * Server sends bits (fluid) into pipe -> pipe that can carry fluid at rate Rs bits/sec -> pipe that can carry fluid at rate Rc bits/sec -> computer
 * Rs < Rc: What is average end-end throughput?
 * Server -> Rs bits/sec -> Rc bits/sec -> computer


 * Rs > Rc: What is average end-end throughput?
 * Server -> Rs bits/sec -> Rc bits/sec -> computer


 * Bottleneck link: link on end-end path that constrains end-end throughput
 * Cannot go faster than bottleneck link – the smaller pipe


 * Internet scenario
 * Per-connection end-end throughput: min(Rc, Rs, R/10)
 * In practice: Rc or Rs is often bottleneck
 * Large pipes for feeding (big websites), ISP has capacity Rc
 * Middle of network: big pipes from Tier 1 network providers
 * 10 connections (fairly) share backbone bottleneck link R bits/sec

Back to Navigation

Protocol “layers”

 * Networks are complex, with many ‘pieces’:
 * Hosts, routers, links of various media, applications, protocols, hardware, software


 * Each have function, then compose them
 * Looked at a 5-layer model
 * Is there any hope of organizing structure of network? Or at least our discussion of networks?

Example: Organization of Air Travel

 * Airplane routing, a series of steps:
 * ticket (purchase)
 * -> baggage (check)
 * -> gates (load)
 * -> runway (takeoff)
 * -> airplane routing
 * airplane routing
 * -> runway (landing)
 * -> gates (unload)
 * -> baggage (claim)
 * -> ticket (complain)


 * Layering of airline functionality:


 * Layers: each layer implements a service
 * Via its own internal-layer actions
 * Relying on services provided by layer below

Why Layering?

 * Dealing with complex systems:
 * Explicit structure allows identification, relationship of complex system’s pieces
 * Layered reference model for discussion
 * Modularization eases maintenance, updating of system
 * Change of implementation of layer’s service transparent to rest of system
 * E.g. change in gate procedure doesn’t affect rest of system


 * Layering considered harmful?

Internet Protocol Stack

 * Recall previous notes
 * Conceptually defines different pieces/steps/modules are, to support communication across network from HOST A to HOST B
 * Application: supporting network applications
 * Messages, usually a file
 * Example: FTP, SMTP, HTTP


 * Transport: process-process data transfer
 * Segments, piece of a file
 * Example: TCP, UDP


 * Network: routing of datagrams from source to destination
 * Packets
 * Example: IP, routing protocols


 * Data link: data transfer between neighboring network elements
 * Frames
 * Example: Ethernet, 802.11 (Wi-Fi), PPP


 * Physical: bits ‘on the wire’
 * Intermediate devices in backbone: router
 * Partial protocol stack: Network layer –> Data link –> Physical
 * Reads in bits, framing, packet checking and look at address in packet and decide where it goes; does not look at data

ISO/OSI Reference Model

 * International Standards Organization
 * Open Systems Interconnect (OSI)
 * How to make different systems talk to each other
 * General design to accommodate wide variety of devices


 * Presentation : allow applications to interpret meaning of data
 * Put encryption, compression, switching data formats from IBM to ASCII, data representation stuff
 * Internet doesn’t care
 * Example: Encryption, compression, machine-specific conventions


 * Session : synchronization, checkpointing, recovery of data exchange
 * Manages robustness and reliability of a conversation
 * Internet doesn’t have this; no protection, things break, etc.


 * Internet stack ‘missing’ these layers
 * These services, if needed, must be implemented in application


 * Application -> presentation -> session -> transport -> network -> datalink -> physical
 * Clever tricks
 * Bottom to top: pigs do not trust smart purple alligators; please do not touch soft pink appendages

Encapsulation Diagram
http://i.imgur.com/EkMKbax.png


 * Describes how a message on application layer, gets wrapped in an envelope in other layers, delivered across network
 * Message passed down to transport layer, gets segment (transport layer header added regarding piece of data)
 * Transport -> network layer through API, adds control information such as a header with IP address
 * -> network interface card link (own preface that gives MAC layer address)
 * -> physical across network


 * As you go down the protocol stack encapsulation occurs by doing headers; as you go up you validate content, strip headers
 * Talking horizontally: protocol
 * Talking vertically: interface, API

Back to Navigation

Assignment 1 Demo

 * Write a web proxy – decide on size to determine whether to give to user or not
 * Web
 * Client -> Server (GET) <- (RESPONSE)


 * Building something in the middle: proxy
 * Send requests to proxy, forwards to server, server responds back to proxy and proxy will respond to client
 * Odd-number: don’t want to see, even: want to see it


 * In C++:
 * Output:
 * Output:


 * Firefox: Tools > Options > Advanced > Network > Settings
 * Explicitly add proxy: 136.159.5.20 (IP address of proxy), port: 1234
 * Browser talks via proxy now


 * Support example pages; if you can do more then show them in demo
 * HTTP, not HTTPS
 * If you can do more, impress them
 * Demo: redirect (302)
 * Proxy got a request, brought back, but the page was illegal so proxy sends a 302 redirect to client; get an error message page from server


 * Support HTTP 1.1 (hope)

 Chapter 2: Application Layer


 * Notes adapted from slides created by JFK/KWR and lectures held by Dr. Carey Williamson
 * All material copyright 1996-2012 © J.F Kurose and K.W. Ross, All Rights Reserved

Section 2.1: Principles of Network Applications

 * Some network apps
 * Big three:
 * FTP, e-mail, remote login
 * Web, text messaging, multi-user network games, streaming stored video (Youtube, Hulu, Netflix), voice over IP (e.g. Skype), real-time video conferencing, social networking, search…

Creating a Network App

 * Write programs that:
 * Run on (different) end systems
 * Communicate over network
 * Obey vertical API of how messages get handed down in OS kernel for transmission across network
 * E.g. web server software communicates with browser software


 * No need to write software for network-core devices
 * Network-core devices do not run user applications
 * Applications on end systems allows for rapid app


 * Make sure messages get passed down the right API
 * End systems have full stack, communicate in illusion of horizontal communication
 * Web browser talks to web server, illusion talks horizontally without magic underneath; in reality there’s the passing though


 * Application architectures
 * Possible structure of applications:
 * Client-server
 * Peer-to-peer (P2P)

Client-Server Architecture

 * Server:
 * Always-on host
 * Permanent IP address
 * Data centers for scaling


 * Clients:
 * Communicate with server
 * May be intermittently connected
 * May have dynamic IP address


 * Server is special, and client is cheap and ubiquitous
 * File server, web server, video server, name server, file server
 * Put extra investments and resources that have high storage capacity, server gets permanent IP address, always on
 * Clients: from anywhere, clients are plentiful and cheap; they come and go

P2P Architecture

 * No always-on server
 * Arbitrary end systems directly communicate
 * Peers request service from other peers, provide service in return to other peers
 * Self scalability: new peers bring new service capacity, as well as new service demands
 * When you join a P2P network, you’re requesting stuff from other people; but you actuall share stuff with that network
 * Content, storage you share


 * Peers are intermittently connected and change IP addresses
 * End systems can talk to other end systems and negotiate sharing of content
 * User-generated content, P2P sharing, copyright, etc.


 * Everyone is equal, can share/download content, play symmetrical role of being a provider to some others and being a consumer from others – make social good better for everybody

Processes Communicating

 * Process : program running within a host
 * Within same host, two process communicate using inter-process communication (defined by OS)
 * Processes in different hosts communicate by exchanging messages


 * Client process: process that initiates communications
 * Server process: process that waits to be contacted
 * Aside: applications with P2P architectures have client processes and server
 * Built using socket programming API
 * Way to send data from on process to another


 * Socket: magic door – stick data in socket and magically whisked away by data fairies from other end

Sockets

 * Process sends/receivers messages to/from its socket
 * Socket analogous to door
 * Sending process shoves message out the door
 * Sending process relies on transport infrastructure on other side of door to deliver message to socket at receiving process


 * Socket API – programmer invokes socket-based communication to invoke data in/out of kernel and network interface

Class Demo

 * wordlengthserver code and wordlengthclient code
 * Give it a text string, and it tells you how many characters there are
 * Server using TCP, sitting in a passive loop waiting for clients to contact it
 * Compile with  on server
 * Compile with  for client


 * One screen with server, another with client
 * Every time talk to server, it spawns a new child process to communicate with the client
 * “CAT” is 3 letters; server sends the answer 3 and client receives the answer
 * When server sends 3, sends an ASCII string with the ‘3’ character


 * Main listener in server; forks a new child process when communicating with client

Addressing Processes

 * To receive messages, process must have identifier
 * Host device has unique 32-bit IP address
 * Q: Does IP address of host on which process runs suffice for identifying the process?
 * A: No, many processes can be running on same host


 * Identifier includes both IP address and port numbers associated with process host
 * Example port numbers:
 * HTTP server: 80
 * Mail server: 25


 * To send HTTP message to gaia.cs.umass.edu web server:
 * IP address: 128.119.245.12
 * Port number: 08

App-layer Protocol Defines

 * Variety of commands that you can send back and forth
 * Types of messages exchanged
 * E.g. request, response


 * Message syntax
 * What fields in messages and how fields are delineated
 * Where does URL go, what commands go, key-value pairs


 * Message semantics
 * Meaning of information in fields
 * Example: GET


 * Rules for when and how processes send and respond to messages
 * Who talks first, what to do when message comes in and how to handle wacky behavior


 * Open protocols
 * Defined in RFCs
 * Allows for interoperability
 * Everyone knows how server and client should talk – public protocol
 * E.g. HTTP, SMTP


 * Proprietary protocols
 * Don’t want to tell anyone how it works, internal secret protocol used
 * E.g. Skype

What Transport Services Does an App Need?

 * Data integrity
 * Some apps (e.g. file transfer, web transactions) require 100% reliable data transfer
 * Other apps (e.g. audio) can tolerate some loss


 * Reliable data exchange required as client wants exact copy of web page that server has
 * Timing
 * Some apps (e.g. Internet telephony, interactive games) require low delay to be ‘effective’
 * Some applications need fast response, some are elastic (depends on Internet speed)
 * Elastic example: a file
 * Stock exchange need to be updated – hard to do with TCP


 * Throughput
 * Some apps (e.g. multimedia) require minimum amount of throughput to be ‘effective’
 * Other apps (‘elastic apps’) make use of whatever throughput they get
 * How much data does app need to pump
 * Example: Youtube, with video and a certain video rate – needs to be delivered consistently across the network. If network unable to sustain throughput, you might see pauses or glitches


 * Security
 * On network – encrypted form so no one can steal it

Transport Service Requirements: Common Apps

 * File transfer: reliable, want perfect data; delay-tolerant
 * Video: want guaranteed throughput (live video) and low latency hopefully (screen is actually what is happening)
 * Stored video (Youtube): throughput, tolerate more latency – pause, rewind


 * Gaming: low bandwidth, low latency
 * FPS: want shot to hit person, don’t want latency

Internet Transport Protocols Services
TCP service : UDP service :
 * Layer 4 – what transport layer protocol to invoke?
 * Reliable, TCP vs unreliable, UDP
 * Gets all of your data there eventually (slow)
 * Reliable transport between sending and receiving process
 * Flow control: sender won’t overwhelm receiver
 * Congestion control: throttle sender when network overloaded
 * Does not provide: timing, minimum throughput guarantee, security
 * Connection-oriented: setup required between client and server processes
 * Gets most of your data there quickly (fast)
 * Minimal mechanism, generates data
 * Unreliable data transfer between sending and receiving process
 * Does not provide: reliability, flow control, congestion control, timing, throughput, guarantee, security, error-checking, connection setup

Securing TCP

 * TCP & UDP
 * No encryption
 * Cleartext passwds sent into socket traverse Internet in cleartext


 * SSL
 * Provides encrypted TCP connection
 * Data integrity
 * End-point authentication


 * SSL is at app layer
 * Apps use SSL libraries, which ‘talk’ to TCP


 * SSL socket API
 * cleartext passwds sent into socket traverse Internet encrypted


 * Internet protocol stack – no security unless you build it
 * SSL allows encryption near top of protocol stack – API for program to do encryption and have data handled by lower level of stack

Back to Navigation

= Week 3 =

January 20: HTTP over TCP

 * Recall previous notes
 * Example: page.html with two images (.jpg)

Comparison of Approaches Diagram
http://i.imgur.com/2CAbRn6.png Bigger Image

Summary of Web and HTTP

 * The major application on the Internet
 * Majority of traffic is HTTP (or HTTP-related)


 * Client/server model:
 * Clients make requests, servers respond to them
 * Done mostly in ASCII text (helps debugging)


 * Various headers and commands
 * Original version built by physicist had 1.0 paradigm – works but it’s slow and clunky

Section 2.2: Web and HTTP

 * Implementation in early 90s, idea about 50 years ago
 * Host stores object, path name contains files
 * Web page consists of objects
 * Object can be HTML file, JPEF image, Java applet, audio file…


 * Web page consists of base HTML-file which includes several referenced objects
 * Each object is addressable by a URL, e.g.
 * [www.someschool.edu]/someDept/pic.gif
 * [host name] path name

HTTP Overview

 * HTTP: hypertext transfer protocol
 * Web’s application layer protocol
 * Client/server model
 * Client : browser that requests, receivers, (using HTTP protocol) and ‘displays’ Web objects
 * Server : Web server sends (using HTTP protocol) objects in response to requests


 * Uses TCP:
 * Client initiated TCP connection (creates socket) to server, port 80
 * Server accepts TCP connection from client
 * HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server)
 * TCP connection closed


 * HTTP is ‘stateless’
 * Server maintains no information about past client requests


 * Protocols that maintain ‘state’ are complex
 * Past history (state) must be maintained
 * If server/client crashes, their views of ‘state’ may be inconsistent, must be reconciled

HTTP Connections

 * Non-persistent HTTP
 * At most one object sent over TCP connection
 * Connection then closed
 * Downloading multiple objects required multiple connections


 * Persistent HTTP
 * Multiple objects can be sent over single TCP connection between client, server

Non-persistent HTTP

 * Suppose user enters URL:  (contains text, references to 10 jpeg images)
 * 1a) HTTP client initiates TCP connection to HTTP server (process) at  on port 80
 * 1b) HTTP server at host  waiting for TCP connection at port 80. ‘Accepts’ connection, notifying client
 * 2) HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object
 * 3) HTTP server receives request message, forms response message containing requested object, and sends message into its socket
 * 4) HTTP server closes TCP connection
 * 5) HTTP client receives response message containing HTML file, displays HTML. Parsing HTML file, finds 10 referenced JPEG objects
 * 6) Steps 1-5 repeated for each of 10 JPEG objects


 * Response time
 * RTT: time for a small packet to travel from client to server and back
 * HTTP response time:
 * One RTT to initiate TCP connection
 * One RTT for HTTP request and first few bytes of HTTP response to return
 * File transmission time (time from server to send file to client)
 * Non-persistent HTTP response time = 2RTT + file transmission time

Persistent HTTP

 * Non-persistent HTTP issues
 * Requires 2 RTTs per object
 * OS overhead for each TCP connection
 * Browsers often open parallel TCP connections to fetch referenced objects


 * Persistent HTTP
 * Server leaves connection open after sending response
 * Subsequent HTTP messages between same client/server sent over open connection
 * Client sends requests as soon as it encounters a referenced object
 * As little as one RTT for all the referenced objects

HTTP Request Message

 * Two types of HTTP messages: request, response
 * HTTP request message: ASCII (human-readable format)

GET /index.html HTTP/1.1\r\n Host: www-net.cs.umass.edu\r\n User-Agent: Firefox/3.6.10\r\n Accept: text/html,application/xhtml+xml\r\n Accept-Language: en-us,en;q=0.5\r\n Accept-Encoding: gzip,deflate\r\n Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n Keep-Alive: 115\r\n Connection: keep-alive\r\n \r\n


 * : request line
 * : carriage return character, line-feed character
 * : header lines
 * : carriage return, line-feed at start of line indicates end of header lines
 * Blank line after request delineates header and data of subsequent responses

Uploading Form Input

 * method
 * Web page often includes form input
 * Input is uploaded to server in entity body


 * method
 * Uses  method (retrieves web pages)
 * Input is uploaded in URL field of request line

HTTP Response Message
HTTP/1.1 200 OK\r\n Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n Server: Apache/2.0.52 (CentOS)\r\n Last-Modified: Tue, 30 Oct 2007 17:00:02 GMT\r\n ETag: "17dc6-a5c-bf716880"\r\n Accept-Ranges: bytes\r\n Content-Length: 2652\r\n Keep-Alive: timeout=10, max=100\r\n Connection: Keep-Alive\r\n Content-Type: text/html; charset=ISO-8859-1\r\n \r\n data data data data data ...


 * : status line (protocol status code, status phrase)
 * : header lines
 * : data, e.g. Requested HTML file

HTTP Response Status Codes

 * Status code appears in first line in server-to-client response message
 * Some sample codes:
 * Request succeeded, requested object later in this message
 * Requested object moved, new location specified later in this message
 * Request message not understood by server
 * Requested document not found on this server
 * Request message not understood by server
 * Requested document not found on this server
 * Requested document not found on this server
 * Requested document not found on this server

Trying HTTP (Client Side)
(1) Telnet to your favorite Web server:
 * Opens TCP connection to port 80
 * (Default HTTP server port) at cis.poly.edu
 * Anything typed in sent to port 80 at cis.poly.edu
 * Anything typed in sent to port 80 at cis.poly.edu

(2) Type in a GET HTTP request:
 * By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to HTTP server
 * By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to HTTP server
 * By typing this in (hit carriage return twice), you send this minimal (but complete) GET request to HTTP server

(3) Look at response message sent by HTTP server


 * When you type up something random, you will get a BAD REQUEST (did not talk HTTP language)
 * Sends back content
 * Sends back content


 * Metadata
 * Metadata


 * In HTTP/1.1 host header is mandatory
 * Pauses for 5 seconds because of timeout to retrieve multiple objects on same connection
 * Doesn’t respond because no extra blank line after
 * Pauses for 5 seconds because of timeout to retrieve multiple objects on same connection
 * Doesn’t respond because no extra blank line after
 * Doesn’t respond because no extra blank line after


 * Five seconds before interaction ends (can do GET request)
 * 404 Not Found
 * 404 Not Found


 * 403 Forbidden: exists, but no access permission
 * 403 Forbidden: exists, but no access permission


 * Public webserver www.cpsc.ucalgary.ca but redirects to internal server with different name and server actually hosting content
 * Give bytes from location 250 – 300
 * 206 Partial Content: successful, returns something but not entire object, just part of it
 * Give bytes from location 250 – 300
 * 206 Partial Content: successful, returns something but not entire object, just part of it
 * 206 Partial Content: successful, returns something but not entire object, just part of it

User-Server State: Cookies

 * Many Web sites use cookies
 * Four components:
 * (1) Cookie header line of HTTP response message
 * (2) Cookie header line in next HTTP request message
 * (3) Cookie file kept on user’s host, managed by user’s browser
 * (4) Back-end database at Web site


 * Example:
 * Susan always accesses Internet from PC
 * Visits specific e-commerce site for first time
 * When initial HTTP requests arrives at site, site creates: unique ID and entry in backend database for ID


 * Header is a set-cookie header
 * Amazon, unique identifier
 * Browser sending cookie header – know what you bought, send targeted ads

http://i.imgur.com/bzwGF8q.png


 * Messy when companies send cookie database to another organization
 * What cookies can be used for
 * Authorization
 * Shopping carts
 * Recommendations
 * User session state (Web e-mail)


 * How to keep ‘state’
 * Protocol endpoints: maintain state at sender/receiver over multiple transactions
 * Cookies: http messages carry state


 * Cookies and privacy
 * Cookies permit sites to learn a lot about you
 * You may supply name and e-mail to sites

Web Caches (Proxy Server)

 * Goal: satisfy client request without involving origin server
 * User sets browser: Web accesses via cache
 * Browser sends all HTTP requests to cache
 * Object in cache: cache returns object
 * Else cache requests object from origin server, then returns object to client


 * Browser has a cache for images, etc.
 * Important for efficiency of web


 * Cache acts as both client and server
 * Server for original requesting client
 * Client to origin server


 * Typically cache is installed by ISP (university, company, residential ISP)
 * Web caching:
 * Reduces response time for client request
 * Reduces traffic on an institution’s access link
 * Internet dense with caches: enables ‘poor’ content providers to effectively deliver content (so too does P2P file sharing)

Caching Example

 * Assumptions
 * Average object size: 100K bits
 * Average request rate from browsers to origin servers: 15/sec
 * Average data rate to browsers: 1.50 Mbps
 * RTT from institutional router to any origin server: 2 sec
 * Access link rate: 1.54 Mbps


 * Consequences
 * LAN utilization: 15%
 * Access link utilization = 99% (problem)
 * Total delay = Internet delay + access delay + LAN delay = 2 sec + minutes + usecs


 * Bottleneck link
 * Use a fatter access link
 * Access link rate: 154 Mbps
 * Access link utilization = 0.99%
 * Total delay = Internet delay + access delay + LAN delay = 2 sec + msecs + usecs
 * Cost: increased access link speed (not cheap!)


 * Install local cache
 * Access link utilization = ?
 * Total delay = ?
 * Cost: web cache (cheap!)


 * Calculating access link utilization, delay with cache:
 * Suppose cache hit rate is 0.4
 * 40% requests satisfied at cache, 60% requests satisfied at origin
 * Access link utilization:
 * 60% of requests use access link
 * Data rate to browsers over access link = 0.6*1.50 Mbps = .9 Mbps
 * Utilization = 0.9/1.54 = .58
 * Total delay
 * = 0.6 * (delay from origin servers) + 0.4 * (delay when satisfied at cache)
 * = 0.6 (2.01) + 0.4 (~msecs)
 * = ~ 1.2 secs
 * Less than with 154 Mbps link (and cheaper too!)

Conditional GET

 * Goal: don’t send object if cache has up-to-date cached version
 * No object transmission delay
 * Lower link utilization


 * Cache: specify date of cached copy in HTTP request


 * Server: response contains no object if cached copy is up-to-date
 * if cached copy has been modified after
 * if cached copy has been modified after

Back to Navigation

Section 2.3: File Transfer Protocol (FTP)

 * Transfer file to/from remote host
 * Client/server model
 * Client: side that initiates transfer (either to/from remote)
 * Server: remote host


 * Text-based protocol
 * User interface session part: log in, navigate around directories and issue requests
 * Data transfer part: copy file from one machine to another
 * ftp: RFC 959
 * ftp server: port 21

FTP: Separate Control, Data Connections

 * FTP client contacts FTP server at port 21, using TCP
 * Client authorized over control connection
 * Client browses remote directory, sends commands over control connection
 * When server receives file transfer command, server opens 2nd TCP data connection (for file) to client
 * After transferring one file, server closes data connection
 * Server opens another TCP data connection to transfer another file
 * Control connection: ‘out of band’
 * FTP server maintains ‘state’: current directory, earlier authentication
 * FTP control and data part separately done

FTP Commands, Reponses

 * Sample commands
 * Sent as ASCII text over control channel
 * returns list of file in current directory
 * retrieves (gets) file
 * stores (puts) file onto remote host
 * retrieves (gets) file
 * stores (puts) file onto remote host


 * Sample return codes
 * Status code and phrase (as in HTTP)
 * 331 Username OK, password required
 * 125 data connection already open; transfer starting
 * 425 Can’t open data connection
 * 452 Error writing file


 * Login:
 * (1) username: anonymous; password: 
 * Can copy files to local directory
 * (2) username: ; password:
 * Displays actual directory
 * Displays actual directory


 * In browser:
 * Forces browser to go from http to ftp


 * Also:

Section 2.4: Electronic Mail

 * Three major components:
 * User agents
 * Mail servers
 * Simple mail transfer protocol (SMTP)


 * User agent
 * Aka ‘mail reader’
 * Composing, editing, reading mail messages
 * Outgoing, incoming messages stored on server
 * E.g. Outlook, Thunderbird, iPhone mail client


 * Mail servers
 * Mailbox contains incoming messages for user
 * Message queue of outgoing (to be sent) mail messages
 * SMTP protocol between mail servers to send e-mail messages
 * Client: sending mail server
 * ‘Server’: receiving mail server

SMTP [RFC 2821]

 * Uses TCP to reliably transfer email message from client to server, port 25
 * Direct transfer: sending server to receiving server
 * Three phases of transfer
 * Handshaking (greeting)
 * Transfer of messages
 * Closure


 * Command/response interaction (like HTTP, FTP)
 * Commands: ASCII text
 * Response: status code and phrase


 * Messages must be in 7-bit ASCII

Example: Alice Sends Message to Bob
(1) Alice uses UA to compose message ‘to’ (2) Alice uploads to SMTP server; her UA sends message to her mail server, and message placed in message queue (3) Client side of SMTP opens TCP connection with Bob’s mail server
 * SMTP has outbound message in message queue, try to find SMTP server (Bob’s)

(4) SMTP client sends Alice’s message over the TCP connection (5) Bob’s mail server places the message in Bob’s mailbox (6) Bob invokes his user agent to read message
 * User agent -> Alice’s mail server -> Bob’s mail server -> user agent

Example: SMTP Interaction
S: 220 hamburger.edu C: HELO crepes.fr S: 250  Hello crepes.fr, pleased to meet you C: MAIL FROM:  S: 250 alice@crepes.fr... Sender ok C: RCPT TO:  S: 250 bob@hamburger.edu ... 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


 * bulletproof’d their SMTP; must use proper mail exchange
 * Naive vulnerable protocol; spammers exploited vulnerabilities, driving e-mail from any place

SMTP

 * Can send e-mail without using e-mail client (reader)
 * See 220 reply from server
 * Enter  commands
 * Enter  commands
 * SMTP uses persistent connections
 * SMTP requires message (header & body) to be in 7-bit ASCII
 * SMTP server uses  to determine end of message
 * Comparison with HTTP:
 * HTTP: pull
 * SMTP: push
 * Both have ASCII command/response interaction, status codes
 * HTTP: each object encapsulated in its own response message
 * SMTP: multiple objects sent in multi-part message

Mail Message Format

 * SMTP: protocol for exchanging email messages
 * RFC 822: standard for text message format:
 * Header lines, such as:
 * To:
 * From:
 * Subject:
 * Different from SMTP MAIL FROM, RCPT TO: commands!


 * Blank line
 * Body: the “message”
 * ASCII characters only

Mail Access Protocols

 * User agent ---SMTP---> Sender’s mail server ---SMTP---> Receiver’s mail server ---Mail access protocol---> User agent
 * SMTP: delivery/storage to receiver’s server
 * Mail access protocol: retrieval from server
 * POP : Post Office Protocol [RFC 1939]
 * Authorization, download
 * Mail arrived at SMTP server
 * Using device, when you retrieve messages, the message is now on the device used to retrieve; message is no longer at the server
 * IMAP : Internet Mail Access Protocol [RFC 1730]
 * More features, including manipulation of stored messages on server
 * Remote manipulation of content; stays on server but remotely access and read from anywhere
 * HTTP: HyperText Transfer Protocol
 * Gmail, Hotmail, Yahoo! Mail, etc.

POP3 Protocol
S: +OK POP3 server ready C: user bob S: +OK C: pass hungry S: +OK user successfully logged on


 * Authorization phase
 * Client commands:
 * : declare username
 * : password
 * Server responses

C: list S: 1 498 S: 2 912 S:. C: retr 1 S: S:. C: dele 1 C: retr 2 S: S:. C: dele 2 C: quit S: +OK POP3 server signing off


 * Transaction phase, client
 * : list message numbers
 * : retrieve message by number
 * : delete

POP3 and IMAP

 * More about POP3
 * Previous example uses POP3 'download and delete' mode
 * Bob cannot re-read e-mail if he changes client
 * POP3 'download-and-keep': copies of messages on different clients
 * POP3 is stateless across sessions


 * IMAP
 * Keeps all messages in one place: at server
 * Allows user to organize messages in folders
 * Keeps user state across sessions:
 * Names of folders and mappings between message IDs and folder name

Back to Navigation

= Week 4 =

Domain Name System/Service (DNS)

 * Mapping from human readable text name (www….) to an actual IP address, so your computer knows where the website is on the Internet and can get there
 * For Internet hosts and routers, IP address (32 bit) used fo addressing datagrams, ‘name’ (e.g. www.yahoo.com) is used by humans


 * Human readable name (high level) => mapping => unique IP address (low level identity)
 * Client goes to DNS first before setting up a socket and GET from the Internet to retrieve data from Web server and get sent back
 * Tool for doing this mapping, from human name spaces into IP name spaces
 * Domain Name System :
 * Distributed database implemented in hierarchy of many name servers
 * Application-layer protocol: hosts, name servers communicate to resolve names (address/name translation)
 * Note: core Internet function implemented as application-layer protocol
 * Complexity at network’s edge


 * Transaction-oriented application-layer protocol
 * UDP-based (usually) because want low latency
 * Runs on Port 53

Services, Structures

 * DNS services
 * Hostname to IP address translation
 * Host aliasing: canonical, alias names
 * Mail server aliasing
 * Load distribution
 * Replicated Web servers: many IP addresses correspond to one name


 * Why not centralize DNS and make it a huge distributed database?
 * Issue of scale
 * Single point of failure
 * Traffic volume
 * Distant centralized database
 * Maintenance


 * If you centralize, massive amount of load by everyday people will be sent; single point of failure if someone were to attack DNS – doesn’t scale

A Distributed, Hierarchical Database

 * Root DNS Servers
 * -> com DNS servers
 * -> yahoo.com DNS servers
 * -> amazon.com DNS servers
 * -> org DNS servers
 * -> pbs.org DNS servers
 * -> edu DNS servers
 * -> poly.edu DNS servers
 * -> umass.edu DNS servers


 * Client wants IP for www.amazon.com, first 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

Root Name Servers

 * Contacted by local name server that cannot resolve name
 * Root name server:
 * Contacts authoritative name server if name mapping not known
 * Gets mapping
 * Returns mapping to local name server

[www].cpsc.ucalgary.(ca)
 * Replicated by number of sites
 * [most specific] to (least specific, top level of where it is)
 * Resolve from root level (right) and working the way down to get exact details


 * 13 root name ‘servers’ worldwide
 * (a) Verisign, Los Angeles, CA (5 other sites)
 * (b) USC=ISI Marina del Rey, CA
 * (c) Cogent, Herndon, VA (5 other sites)
 * (d) U Maryland College Park, MD
 * (e) NASA Mt. View, CA
 * (f) Internet Software C. Palo Alto, CA (and 48 other sites)
 * (g) US DoD Columbus, OH (5 other sites)
 * (h) ARL Aberdeen, MD
 * (i) Netnod, Stockholm (37 other sites)
 * (j) Verisign, Dulles VA (69 other sites)
 * (k) RIPE London (17 other sites)
 * (l) ICANN Los Angeles, CA (41 other sites)
 * (m) WIDE Tokyo (5 other sites)

TLD, Authoritative Servers

 * Generic top-level domain (TLD) servers
 * Generic categories for businesses/advertising
 * Responsible for com, org, net, edu, aero, jobs, museums, and all top-level country domains (e.g. uk, fr, ca, jp)
 * Network Solutions maintains servers for .com TLD
 * Educause for .edu TLD
 * Allow you to have .insurance, .xxx, etc.


 * Authoritative DNS servers
 * Local DNS server, that has real answers of ‘which computer and office does it reside in?’
 * Name of every computer, IP address, who owns that computer (map to location/person)
 * Organization’s own DNS server(s), providing authoritative hostname to IP mappings for organization’s named hosts
 * Can be maintained by organization or service provider


 * Non-authoritative server: anything that comes out of a cache

Local DNS Name Server

 * Does not strictly belong to hierarchy
 * Each ISP (residential ISP, company, university) has one
 * Also called “default name server”


 * When host makes DNS query, query is sent to its local DNS server
 * Has local cache of recent name-to-address translation pairs (but may be out of date!)
 * Acts as proxy, forwards query into hierarchy

DNS Name Resolution Example

 * Host at cis.poly.edu wants IP address for gaia.cs.umass.edu
 * IP address: 128.119.245.12 (can initiate TCP connection)
 * Answered by local DNS server (that already knew the answer; cached)
 * Non-authoritative answer because it came out of local cache rather than getting definitive answer from umass server
 * Non-authoritative answer because it came out of local cache rather than getting definitive answer from umass server


 * Iterated query
 * Each step, different servers consulted – “I don’t have the answer, but I know where you should look”
 * Originating DNS server does all heavy lifting
 * Most commonly used
 * Answer only ends up at local DNS server (because of space, query volume)

(1) Requesting host (cis.poly.edu) -> local DNS server (dns.poly.edu): “I don’t know, I will find it for you” (2) Local DNS server -> root DNS server: “you need to go over to .edu” (3) Root DNS server -> local DNS server (4) Local DNS server -> TLD DNA server: tells where .umass is (5) TLD DNS server -> local DNS server (6) Local DNS server -> authoritative DNS server (dns.cs.umass.edu -> gaia.cs.umass.edu): talks to .umass and returns IP address (7) Authoritative DNS server-> local DNS server


 * Recursive query
 * Puts burden of name resolution on contacted name server
 * Originating computer asks local DNS server, and it will find it for you – passes down to .umass
 * Make each server along the chain do lots of work for you
 * Answer generated at end, propagated through chain

(1) Requesting host (cis.poly.edu) -> local DNS server (dns.poly.edu) (2) Local DNS server -> root DNS server (3) Root DNS server -> TLD DNS server (4) TLD DNS server -> authoritative DNS server (dns.cs.umass.edu -> gaia.cs.umass.edu) (5) Authoritative DNS server -> TLD DNS server (6) TLD DNS server -> root DNS server (7) Root DNS server -> local DNS server (8) Local DNS server -> requesting host

Caching, Updating Records

 * Once (any) name server leans mapping, it caches mapping – lots of caching
 * Cache entries timeout (disappear) after some time (TTL)
 * Anytime you get an answer, it will be remembered (for a certain amount of time)
 * TLD servers typically cached in local name servers
 * Thus root name servers not often visited


 * Cached entries may be out of date, but cached to avoid the trouble of getting the answer (best effort name-to-address translation)
 * Mostly accurate, avoids unnecessary lookup
 * If name host changes IP address, may not be know Internet-wide until all TTLs expire


 * Fill DNS cache locally with good information, avoid necessary lookups if possible
 * Update/notify mechanisms proposed IETF standard (RFC 2136)

DNS Records

 * DNS: distributed db storing resource records (RR)
 * RR format:

DNS Protocol, Messages

 * Query and reply messages, both with same message format
 * Message header:
 * Identification
 * 2 bytes in size
 * 16 bit number for query, reply to query uses same number
 * Flags
 * 2 bytes in size
 * Query or reply
 * Recursion available and desired
 * Reply is authoritative
 * Number of questions (2 bytes), number of answer resource records (RRs) (2 bytes)
 * Number of authority RRs (2 bytes), number of additional RRs (2 bytes)
 * Questions
 * 4 bytes in size
 * Variable number of questions
 * Name, type fields for a query
 * Answers
 * 4 bytes in size
 * Variable number of RRs
 * RRs in response to query
 * Authority
 * 4 bytes in size
 * Variable number of RRs
 * Records for authoritative servers
 * Additional Information
 * 4 bytes in size
 * Variable number of RRs
 * Additional “helpful” info that may be used


 * Sequence numbers
 * Outbound query – sequence number incremented each time DNS query happens; match response with originating query and corresponds to the name
 * Typical response: A few 100 bytes
 * List cname, mx, etc. and info of who responded and which DNS server; if it was authoritative or non-authoritative

Example

 * First looks at root level, then ends up at highest level
 * Information from a cache
 * Actual machine name is
 * Information from a cache
 * Actual machine name is


 * , receive many answers
 * Load balancing – uses multiple servers
 * Numbers keep changing
 * Ordering changed, for load balancing (round robin)

Example

 * Domain Information Groper
 * Prints out resource records
 * qr – query response, rd – recursion denied
 * qr – query response, rd – recursion denied


 * Records kept for a few days at root level
 * Records kept for a few days at root level

Linuxconfig files
/etc/resolv.conf /etc/hosts /etc/protocols /etc/services


 * Files used to resolve names

Inserting Records into DNS

 * Example: new startup “Network Utopia”
 * Register name networkutopia.com at DNS registrar (e.g. NetworkSolutions)
 * Provide names, IP addresses of authoritative name server (primary and secondary)
 * Registrar inserts two RRs into the .com TLD server:


 * Create authoritative server type A record for www.networkutopia.com; type MX record for networkutopia.com

Attacking DNS

 * Distributed Denial-of-Service (DDoS) attacks
 * Bombard root servers with traffic
 * Not successful to date
 * Traffic filtering
 * Local DNS servers cache IPs of TLD servers, allowing root server bypass
 * There is so much caching, it’s hard to get a query to the root
 * Bombard TLD servers
 * Potentially more dangerous


 * Redirect attacks
 * Man-in-middle
 * Intercept queries
 * DNS poisoning
 * Send bogus replies to DNS server, which caches
 * Trick people into going to your DNS site
 * Software might put in DNS cache; name mapped to bogus IP


 * Exploit DNS for DDoS
 * Send queries with spoofed source address:target IP
 * Requires amplification


 * DNS sec is secure
 * DNS can be fragile

Back to Navigation

Pure P2P Architecture

 * No always-on server
 * Arbitrary end systems directly communicate
 * Peers are intermittently connected and change IP addresses
 * Instead of special server machines, we have ordinary peer machine
 * Any peer can be consumer, producer, provider, etc. and can talk to other peers


 * Arbitrary end hosts choosing to directly communicate with each other; may be transient, Wi-Fi, etc.


 * Examples:
 * File distribution (BitTorrent)
 * File sharing
 * Streaming (KanKan)
 * VoIP (Skype)

Peer-to-Peer Design

 * NW Apps
 * Client-server
 * HTTP, DNS
 * P2P
 * File Sharing
 * Get illegal copyrighted content from other people on the network
 * Hybrid
 * Need server-hardware stuff, but need lots of bandwidth from peers

P2P File Sharing Applications

 * Early ones: central design (Napster)
 * Central server keeps track of who had what content willing to share, and gave IP address to that person so you could get that content yourself
 * Catalogue, dictionary, a list of the content and who has it
 * Distributed is sending of file


 * Later ones: distributed design (eDonkey, KaZaa, Gnutella…)
 * Structured style (CAN, Chord)
 * Explicit location for every piece of content registered
 * CAN: content addressable network
 * Tells what file/movie you’re looking for based on that name of the object, they do hash of name and gives you unique identifier and tells you where exactly the content is stored in the P2P model
 * Unstructured style
 * Content can be anywhere and you have to search for it
 * Anybody can host any file anywhere in the system, must do explicit flood-based search to find out who has what you need
 * Sends out query of all participating nodes, find whoever has it, pursue content

In Class Example

 * Actual DVD copy of Lord of the Rings with a size of 430 mb
 * Puts up on server at home (upload speed 2 mb/s), anyone can download for free
 * Person 1: access speed 3 mb/s
 * ~30 minutes – only person who wants it, gets full speed on Internet link
 * Person 2, 3, 4 now wants it
 * Server has to split the time up somehow – 2 hours
 * 50 hours to download the movie if running client-server (Slow)


 * Split into 100 pieces, 100 mb each
 * Each person has a choice of 8 pieces
 * Person 1-4 gets 1/8 of the movie (4 minutes)
 * Person 3 picks a piece Person 4 has – piece 7
 * When they want a portion a peer has, they don’t involve the server – they do peer-to-peer transfer
 * When all pieces are sent out to peers, server can be shut down and the rest can happen
 * When someone finishes all the pieces, they can shut off their services or remain in the system to serve capacity


 * 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
 * dj: peer i download capacity
 * ui: peer i upload capacity


 * Client upload rate = u, F/u = 1 hour,  us = 10u,  dmin ≥ us
 * Client-server takes longer (linearly)
 * P2P asymptotically lower bound (logarithmic)

P2P File Distribution: BitTorrent

 * File divided into 256 kb chunks, peers in torrent send/receive file chunks
 * Example: Alice arrives…obtains list of peers from tracker…and begins exchanging file chunks with peers in torrent


 * Tracker : tracks peers participating in torrent
 * Keeps track of name and IP address


 * Torrent : group of peers exchanging chunks of a file
 * Peer joining torrent
 * Has no chunks, but will accumulate them over time from other peers
 * Registrars with tracker to get list of peers, connects to subset of peers (‘neighbors’)


 * While downloading, peer uploads chunks to other peers
 * Peer may change peers with whom it exchanges chunks
 * Churn : peers may come and go
 * Once a peer has entire file, it may (selfishly) leave or (altruistically) remain in torrent

BitTorrent: Requesting, Sending File Chunks

 * Requesting chunks
 * At any given time, different peers have different subsets of file chunks
 * Periodically, Alice asks each peer for list of chunks that they have
 * Alice requests missing chunks from peers, rarest first


 * Sending chunks: tit-for-tat
 * Alice sends chunks to those four peers currently sending her chunks at highest rate
 * Other peers are choked by Alice (do not receive chunks from her)
 * Re-evaluate top 4 every 10 seconds
 * Every 30 seconds: randomly selects another peer, starts sending chunks
 * ‘Optimistically unchoke’ this peer
 * Newly chosen peer may join top 4


 * Server is a seed which has every piece
 * Dynamic, unpredictable of what peer will provide
 * No security or protection on corrupted or malicious files
 * Tracker hosted on a site

BitTorrent: Tit-for-Tat
(1) Alice ‘optimistically unchokes’ Bob (2) Alice becomes one of Bob’s top-four providers; Bob reciprocates (3) Bob becomes one of Alice’s top-four providers


 * Tit for tat deals : mutual incentive for an exchange (I have something you want, you want something I have)
 * Pieces: Who has the piece you need; if you find someone that also needs your pieces - reciprocate and mutual incentive
 * Service (throughput): if someone gives you good/lousy service, you return the same


 * First Piece Problem
 * When Alice joins, she has no pieces; how to get started?
 * In BitTorrent, there is something called choking and unchoking
 * Tracker provided list of 20-30 peers for Alice, she will have an active exchange with about 5
 * 25 of them are choked; 5 are unchoked
 * Do dynamically over time (every so minutes); you will allow random trades with someone
 * Will see what pieces they have and what service they have; if the new person is better than the previous, they will shut the worse service and go to the better, new one
 * Random choking allows new people to participate in the system


 * Rarest First Piece Selection
 * Identify which piece is least prevalent (i.e. fewest copies) and try to make another copy
 * Find the piece that is least popular, and make another copy of it, in case someone leaves with the only piece
 * Tracker would notice this; whenever you download it, you report to the tracker (up-to-date view of who has what) and it calculates how many copies there are
 * Alice gets optimistically unchoked, now has copy of the least prevalent piece in system. Soon, everyone will want Alice’s piece
 * Bootstrapping : everyone will contact the new one because of the rare piece they have


 * Dynamic, adaptive protocol
 * Dynamic Bandwidth Probing
 * Bandwidth Throttling
 * Last Piece Problem
 * Start to lose parallelism because only one or two pieces needed; now down to 1-2 peers
 * Find someone who has the piece you need, who has optimistically unchoked you
 * “Harnesses bandwidth”


 * BitTorrent
 * If you have to get it sequentially then must wait for piece 1
 * Might get the next piece in time while you’re watching
 * Solution: prioritize the first bits so you can watch the beginning of it, ensure you get the next ones coming up
 * Small numbers -> large numbers
 * Example: Many people start to watch the movie (good for buffer latency)
 * Person 2 wants Person 1’s piece, Person 1 no incentive for reciprocation
 * Add some randomization so people can reciprocate
 * Also people altruistically give pieces (daisy chain of performance)
 * Stratification Approach : someone watches the movie first, and can give the extra pieces to another person and so forth

Back to Navigation

= Week 5 =

Definitions

 * Computer network: set of computers that are hooked together somehow so that they can communicate
 * Internet built using layered stack of communication protocols
 * Protocol: rules used for communication between two parties
 * PPP: modem to computer


 * HTTP: get hypertext from Internet


 * Download web page: HTTP
 * Then send data between two computers over the Internet: TCP

Network Packet Structure

 * Data link -> network -> transport -> payload
 * Packets sent (wrapper around payload)
 * TL: outer wrapper, packets come from web server to client
 * NL: IP packet of which computer it goes to
 * DL: Wi-fi header that says packet allows communication

Networking Basics

 * Why networks?
 * Information sharing
 * Share resources
 * Remote access
 * Economy of scale
 * Network effect (whole > sum of parts)


 * Internet 'Big Three'
 * Remote login
 * File transfer
 * Electronic mail


 * LAN: home network, campus network, Wi-Fi
 * MAN: area in city
 * WAN: country, planet (cybera, cellular networks, Internet)
 * Internetwork -> networks of networks
 * Internet is massive global internetwork


 * Move on links in packets
 * Paths have different speed limits and congestion rate


 * Access link by en edge
 * Low speed, low volume
 * End system devices, access links, LAN


 * Core
 * Many links to edges (like roads wit no traffic lights and 3 lanes)
 * Aggregation, switching, multiplexing, WAN


 * Telco networks
 * Phone network with twisted copper wire, minimal functionality
 * Edge devices simple, core complicated
 * Design: circuit-switching
 * Find routing path, establish state information in each of the switches using a specific line to know how is talking to who
 * End-to-end dedicated connection
 * Bits travel in same order on same path


 * The Internet
 * Transmission of data, variable bandwidth required by apps
 * Data packets have headers (information) that transmit to a different router that sends them on a path
 * Core simple, edge complicated
 * Design: packet-switching
 * NL protocol
 * Packets travel any path (can be delayed, lost, duplicated, re-ordered)
 * Service model: best effort
 * If packet fails, next packet goes on a different route (update information)
 * Usually yields shortest path

Multiplexing

 * Time Division Multiplexing
 * Static channel allocation
 * Divides fixed resource among N concurrent users
 * Done in time domain (turn-taking)
 * Give each user ALL the channel PART of the time
 * Efficient: N is fixed, N users are active
 * Inefficient: bursty, unpredictable traffic
 * Shared resource, divide into time slots (exclusively use during that time)
 * Ex. Classroom scheduling


 * Frequency Division Multiplexing
 * Static channel allocation
 * Divides fixed resource among N concurrent users
 * Done in frequency domain (Hertz)
 * Give each user PART of the channel ALL the time
 * Efficient: N is fixed, N users are active
 * Inefficient: bursty, unpredictable traffic
 * Fixed resource, divide to pieces (exclusively use it)
 * Ex. Radio/TV channels


 * Statistical Multiplexing
 * Flexible channel allocation
 * Share fixed resource among N concurrent users
 * Done dynamically on packet-by-packet basis
 * Give each user channel when they NEED it
 * Efficient: bursty, unpredictable traffic
 * Ex. Carsoncity streets, Internet (unsure of how many users there are, but it will try to forward packets)

Internet

 * Hosts = end systems
 * Live at edge


 * Communication links: get bits from one side to another
 * Packet switches: forwards packets
 * Routers and switches
 * Live at core


 * Internet
 * Network of networks


 * Internet standards
 * Request for Comments (RFC): public open-source document
 * IETF have meetings
 * Infrastructure that provides services to applications
 * Provides programming interface to apps
 * Infrastructure that allows you to build apps (connects to lower-layered protocol and you build it)

Network Edge

 * Hosts: clients and servers
 * Sends packets of data
 * Takes application messages, break into packets of length L bits, transmits to access network at transmission rate R


 * Access to network, physical media
 * Wired, wireless


 * Network core:
 * Interconnected routers
 * Networks of networks
 * Owned by big companies


 * Link types
 * Link layered protocol
 * Point to Point
 * Dedicated link between two nodes
 * No MAC protocol since no one else can use the link
 * Ex. Dial-up modem
 * Broadcast
 * Shared link between many nodes
 * Need MAC to regular access since you share with other people
 * Ex. Wi-Fi


 * DSL
 * Voice, data transmitted at different frequencies over dedicated line to central office
 * Data goes over DSL phone line -> Internet
 * Voice over DSL phone line -> telephone


 * Cable network
 * FDM: different channels transmit on different frequency bands


 * Ethernet
 * Computers and router -> ethernet switch; institutional mail, web servers -> ethernet switch, both -> institutional router


 * WAN
 * Shared wireless access network connects end system to router via base station aka 'access point'

Transmission Media

 * Guided
 * Physical
 * Solid media
 * Bit: between transmitter/receiver pairs
 * Physical link: what lies between transmitter and receiver


 * Examples
 * Twisted pair: signal in one end, out the other
 * Coaxial cable: bidirectional, higher rate, longer distance
 * Fiber optic cable: multiple GB over extremely long distance, point-to-point transmission


 * Unguided
 * Invisible, signals propagates freely
 * Transmit signals on physical layer, may propagate through air
 * Microwave, LAN, Wide-area, Satellite

Network Core

 * Mesh of interconnected routers
 * Network providers live
 * Router
 * Packet-switching:
 * Packets forwarded from one router to the next, across links on path


 * Store-and-forward packet-switching
 * L/R seconds to transmit (PUSH) L-bit packets into link R bps
 * Entire packet must arrive at router before it can be transmitted on next link
 * Wait for entire packet to arrive,store in device (buffer), when link on other side (Ethernet) is available, send packet in its entirety at the link rate
 * Needs outbound link to be free


 * Queuing delay, loss
 * If arrival rate exceeds transmission rate, packets will queue or dropped if buffer fills up
 * Drop tail - drop newly arrived packet
 * Nodal processing delay
 * Checks bit errors, determines output link
 * AL -> NL, processing time happens in host
 * Queuing delay
 * Time waiting at output link for transmission
 * Depends on congestion level of router, wait to go onto link
 * Large waiting line - FIFO queue
 * Transmission delay
 * How long it takes to push a packet out to the link
 * Propagation delay
 * Finite time of bit from sender to receiver
 * Throughput
 * Whichever is slowest/weakest link
 * Bottleneck link: link on end-end path that constrains end-end throughput
 * Cannot go faster than smallest pipe


 * Routers route and forwards
 * Routing: determines source to destination route taken by packets
 * Uses routing algorithms, done periodically
 * Looks up address in routing table (what header value goes to which output link)
 * Communicate with other routers, builds database, populates to routing table which may affect others
 * Forwarding: move packets from router's input to appropriate router output
 * Done for every packet, makes use of database


 * Packet switching vs circuit switching
 * Packet switching allows more users to use network

Internet Structure

 * Peering relationships between big network service providers
 * Peering links between different ISPs
 * Internet exchange points mandated by Government controlling packets
 * Point of Presence: router for moving traffic to other network providers as well as others to customers

Protocol Layers, Service Models

 * Layer structure allows identification, relationship of complex system's pieces
 * Modularization eases maintenance, updating of system

Internet Protocol Stack


 * Application
 * End-user services and network applications
 * HTTP, SMTP, DNS, FTP, NTP
 * Sends messages


 * Transport
 * End-to-end (process-process) data transfer
 * TCP, UDP
 * Sends segments, pieces of a file


 * Network: speaks language every computer understands
 * Routing of datagrams from source to destination
 * IPv4, IPv6,BGP, RIP, routing protocols
 * Addressing, routing
 * Sends packets


 * Data link: physical transmission
 * Channel access, framing, flow/error control, hop-by-hop basis
 * Data transfer between neighboring network elements
 * PPP, Ethernet, IEEE 802.11b
 * Wifi, etc. protocols how to communicate over a single link over the Internet
 * Sends frames


 * Physical
 * Transmission of bits
 * Digital sends over communication
 * Sends bits


 * Intermediate device in backbone: router
 * Partial stack: NL->DL->PL

International Standards Organization Reference Model


 * How to make different systems talk to each other
 * Presentation
 * Allows applications to interpret meaning of data
 * Encryption, compression, switching data formats from IBM to ASCII, machine-specific conventions
 * Internet doesn't care


 * Session
 * Synchronization, checkpointing, recovery of data exchange
 * Manages robustness and reliability of a conversation
 * AL -> presentation -> session -> TL -> NL -> DL -> PL


 * Encapsulation
 * Message -> TL (header added, control info, IP address) -> NL (MAC) -> PL
 * Go down: protocol stack encapsulates with headers; go up: validate content, strip headers
 * Talk horizontally: protocol, talk vertically: interface, API

Sockets

 * Interface between application and network
 * App creates socket, socket dictates style of communication, pass data to socket for network transmission, receive data


 * Sends/receives messages to/from socket
 * TCP
 * Reliable delivery, in-order, connection-oriented, directional, guarantee delivery


 * UDP
 * Unreliable delivery, no order, no connection (app indicates destination for packets), receive/send


 * Server
 * fd = socket(domain, type, protocol)
 * Choose port a socket connects to
 * status = bind(sockid, &addrport, size)
 * When connecting, OS assigns free port for outgoing connection and receiving end is informed of the port; server listens for incoming requests
 * listen(sock, queulen)
 * accept(sockid, &addrport, &addrlen) (establishes connection with TCP)
 * count = recv(sockid, &buf, len, flags) (data request from client)
 * count = send(sockid, &buf, len, flags) (data reply to client)
 * read
 * close (end of file notification)


 * Client
 * socket -> connect(sockid, &addrport, addrlen) -> write -> read -> close
 * Connect assigns random free port

Architectures
Client-Server
 * Server: special
 * Always-on host, permanent IP address
 * Data centers for scaling


 * Clients: come-and-go
 * Communicate with server, dynamic IP address
 * Intermittently connected

P2P
 * No always-on server
 * Arbitrary end systems directly communicate
 * Peers request and provide service to other peers
 * Self scalable: new peers bring new service capacity and demands


 * Peers intermittently connected, change IP
 * Negotiate sharing of content


 * Everyone is equal, play symmetrical role of provider and consumer
 * Process communicating
 * Process is program running within host
 * Client process: initiates communication
 * Server process: waits to be contacted
 * Built using socket API


 * App-layer Protocol
 * Types of messages exchanged back and forth
 * Message syntax: what fields in messages and how fields are delineated
 * Where URL goes, what commands go to
 * Message semantics: meaning of information in fields
 * GET
 * Rules for when/how processes send and respond to messages
 * Who talks first, what to do when message arrives, how to handle wacky behavior
 * Open protocols
 * Defined in RFCs, public protocol
 * Proprietary protocols
 * Don't want to tell anyone how it works, internal secret protocol used (Skype)

Transport Services for Apps

 * Data integrity
 * Reliable data transfer, like client wants exact copy of web page


 * Timing
 * Low delay can be effective (interactive games), fast responses may be needed
 * Elastic timing (file)


 * Throughput
 * How much data does app need to pump
 * Videos should sustain throughput, might see pauses or glitches


 * Security: on network, encrypted form so no one can steal it

Internet Transport Protocols

 * TCP
 * Gets all data there eventually (slow)
 * Reliable, flow control (sender won't overwhelm receiver), congestion control (throttle sender when network overloaded)
 * No timing, minimum throughput guarantee, security
 * Connection-oriented: setup required between client and server
 * Ex: E-mail remote terminal access, web, file transfer, streaming multimedia, internet telephony


 * UDP
 * Gets most data there quickly (fast)
 * Minimal mechanism, generates data
 * Unreliable
 * No reliability, flow control, congestion control, timing, throughput, guarantee, security, error-checking, connection setup
 * Ex: streaming multimedia, internet telephony


 * TCP and UDP: no encryption, cleartext passwords sent to socket
 * SSL: provides encrypted TCP connection, data integrity, end-point authentication
 * SSL is at app layer

HTTP

 * 1.0 (classic)
 * One HTTP request per TCP connection, serially
 * Vertical dimension - time
 * Round-trip interaction between client and server to retrieve object and close connection
 * Inefficient


 * Parallel
 * Concurrent TCP connection to make things faster
 * Spawn threads to get different elements
 * Each initiates TCP connection concurrently
 * Supported by most modern browsers
 * Works regardless of which server objects are hosted on


 * Persistent
 * Reuse same TCP connection for multiple HTTP transfers serially
 * Amortizes TCP overhead, maintains TCP state longer
 * Server keeps connection alive for short period of time in case there's more
 * When client stops asking (GET), server closes connection
 * Only works if objects on same server


 * HTTP/1.1 (pipelining)
 * Requests issued asynchronously on persistent connection
 * Requests are processes in proper order; clever packaging
 * Bundle HTTP requests; get base page, when parsing there are more elements
 * Issue GET for both elements back-to-back, perhaps in same TCP packet


 * Host stores object,pathname contains file
 * Hostname converted from name to 32-bit IP address (DNS lookup)


 * Client: browser that requests, receives (using HTTP protocol) and displays Web objects
 * Server: web server sends (using HTTP protocol) objects in response to requests
 * Use TCP
 * Client initiates to server, port 80
 * Server accepts TCP connection from client
 * HTTP messages exchanged between browser


 * HTTP 'stateless' - no information about past client requests
 * HTTP/1.0
 * Single request, single response, transaction-based interaction
 * Stateless, non-persistent (one object sent over TCPconnection)
 * Above TCP, verifies web page exists and connection state so reliable data transfer occurs
 * One RTT to initiate TCP connection; one for HTTP request; file transmission time (time from server to send file to client)
 * GET, POST, HEAD


 * HTTP/1.1
 * Request-response interaction
 * Persistent connection, avoids TCP connection negotiation and termination -multiple objects sent over single TCP connection
 * Pipelining
 * Passwords, caching, cookies
 * Faster, more efficient and complicated
 * Server leaves connection open, one RTT for all referenced objects
 * GET, POST, HEAD, PUT, DELETE
 * HOST header mandatory


 * Request types
 * GET: browser retrieves from server some file or resource
 * HEAD: get meta-data from server
 * POST: send data to server
 * Format: keyword, value
 * Finish with carriage return and line-feed


 * Status codes
 * 200 OK
 * 301 Moved Permanently
 * 400 Bad Request
 * 404 Not Found
 * 505 HTTP Version Not Supported


 * Cookies
 * Cookie header line of HTTP response message, in next HTTP request message; cookie file kept on user's host, managed by browser; back-end database at website
 * Header is set-cookie header
 * Used for - authorization, shopping carts, recommendations, user session state
 * Keep state with protocol endpoints, cookies


 * Web caches (proxy server)
 * Goal: satisfy client request without involving origin server
 * Web accesses via cache - important for efficiency
 * Browser caches images, installed by ISP
 * Proxy is both role of client and server
 * Reduces response time for client request, reduces traffic
 * GET: response from server contains no object if cached copy up-to-date
 * 304 Not Modified, 200 OK


 * Server in nutshell:
 * initialize; set up listening socket;
 * do { get request; process; send request; log request (opt); }
 * initialize: socket, bind, listen, while { accept }


 * Processing request
 * getsockname, gethostbyname, gettimeofday, read, serverParse

FTP

 * Transfer files to/from remote host
 * Client/server: client initiates transfer, server remote host
 * Client browses remote directory, sends commands over control connection
 * When server receives file transfer command, opens 2nd TCP data connection for file to client
 * After transferring one file, server closes data connection


 * Maintains state: current directory, earlier authentication
 * Control part
 * Single persistent TCP connection
 * Initiated by client
 * Session state


 * Data part
 * 0 or more non-persistent TCP connections
 * Initiated by server
 * One connection per file transfer

Electronic Mail

 * Three major components
 * User agents
 * Mail reader: compose, edit, read mail messages
 * Mail servers
 * Mailbox contains incoming messages for user
 * Queue of outgoing mail messages
 * SMTP
 * Between mail servers to send e-mail messages (client sends, server receives)
 * Three phases: handshake, transfer messages, closure
 * Can send without using e-mail client/reader
 * Use persistent connections
 * PUSHES vs PULLS from HTTP
 * HTTP: encapsulates object in its own response message
 * SMTP: multiple objects sent in multi-part message
 * POP
 * Authorization, download
 * Mail arrives at SMTP server, messages stored on device and not at server
 * Can't re-read e-mails if client changes
 * POP3 'downloads and keeps' and is stateless
 * IMAP
 * More features including manipulation of stored messages on server
 * Remote manipulation of content, stays on server but remotely access and read from anywhere
 * Keeps message at server, allows users to organize messages in folders
 * Keeps state - name of folders and mappings between message IDs and folder name

DNS

 * Map from readable text name to actual IP address (for Internet hosts and routers)
 * Client -> DNS before setting up socket and GET
 * AL: hosts, name servers communicate to resolve names
 * Hostname->IP translation
 * Host aliasing: canonical, alias names
 * Mail server aliasing
 * Load distribution: many IP addresses correspond to one name
 * Cannot centralize DNS: issue of scale, single point of failure, traffic volume, distant centralized database, maintenance
 * Root name servers
 * Contacted by local name server that cannot resolve name
 * Contact authoritative name server if name mapping not known, gets mapping, returns mapping to local name server


 * Website from left is most specific to least specific; resolve starting from right side
 * Generic top-level domain servers
 * For businesses/advertising
 * com, org, etc.


 * Authoritative DNS servers
 * Provides hostname to IP mappings for organization's named hosts


 * Non-authoritative
 * Anything that comes out of a cache


 * Local DNS name server
 * Doesn't strictly belong to hierarchy
 * Each ISP has one
 * When host makes DNS query, send to local DNS server (has local cache)


 * Iterated query
 * Different servers consulted, originating DNS server does heavy lifting
 * Most commonly used, answer only at local DNS server


 * Recursive query
 * Name resolution burdens contacted name server
 * Originating computer asks local DNS server, finds it for you and passes down - makes each server do lots of work for you, answer generated at end


 * Lots of caching; ttl (timeouts) but will be remembered for some amount of time
 * TLD servers cached in local name servers, thus root name servers not often visited


 * DNS Records, RR format: (name, value, type, ttl)
 * type=A
 * Name (hostname), value (IP) - mapping of given hostname to IP
 * Authoritative and definitive
 * type=NS
 * Name (domain), value (hostname)
 * Domain managed by name server
 * Parse domain, consult someone - entry tells you who name server is for that domain
 * type=CNAME
 * Name (alias, www.ibm.com -> servereast.backup1.ibm.com), value (canonical name)
 * Alias magic changes internal name without changing external
 * cname keeps track of different names and correct addresses
 * type=MX
 * Value (name of mailserver)
 * DNS entry where mail server is - tells SMTP to contact to transfer in/out of domain


 * DNS protocol, messages
 * Identification, flags, number of questions, number of answer resource records, number of authority RRs, number of additional RRs, questions, answers, authority, additional info

Calculation

 * Network bandwidth: data rate
 * 1000 bits (8 bits in 1 byte)
 * 1 kbps = 10^3 bps
 * 1 mbps = 10^6 bps
 * 1 Gbps = 10^9 bps

Hosts
 * Packet transmission delay - L-bit packet into transmission rate R
 * L (bits) / R (bits/sec)

Store-and-forward
 * End-end delay = 2(L/R)

Delay Calculation
 * Transmission delay: L packet length (bits), R link bandwidth (bps)
 * L/R
 * Filesize/datarate


 * Propagation delay: d length of physical link, s propagation speed
 * d/s
 * distance/speed

= Week 6 =

= Week 8 =

= Week 9 =

March 9: Midterm Review
= Week 10 =

= Week 11 =

= Week 12 =

= Week 13 =

= Week 14 =