Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture Topics: 11/29 IP UDP TCP DNS. Homework 9 Write a simple web server –not as hard as it sounds Specification out tonight Skeleton code out by tomorrow.

Similar presentations


Presentation on theme: "Lecture Topics: 11/29 IP UDP TCP DNS. Homework 9 Write a simple web server –not as hard as it sounds Specification out tonight Skeleton code out by tomorrow."— Presentation transcript:

1 Lecture Topics: 11/29 IP UDP TCP DNS

2 Homework 9 Write a simple web server –not as hard as it sounds Specification out tonight Skeleton code out by tomorrow morning Base implementation (80%) –return a requested file –report a few errors –<100 lines of code

3 Simple Web Server HTTP/1.0 200 OK Date: Wed, 29 Nov 2000 20:14:10 GMT Server: Apache/1.1.1 Content-Length: 183 Content-Type: text/html Connection: close 410 Web Page 410 is my favorite class. GET /index.html HTTP/1.0 Web Client Request:: Web Server Reply:

4 Homework 9 Continued Additional features (25%) do some of the following –generate an HTML index file based on the contents of a directory –create a web log that stores all accesses –keep “hit” counters for each file that are reported when the user accesses /hits –many more options You will need to learn how to use sockets –there will be links on the homework page and sample programs –not too hard You may need to read a little on HTTP and HTML –links on the web page

5 Open Issues What happens to the L1 cache on system calls? –the OS uses the L1 cache as usual –it only replaces invalid entries –user code will have to What is hub? –a hub logically only connects the wires between multiple computers or networks –a packet received on any wire is immediately forwarded to every other wire –it increases the size of the collision domain What is a switch? –a switch is like a hub except it only forwards packets towards the destination –it learns where other computers are by listening to where they send their packets from

6 Hubs vs. Switches Hubs forward packets everywhere (broadcast) –cheap –work best if the network is small Switches only forward toward the destination –more expensive –self-configuring –good for large networks C3 HUB C4 C1 C2 C5 C3 SWITCH C4 C1 C2 C5

7 Protocol Stack These layers comprise the protocol stack Each layer of the stack adds extra info to the packet Application Data IP HeaderApplication DataTCP Header Ethernet Header Ethernet Checksum Ethernet Frame IP HeaderApplication DataTCP Header IP Datagram Application DataTCP Header TCP Segment Application layer Transport layer Network layer Data link layer

8 IP Ethernet allows packets to be sent between nodes on the same network Internet Protocol (IP) allows packets to be sent between nodes on different networks Key idea: some machines (i.e. routers) are on multiple networks Ethernet is still used to send packets between routers

9 IP Routers R R R R R HH H H H R R H R Routers send packet to next closest point H: Hosts R: Routers YOU CNN

10 IP Addresses IP addresses are 4 bytes (e.g. 128.95.8.137) –part of the address designates the network (e.g. 128.95) –the rest of the address designates the machine on the network (e.g. 8.137) A router sends the packet to the correct network, and the network sends the packet to the correct node –this greatly reduces the information a router must store

11 How do routers know where to send packets? Forwarding tables at each router –Network == 128.95, then send to router X Original Internet: manual update Now: automatic update based on “cost” –exchange tables with neighbors –use neighbor with smallest hop count –what if node says zero cost to everywhere?

12 Setting up Routing Tables Graph theory to compute “shortest path” –routers = nodes –links = edges –delay, hops = cost Need dynamic computation to adapt to changes in topology –if a router goes down, might need to find another path

13 IP Routing Protocols There are two basic kinds of routing protocols Distance Vector –exchange routing tables with neighbors –no one knows complete topology –now used between admin domains (i.e. AT&T and MCI Link state –tell everyone who your neighbors are –everyone computes shortest path –now used within admin domains (within AT&T)

14 IP Service Model IP's service model is best-effort unreliable data-gram delivery IP does it's best to get a message from source to destination But it makes no guarantees that –the packet will arrive –the packets will arrive in order –the contents of the packet won't be changed –only one copy of the packet will arrive Aren't you glad the designers of IP don't design cars?

15 What IP can do Some are uncommon, but they all happen INTERNET HelloWorldHelloWorld Arrive in order INTERNET HelloWorld Lose a packet INTERNET HelloWorld Hello Reorder packets INTERNET HelloWorldHello World Duplicate packets INTERNET HelloWorldGoodbyeWorld Corrupt Packets

16 Checksum chksum hash 1010100101110100 1100101010110101 0101101110100010 1101010101101010 1010110101001011 1010011001010101 1010101011011101 0011000101110100 Sent Data & Checksum 1010100101110100 1100101010110101 0101101110100010 1101010101101010 1010110101001011 1010011001010101 1010101011011101 Data to Send 1010100101110100 1100101010110101 0101101110100010 1101010010001010 1010110101001011 1010011001010101 1010101011011101 0011000101110100 Received Data & Checksum chksum hash 1001010110101010 Calculated and stored checksum differ, so data is corrupt INTERNET Corrupted bits

17 User Datagram Protocol (UDP) UDP is basically IP with a data checksum and ports The checksum ensures that corrupted data isn't accepted Ports allow multiple connections to be de- multiplexed (TCP has ports too) –a port is a number between 0 and 65535 –common applications such as web servers run on "well-known ports" so web browsers know which port to contact –a UDP/TCP "connection" is determined by the Source IP address, Source port number, Destination IP address and Destination port number

18 UDP UDP characteristics (similar to IP) –unreliable (no guarantees the packet arrives) –packets could be reordered or duplicated –corrupted packets are discarded, but not retransmitted Who would ever want this? –common for low-latency applications where loss is tolerable (streaming media, games) –because reliable protocols (TCP) can be slower

19 Transmission Control Protocol TCP is what you usually want –reliable (messages guaranteed to eventually arrive) –dropped packets are retransmitted –duplicate packets are discarded –reordered packets are unreordered TCP is a bi-directional (i.e. full-duplex) stream based protocol –Both nodes can send and receive –Don't explicitly send packets, instead send a stream of bytes

20 Ensuring Packets Arrive w/ UDP Will you marry me? INTERNET ? No Answer--Did she get my proposal? Was the packet lost or corrupted? I better send it again Will you marry me? INTERNET ? Will you marry me? INTERNET ? Will you marry me? INTERNET ? Stalker!

21 Reliability with TCP With TCP, the receiver is obligated to send an acknowledgment (ACK), when it receives a packet The receiver is not obligated to respond with an answer, only an acknowledgement of receipt If the sender does not receive an ACK, it eventually retransmits the packet –can the receiver ever receive two copies of a packet? Will you marry me? INTERNET Will you marry me? Got your message

22 Timing Out Packet ACK Timeout Packet ACK Timeout Packet Timeout Packet ACK Timeout Packet ACK Timeout Packet ACK Timeout ACK lostPacket lost Early timeout Time SenderReceiverSenderReceiverSenderReceiver

23 Eliminating Duplicate Packets Problem: The receiver can still receive duplicate packets (either due to the Internet or a retransmission) –how do we distinguish a duplicate from another packet with the same contents? Solution: Send a sequence number with each packet –1st packet gets sequence number 0 –2nd packet gets sequence number 1 –retransmitted 1st packet has sequence number 0

24 Sequence Numbers Each new packet gets a new sequence number Don't send the next packet until the previous packet is acknowledged Pkt 0 ACK 0 Pkt 0 ACK 1 Pkt 1 ACK 0 Discard Duplicate

25 Sending Multiple Packets Sending one packet at a time is too slow –round trip time is 100ms –network has enough buffer space to hold several packets Idea: send lots of packets at once –receiver acknowledges the packets they receive –retransmit only unacked packets

26 Sending Multiple Packets Sender sends multiple packets at once Each packet that was not acknowledged is retransmitted Problem: –retransmit packets even if only ACKs are lost (e.g. packet 2) 0 1 2 3 4 2 3 2 ACK 0 ACK 1 ACK 4 ACK 3 ACK 2

27 TCP Sending Packets In TCP, the receiver sends an acknowledgement after every packet The receiver acknowledges up to the last consecutive packet it received –receive "0" send "ack 0" I've received 0-0 –receive "1" send "ack 1" I've received 0-1 –receive "2" send "ack 2" I've received 0-2 –receive "4" send "ack 2" I've received 0-2 –receive "5" send "ack 2" I've received 0-2 It's okay if ACKs get lost –e.g. "ack 1" can be lost because "ack 2" covers it The sender can recognize if a packet was lost –Mmmmm? I've received 3 "ack 2"s, maybe packet 3 got lost

28 TCP ACKing The receiver acknowledges up to the last consecutive packet it received Packet 3 was lost, so the receiver sends an "ACK 2" when it receives packet 4, not an "ACK 4" The receiver must remember which packets it has received –it sends an "ACK 4" when it receives packet 3 because it received packet 4 earlier

29 Handling Reordered Packets TCP ensures that the data stream is delivered in-order Packets may arrive out- of-order TCP must buffer out-of- order packets until the missing packets arrive Packets are delivered to the application in the order they were sent, not the order they arrived 0 1 2 3 4 3 ACK 0 ACK 1 ACK 2 ACK 4 Deliver Packet 0 Deliver Packet 1 Deliver Packet 2 Save Packet 4 Deliver Packets 3-4

30 Receive Window From the receiver's perspective there are three types of packets –packets received and acked –packets received out of order –packets not yet received The first missing packet through the highest received packet is known as the receive window –the receiver only has to buffer packets in the receive window Packet #0123456789 Received?XXXXX Acknowledged?XXX Receive Window

31 Send Window From the sender's perspective there are three types of packets –packets sent and acked –packets sent and unacked –packets not yet sent All sent and unacked packets make up the send window –the sender must buffer all sent and unacked packets and all packets not yet sent Packet #0123456789 Sent?XXXXXXX Received ack?XX Send Window

32 Sliding Window TCP is known as a sliding window protocol As packets are sent/received/ acknowledged, the sender and receiver windows slide through sequence numbers

33 Domain Name Service (DNS) IP must use IP addresses, e.g. 128.95.4.112 You want to type http://www.cs.washington.edu, not http://128.95.4.112 DNS handles making this translation If the local DNS server doesn't know the translation, it asks one of the 13 root name- servers, which have known IP addresses Local DNS server (128.95.1.4) What’s the IP address for www.netscape.com? Your computer (128.95.1.24) Oh, you can find it at 207.200.89.226


Download ppt "Lecture Topics: 11/29 IP UDP TCP DNS. Homework 9 Write a simple web server –not as hard as it sounds Specification out tonight Skeleton code out by tomorrow."

Similar presentations


Ads by Google