34
Review Slides Theophilus Benson

Review Slides Theophilus Benson. How Does the Internet Work? Context: you are trying to visit facebook.com – What are the different protocols that are

Embed Size (px)

Citation preview

Review Slides

Theophilus Benson

How Does the Internet Work?

• Context: you are trying to visit facebook.com– What are the different protocols that are used?– How does this Class’s content fit in?

• Browser decides:– What version of HTTP to use..– And uses TCP

Anatomy of a Web Page• HTML content

• A number of additional resources– Images– Scripts– Frames

• Browser makes one HTTP request for each object– Course web page: 14 objects– My facebook page this morning: 100 objects

All of theseAre web-objects

Step-0: Open your browserWhat Version of HTTP

• Versions vary in terms of performance

• Cause of performance problems – For small objects:

• Latency matters (RTT dominates)

– For large objects:• Throughput matters

• Major causes of latency problems:– Opening a TCP connection– Actually sending the request and receiving response– And a third one: DNS lookup!

HTTP Timeline

Get index.html

Get img1

Get img2

Get img3

Response

Response

Response

Response

TCP Timeline

• HTTP1.0No keep-alive

• HTTP1.1• Keep-alive

Green lines are TCP-handshakeBlack lines: HTTP request

Blue Lines: HTTP responses

Browser RequestGET / HTTP/1.1 Host: localhost:8000 User-Agent: Mozilla/5.0 (Macinto ... Accept: text/xml,application/xm ... Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive

Step-1: Name Resolution

• Packets are sent using IP-addresses– You don’t know IP, you only know the URL.

• So need to figure out the ip-address for facebook.com– Domain Name Resolution.

• Converts name to IP-addresses

10

Basic Domain Name Resolution

• Every host knows a local DNS server– Sends all queries to the local DNS server

• If the local DNS can answer the query, then you’re done1. Local server is also the authoritative server for that name2. Local server has cached the record for that name

• Otherwise, go down the hierarchy and search for the authoritative name server– Every local DNS server knows the root servers– How is caching used by the resolver? What are the implications?– Iterative versus Recursive queries

11

Northeastern

Local Name Servers

• Each ISP/company has a local, default name server• Often configured via DHCP• Hosts begin DNS queries by contacting the local

name server• Frequently cache query results

Where is google.com?

12

Authoritative Name Servers

• Stores the nameIP mapping for a given host

Northeastern

Where is www.neu.edu?

Root edu neu

www.neu.edu

Authority for ‘neu.edu’

www.neu.edu = 155.33.17.68

Authority for ‘edu’

Step-2: Transport

– TCP?• Reliable, in-ordered• Congestion-control + Flow-control

– UDP?• Low over-head

• Website use TCP, some interesting questions:– How does connection start-up?– What is Flow-Control? (helps avoid receiver problems)– Congestion-control? (helps avoid network problems)

Establishing a Connection three –way handshake

• Three-way handshake– Two sides agree on respective initial sequence nums

• If no one is listening on port: server sends RST• If server is overloaded: ignore SYN• If no SYN-ACK: retry, timeout

Listen, Accept…

Accept returns

Connect

Step-2: Transport– TCP?

• Reliable, in-ordered• Congestion-control + Flow-control

– UDP?• Low over-head

• Website use TCP, some interesting questions:– How does connection start-up?– What is Flow-Control? (helps avoid receiver problems)– Congestion-control? (helps avoid network problems)– How to set buffers

Flow Control

• We should not send more data than the receiver can take.

• Receiver uses window header field to tell sender how much space it has

Step-2: Transport– TCP?

• Reliable, in-ordered• Congestion-control + Flow-control

– UDP?• Low over-head

• Website use TCP, some interesting questions:– How does connection start-up?– What is Flow-Control? (helps avoid receiver problems)– Congestion-control? (helps avoid network problems)– How to set buffers

Congestion Control Window

Time

cwnd

Timeout

SlowStart

AIMD

ssthresh

Timeout

SlowStart

SlowStart

AIMD

Init_ssthresh

Congestion-Control• TCP has two states:

– Slow Start (SS) – Congestion Avoidance (CA)

• A window size threshold governs the state transition– Window <= threshold (ssthresh): slow start– Window > threshold (ssthresh): congestion avoidance– Threshold magically defined

• States differ in how they respond to ACKs– Slow start: w = w + MSS– Congestion Avoidance: w = w + MSS2/w (1 MSS per RTT)

20

Duplicate ACK exampleeach segment contains 1460 bytes

Receiver sends ACKs for the last in-order accepted packet.

Seg1: seq-no=0

ACK_1: seq-no=1460

Seg2: seq-no=1460

Seg3: seq-no=2920

Seg4: seq-no=4380

ACK_5: seq-no=5840

Dropped Pkt

Dup-Ack

Dup-Ack

ACK_1: seq-no=1460

ACK_1: seq-no=1460

Seg5: seq-no=4380

ACK_1: seq-no=1460

Seg2: seq-no=1460Dup-Ack

Seg2 re-transmitted after 3-dup-acks

ACK_5 after re-transmission acknowledges all packets

21

Timeout (RTO) example

1. duplicate

2. duplicate

3. duplicate

Wait for ACK … if no ACK then packet is lost

How long to wait?**some function of RTT

TCP Response to Loss

Slow Start• Triggered by a Timeout• W=1• Ssthresh= W/2• Switch to (SS)

Fast Recovery• Triggered by 3 dup-acks• W = W/2• Ssthresh= W/2• Stay in (CA)

Step-3: IP Routing

• How to get Traffic from your browser to facebook’s (FB) server?– Determine network of FB’s IP.

• In my local-area-network? Or in a different network?• Use Netmask!!

– If in different network, route to it• Use IGP to route in an ISP

– IGP = Distance Vector (RIP), Link-State (OSPF)

• USE EGP to route between ISPs– EGP = BGP– Valley Free routing

Compare your IP address with destination IP address• Source IP: 128.35.7.2• You netmask is 128.35.7.*/24 so you network has: 128.35.7.0-128.35.7.255

Dest IP: 128.44.7.5Destination is not in your network range, so you need to use your gateway router.

Router BRouter C

G H G H

GateWay == First Router that I’m connected to.Gateway: responds to DHCP and gives you an IP-

address and netmask

IGP ProtocolsLink-State Distance Vector

Flood messages from one neighbors to other neighbors

Send forwarding table to neighbors

Each router has whole topology(Scaling issues)

Each router has local view of network(loop-issues)

E.g. OSPF E.g. RIP

BGP= Distance Vector+Path information

• Distance vector algorithm with extra information– For each route, store the complete path (ASs)– No extra computation, just extra storage (and traffic)

• Advantages– Can make policy choices based on set of ASs in path– Can easily avoid loops

• Challenges:– Convergence– Traffic engineering: Load Balancing– Scaling (route reflectors)– Security

Recall BGP

Tier 1 ISP Tier 1 ISP

Tier 2Regional

Tier 2Regional Tier 2Tier 2

Tier 1 ISP Tier 1 ISP

Tier 2Tier 2

Tier 3 (local)

Tier 3 (local)

$$ $$

$$

Default free,Has information on every prefix

Default: provider

$$$$

Tier 3 (local)

Tier 3 (local)

$$

Bad Policies can be costly

Recall BGP: Realistic Example

Tier 2Regional

Tier 2Regional

Tier 2Tier 2

Tier 1 ISP Tier 1 ISP

Tier 2Tier 2

Tier 3 (local)

Tier 3 (local)

$20

$$

$$

$$$$

Tier 3 (local)

Tier 3 (local)

$$

Tier 2Tier 2

Tier 2Tier 2

$10

“Best Route” is not The shortest route

BGP Policies• Two mechanisms

– Route export filters• Control what routes you send to neighbors

– Route import ranking• Controls which route you prefer of those you hear.

• The resulting paths must be Valley-free– Number links as(+1,0,-1) for provider, peer and

customer – In any valid path should only see sequence of+1 ,

followed by at most one 0, followed by sequence of -1

IGP+EGP: Two types of BGP sessions

eBGPiBGP

AT&T SprintAS23

192.0.2.1

128.112.0.0/16128.112.0.0/16Next Hop = 192.0.2.1 AS23

Forwarding Table

Forwarding Table

BGP (iBGP)

192.0.2.1128.112.0.0/16

destination next hop

10.10.10.10192.0.2.0/30

destination next hop

128.112.0.0/16

destination next hop

10.10.10.10

+

192.0.2.0/30 10.10.10.10

Step 3: Switching• How do you get packets to that first router?

– Layer 2 switching: each switch makes local decision

Router BRouter C

G H G H

What Limitations Does Ethernet Have?

• Switches use a very simple Forwarding policy– @ start-up: Flood the traffic on all interfaces – Traffic will go to all switches

• Learning == loop problems when there’s a cycle– Spanning tree used to eliminate loops

• Minimum Packet Size– 64Bytes (512 bits): To ensure that collisions are detected!– Bandwidth-Delay-Product (for a link)

• Maximum Ethernet LAN size– 2500 meters: Due to signal decay, any longer and packets would not be

delivered

Router Versus Switches

Router• Runs multiple switching

protocols: Ethernet, ATM– Switches between techs

• Runs routing protocols

• Runs DHCP

• Needs a common address across techs: IP address– E.g. Ethernet addresses make no

sense to ATM hosts

Switches• Runs one switching protocol

– Can only work with same tech

• Dictates how bits become signals

• Dictates how bits becomes a packet/frame

• Needs hardware addresses to identify hosts/switches

Step-4: Link Layer and Framing Traffic

• Frame= Act of putting bits on the link as a packet (frame)– Collision detection– Collision avoidance

G

Layers, Services, Protocols

Network

Link

Physical

Transport

Application

Service: move bits to other node across linkFunctions: Convert bits to singal

Service: move frames to other node across link.Functions: Framing, media access control, error checking

Service: move packets to any other node in the networkFunctions: Routing, addressing

Service: multiplexing applicationsFunctions: Connection establishment/termination, error control, flow control

Service: user-facing application.Functions: Application specific