Top Banner
Internet Programming
72

Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Dec 27, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet Programming

Page 2: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet Technology

Networking Basics

Internet Basics

Internet Protocol

TCP

Applications

Page 3: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Circuit Switching

Page 4: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet design:

Smarts at the edges& simple core

Page 5: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Packet Switching

Page 6: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Packet Switching

Page 7: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Key Ideas

Page 8: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Simple

Stateless Core

Page 9: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Unreliable

Packets may be dropped(e.g., to handle congestion)

Page 10: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Flexible

Packets may take any route

Page 11: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Simple

Unreliable

Flexible

Page 12: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Robust

End to end principle

en.wikipedia.org/wiki/End-to-end_principle

“End-to-End Arguments in System Design”,

Saltzer, J., Reed, D., and Clark, D.D.

Page 13: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Simple Core

all the core has to do is route packets

simple: using only local information

each router has a routing table

chooses the next hop by destination

like sending a letter...

Page 14: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Like sending a letter

Willem de Bruijn

De Boelelaan 1081

1081 HV Amsterdam

NetherlandsNational Postal Center

Amsterdam Post OfficeVrije Universiteit

My mailbox

Page 15: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Smart Edges

server: provider of a service client: consumer of a service

a web client a.k.a. browser (e.g. IE, Firefox) retrieving pages from a web server (e.g. Apache)

a mail client (e.g. Outlook) retrieving e-mail from a mail server (e.g. Exchange)

Page 16: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet Technology

Networking Basics

Internet Basics

Internet Protocol

TCP

Applications

Page 17: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Idea

"For each of these three terminals, I had three different sets of user commands. So if I was talking online with someone at S.D.C. and I wanted to talk to someone I knew at Berkeley or M.I.T. about this, I had to get up from the S.D.C. terminal, go over and log into the other terminal and get in touch with them. [...] I said, it's obvious what to do (But I don't want to do it): If you have these three terminals, there ought to be one terminal that goes anywhere you want to go where you have interactive computing. That idea is the ARPAnet."

—Robert W. Taylor, co-writer "The Computer as a Communications Device", in an interview with the New York Times, [2]

Page 18: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

History

1969: ARPANetPacket Switching: Robust

Page 19: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

History

1984: NFSNetNational USA University network with dial-up

(other TCP/IP networks within the military)

Page 20: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

History

2005: an Internet snapshot

Page 21: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Network of Networks

Commercial CarriersHome router + 2 computers

Community Networks

Community Wifi (e.g., mesh networks)

Page 22: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Peering: Internetworking

Interconnection of 2+ Autonomous Systems (ASs)Exchange routing information with BGP

Transit (for pay)Peer (tit for tat)

Incentive to peer directly with more networks: less transit

Public (AMS-IX) or Private

Explicit contracts

Page 23: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Multiple Levels

Tier 1 “A network that can reach every other network on the Internet without purchasing IP

transit or paying settlements." (only 8)

Tier 3 ~= non-multihomed end-user

Example: SAVVIS: Tier 2 with private backbone

Page 24: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Wireless Community Networks

Page 25: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Border Gateway Protocol (BGP)

Periodic route table exchanges

A.1 – B.1 – B.2 – C.1 – C.2 – D.1

B.1->A.1 : connect B, C(B), D(B,C)B.1 -> B.2 : connect A

Automatically updates local router's tablesMultihome automatic failover, etc.

ASN

Page 26: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.
Page 27: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Organization

Robust because decentralized?

DNS Root ServersIANA numbers

ICANN Root level TLDs

Standards: IETF (RFCs), W3C

Page 28: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet Technology

Networking Basics

Internet Basics

Internet Protocol

TCP

Applications

Page 29: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet Protocol (v4)

Basic end-to-end Connectivity

Page 30: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.
Page 31: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet addresses Internet Protocol (IP) Addresses

Every node has a unique numeric address

Form: 32-bit binary number New standard, IPv6, has 128 bits (1998)

Organizations are assigned groups of IP addresses for their computers

Page 32: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

130.37.192.19 (client)

130.37.20.20(server)

(www.cs.vu.nl)

Clients and servers

www.cs.vu.nl

www.cs.vu.nl = 130.37.20.20

nameserver

Page 33: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

What’s a protocol?

Hi

Hi

Got thetime?2:00

TCP connection requestTCP connectionresponse

Get http://www.cs.vu.nl/~herbertb

<file>

time

Page 34: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Network Technology

Topic of another class!

Page 35: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internetwork Technology: TCP/IP

Will discuss only what we need for now

SMTP, HTTP, DNS

UDP, TCPInternet Protocol (v4)

Page 36: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Packet Switching in Practice

Page 37: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Packet Switching and Protocols

Page 38: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

An IP packet

DATA

Page 39: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Missing

ConnectionsReliability

Packet Ordering

Congestion Control

Page 40: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet Technology

Networking Basics

Internet Basics

Internet Protocol

TCP

Applications

Page 41: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Transmission Control Protocol (TCP)

ReliabilityPacket Ordering

Connections

Congestion Control

Page 42: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Reliability

Resend packets that are lost underway

Page 43: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Reliability

ACK packets

Timeout

Retransmit

Page 44: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Ordered Data

Packets may travel at different speedReestablish order at arrival (buffer)

Page 45: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Connections

Ordered, reliable bytestream+

Reliable open and close

“Three way handshake”

Page 46: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet Technology

Networking Basics

Internet Basics

Internet Protocol

TCP

Applications

Page 47: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Domain Name System (DNS)

Lookup IP address127.0.0.1

By human readable namewww.google.com.(note the last dot!)

Page 48: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Domain Name System (DNS)

Hierarchical Distributed System

Hierarchical Names

Page 49: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Domain Name System (DNS)

Page 50: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Let us trace a connection

DNS: nslookup contacts the (distributed) Internet name service

nslookup www.few.vu.nl

IP: traceroute allows us to find the path tracert www.few.vu.nl

Page 51: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

nslookup

% nslookup www.few.vu.nlServer: 130.37.20.3

Address: 130.37.20.3#53

Non-authoritative answer:

www.few.vu.nl canonical name = soling.few.vu.nl.

Name: soling-public.few.vu.nl

Address: 130.37.20.20

Page 52: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Application Protocols

DNS!FTP: File transferNTP: Time SynchronizationTelnet: Terminal accessSSH: Secure terminal accessXMPP: MessagingSMTP: EmailHTTP: Web (Next lecture)

Page 53: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Email

Page 54: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Network

PushPush

Pull

smtp.few.vu.nl

mail.receiver.org

SMTPSMTP

IMAP,POP

IMAP,POP

HTTP

Page 55: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Simple Mail Transfer Protocol

Store and Forward network

Simple? Example ...

Page 56: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

S: 220 smtp.example.com ESMTP PostfixC: HELO relay.example.orgS: 250 Hello relay.example.org, I am glad to meet youC: MAIL FROM:<[email protected]>S: 250 OkC: RCPT TO:<[email protected]>S: 250 OkC: RCPT TO:<[email protected]>S: 250 OkC: DATAS: 354 End data with <CR><LF>.<CR><LF>C: From: "Bob Example" <[email protected]>C: To: Alice Example <[email protected]>C: Cc: [email protected]: Date: Tue, 15 Jan 2008 16:02:43 -0500C: Subject: Test messageC:C: Hello Alice.C: This is a test messageC: .S: 250 Ok: queued as 12345C: QUITS: 221 Bye{The server closes the connection}

Page 57: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Received: from mail.vu.nl (mail.vu.nl [130.37.129.161])

by tornado.few.vu.nl for <[email protected]>; Wed, 3 Dec 2008 10:59 +0100

Received: from DIENSTEX1.dienst.ad.vu.nl (mail.dienst.vu.nl [130.37.136.125])

by mail.vu.nl (8.12.11.20060308/8.12.11) for <[email protected]>; Wed, 3 Dec 2008 10:59:56 +0100

Email (1/2)

Page 58: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Email (2/2)MIME-Version: 1.0Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C9552D.E50A028F"Subject: Visum is binnenDate: Wed, 3 Dec 2008 10:59:56 +0100From: "Eek, D" <[email protected]>To: "Willem de Bruijn" <[email protected]>

This is a multi-part message in MIME format.

------_=_NextPart_001_01C9552D.E50A028FContent-Type: text/plain;

charset="us-ascii"Content-Transfer-Encoding: quoted-printable

Goedemorgen Willem,=20Wij hebben je paspoort met visum terug ontvangen van het visumbureau.

Page 59: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Reception

POP3: Post Office ProtocolFetch data from a directory: store at homeStateless

Aside from optional 'read items' hash

IMAP4: Internet Message Access Protocol`remote folders': store on serverStatefulConcurrent access

WebmailProprietary method on top of HTTPFrequently uses IMAP between webserver and mailserver

Page 60: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Multipurpose Internet Mail Extensions

Send more than 7bit ASCII text:Binary (images), Non-latin script

Identify encoding, e.g.,quoted-printable: =[HEX][HEX] for instance, =20 means space

Break up messages html+imgtext/html

Also used elsewhere (such as webservers)

Page 61: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Mime content encodings

=B7Hola, se=F1or!

is interpreted as

¡Hola, señor!.

Page 62: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Mime content-type=

text/plaintext/html

image/jpegvideo/mpeg2

...application/octet-stream

Page 63: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Mime special content-type=

message/rfc822multipart/alternativemultipart/form-data

...

many more. Official list atwww.iana.org/assignments/media-types/

Page 64: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

SMTP Security

From: spoofing

Man in the middle can sniff and change data

Open Relay

SPAM

Page 65: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

SMTP SecurityCounteraction difficult

Network Effect

AuthenticationPGP

ensure contents integrity (sig/enc)

DomainKeys Identified Mail (DKIM)Guard against spoofing, indirectlySender/Server RSA SIGPublic Key through sender domain DNSUsed by Yahoo! and Google.Does not guard the envelop

Page 66: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Your post advocates a

( ) technical ( ) legislative ( ) market-based ( ) vigilante

approach to fighting spam. Your idea will not work. Here is why it won't work. (One or more of the following may apply to your particular idea, and it may have other flaws which used to vary from state to state before a bad federal law was

passed.)

[...]

Fighting SPAM

Page 67: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

( ) Spammers can easily use it to harvest email addresses( ) Mailing lists and other legitimate email uses would be affected( ) No one will be able to find the guy or collect the money( ) It is defenseless against brute force attacks( ) It will stop spam for two weeks and then we'll be stuck with it( ) Users of email will not put up with it( ) Microsoft will not put up with it( ) The police will not put up with it( ) Requires too much cooperation from spammers( ) Requires immediate total cooperation from everybody at once( ) Many email users cannot afford to lose business or alienate potential employers( ) Spammers don't care about invalid addresses in their lists( ) Anyone could anonymously destroy anyone else's career or business

Specifically, your plan fails to account for

( ) Laws expressly prohibiting it( ) Lack of centrally controlling authority for email( ) Open relays in foreign countries( ) Ease of searching tiny alphanumeric address space of all email addresses( ) Asshats

Page 68: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet Technology Exam MaterialNetworking Basics

circuit vs. packet switchingend-to-end argumentclient/server programming

Internet Basicsnetwork of networkspeering

IPprotocol stack

TCPreliability, ordering, conn.

DNSEmail

push vs. pull, mime, authenticationbasic smtp

Page 69: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Internet Technology Practical

Trace a Route with tracert.exe

Lookup a domain name with nslookup.exe

Send me an email manually using putty

Don't forget: come up with a website plan for tomorrow!

Page 70: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Flow Control

Buffering: sliding window

Page 71: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Congestion Control

Scale sliding window sizeAutomatic, based on transport quality

Additive Increase, Multiplicative Decrease

Page 72: Internet Programming. Internet Technology Networking Basics Internet Basics Internet Protocol TCP Applications.

Bandwidth Delay Product

Maximal bandwidth of a TCP stream depends onphysical bandwidth, but also:

congestion control protocolroundtrip time