370 likes | 381 Views
About the Final Exam. Saturday June 11 3:00-6:00PM, 2444 BH Material to be covered Chapters 2 & 3: 20-30% Chapter 4 (4.4-4.8), Chapter 5 (5.1-5.7), Chapter 6 (6.3, 6.5): 70-80% Closed book, closed notes You can bring 2 (8x11) "cheat sheets" into the final exam (double-side OK)
E N D
About the Final Exam • Saturday June 11 3:00-6:00PM, 2444 BH • Material to be covered • Chapters 2 & 3: 20-30% • Chapter 4 (4.4-4.8), Chapter 5 (5.1-5.7), Chapter 6 (6.3, 6.5): 70-80% • Closed book, closed notes • You can bring 2 (8x11) "cheat sheets" into the final exam (double-side OK) • New office hour 10:00AM-1:00PM Saturday 6/11 • No office hour Wednesday 6/8 CS118/Spring05
A Day in the Life of an HTTP Query 2.DNS query multiplexing demultiplexing Transport protocols X X Running routing protocol Client/server paradigm Web server application Brower application HTTP 1.HTTP Socket interface Socket interface TCP 3.TCP IP 4.IP Ethernet 5.Ethernet X Switch IP router CS118/Spring05
A Bottom-up Roadmap • Physical layer: know how to calculate the delay of sending packets from one node to another • Transmission rate (bandwidth) • Transmission delay • Propagation delay • Link layer: move data between two directly connected nodes • Error checking schemes: parity, checksum, CRC • Framing, byte stuffing • Multi-access protocols: Aloha, Ethernet (CSMA/CD), 802.11 (CSMA/CA, RTS-CTS) • Switch self-learning scheme • Network layer • IP address structure (subnet, CIDR) • Routing: distance vector, link state; broadcast, multicast, IGMP • IP header CS118/Spring05
On top of network layer • Transport layer • UDP, TCP: header format • TCP: connection set-up & tear-down, congestion control, retransmission timer setting • reliable data delivery • Stop-and-go • Go-back-N • Selective-repeat • Application layer protocols CS118/Spring05
Computer Networking: the overall picture Packet (carries destination address) Switch 2 Switch 1 header data • What is packet switching? • Cut data into chunks, sent in a "store-and-forward" way • statistical multiplexing queueing delay, potential losses • why packet switching? • What’s in a packet: • header: contains all the information needed for data delivery • Why layered network protocol architecture? • Divide and conquer Efficient resource sharing Flexible delivery CS118/Spring05
Layered protocol implementation A protocol defines: • the format of message exchanged between peer entities • the actions taken on receipt of the message Ethernet frame DATA header tail What’s in the header: all the information,and only the information that’s needed for the protocol’s functionality IP packet DATA IP hdr TCP packet DATA TCP hdr DATA CS118/Spring05
Multi-access protocol • Aloha/Slotted Aloha Q: for a network with 3 nodes, what is the probability that a given node sends successfully without collision? • Ethernet • 1-persistent CSMA/CD Q: Why need collision detection? • Collision resolution: how exponential backup works • 802.11 wireless LAN • CSMA/CA • RTS-CTS CS118/Spring05
Ethernet: Why Collision Detection t2 Time saved from collection detection t3 CS118/Spring05
Wireless LAN: Collision Avoidance DIFS data SIFS ACK 802.11 sender 1 if sense channel idle for DIFSthen transmit entire data frame (no CD) 2 ifsense channel busy: start random backoff timer 3 timer counts down while channel idle 4 when timer expires: transmit entire frame • if no ACK, increase random backoff interval, go to step 3 802.11 receiver if frame received OK - return ACK after SIFS Q: How does waiting for a random time period help collision avoidance? sender receiver DIFS: distributed inter-frame spacing SIFS: short inter-frame spacing CS118/Spring05
MAC Address and ARP • Compare MAC address with IP address • The detailed operations of ARP • How many steps in sending a packet from one host to another located on a different network? • Find out whether destination on the same network • ARP if needed • Encapsulate IP packet in a link layer protocol and send to next hop How to connect multiple Ethernets • Compare hubs, switches, and routers • Switch self-learning algorithm CS118/Spring05
Switch Learning Example • Q: Assuming all the switches' forwarding tables are empty, show the forwarding tables for switches B1-B4 after the following transmissions: • A sends to C • C sends to A • D sends to C B3 C B1 B2 A B4 D • Solution: • When A sends to C, all the switches see the packet and learn where A is. • When C sends to A, the packet is routed directly to A, and B4 does not learn where C is. • When D sends to C, the packet is routed by B2 towards B3, and B1 does not learn where D is. CS118/Spring05
The picture of the world according to IP Various application protocols SCTP TCP UDP RDP transport (end-to-end) internet layer IP Various network technologies Ethernet wireless FDDI dialup ATM CS118/Spring05
The picture of the world according to IP • all hosts connected to physical networks (subnet) • all subnets interconnected by IP routers • receive and forward packets between subnets • at subnet level a router sends/received data in exactly the same way as a host • IP assigns globally unique addresses to all reachable interfaces (connecting to either hosts or routers) • datagram delivery between these interfaces • routers run routing protocols to figure out the next hop to forward each IP packet towards its destination CS118/Spring05
IP Packet Header 0 4 8 16 31 vers. # HLen type-of-service total length identification flags fragment offset protocol time-to-live IP header checksum Basic header source address destination address options (variable length) padding data • What is the purpose for each header field? • For example, why do we need TTL field? CS118/Spring05
IP and Below • IP delivers packets from host to host, possibly through a chain of IP routers • An IP address uniquely identifies an attachment interface • each IP router looks up the forwarding table to determine the next subnet to forward the packet to • physical networks do the real work of getting packets from one IP node to the next • packets are encapsulated and de-capsulated when crossing physical network boundaries • To map IP address to network MAC address: ARP CS118/Spring05
Interconnection by encapsulation data IP data IP data IP data IP FDDI data IP Eth • IP packets are wrapped in a network’s protocol to travel through that network • A router un-wraps the packet to see its IP destination address • on the same network: send to destination directly • on a diff. network: send to next hop router Router-1 H1 R2 IP IP IP PPP ETH FDDI ETH FDDI Q: a packet traverses 4 routers from source to destination, how many time does it get encapsulated and de-capsulated along the way? CS118/Spring05
IP packet fragmentation details • all fragments of the same packet carry the same identifier • all fragments except the last one have the “MF” bit set • fragment offset points to the first byte of the fragment Example: 1st fragment: identifier=8FB3; MF=1; offset=0 2nd fragment: identifier=8FB3; MF=1; offset=64 3rd fragment: identifier=8FB3; MF=0; offset=128 data=1300B IP header data frag-1 IP Hd data frag-2 IP Hd data frag-3 IP Hd (276B) (512B) (512B) Rest of IP header Identifier: 8FB3 DFMF fragment offset (13 bits) CS118/Spring05
IP packet reassembly at destination host 276 Ver TOS 532 Ver TOS 532 Ver TOS 000 128 8FB3 001 64 001 0 8FB3 8FB3 rest of IP header rest of IP header rest of IP header data data data • use identifier and offset to put the pieces back together • the offset plus the packet length tells whether there are holes missing in the middle • the last fragment is indicated by MF=0 Destination host • Upon receiving the first fragment of an IP packet, • destination host sets a reassembly timer • when the timer goes off and the destination host still has not received all the pieces, it drops all the received pieces. CS118/Spring05
IP address structure • 4 bytes • Hierarchical ! (i.e. not flat, as MAC addresses) • network ID • host ID • What is the boundary between these 2 parts: • Classful address: classes A, B, C • Subnetting • Classless Inter-Domain Routing (CIDR) CS118/Spring05
Subnetting 11111111111111111111110000000000 Network ID 4 byte • subnetting: Add another (hidden) level to address hierarchy • Subnet is known only at the local site • Use part of the original host ID portion as netID • Subnet mask: defines portion of the address considered as “network ID” by the local site Network-ID host-ID CS118/Spring05
CIDR: Classless InterDomain Routing • assign network addresses by blocks of contiguous IP addresses, in a form of <IP address, mask> • mask identifies block size, must be power of 2 • example: SmartDesign Inc. got 4 x 2^8 address blocks 192.4.16.0192.4.19.255, <192.4.16.0, 255.255.252.0>, or 192.4.16/22 11000000000001000001001111111111 11000000000001000001000000000000 192 4 19 255 192 4 16 0 11111111111111111111110000000000 22 bits of prefix 255 255 252 0 CS118/Spring05
CIDR and subnetting example Network# mask next-hop 192.4.18 255.255.255.128 C …… ……….. Network# next-hop 192.4.16.0 B 192.4.0.0 M 192.4.18.0/25 11000000000001000001001000001111 11000000000001000001000000000000 11000000000001000000000000000000 192 . 4 . 11111111111111111111111110000000 11000000000001000001001000001111 192 . 4 . 18 Global Internet SmartDesign M A B Look up IP addr. 192.4.18.15 C 192.4.18.15 CS118/Spring05
Following an IP packet from source to dest. data IP Eth data IP data IP data IP data IP WAN Source host A first uses subnet mask M to figure out whether dest. host is on the same network 1. Dest. = host B: find B's MAC address, send data 2. dest. = host C, A sends packet to its default router • the router strips off Ethernet header, consult its IP forwarding table to find next hop 3. Dest. = D: B A D C 223.240.129.0 WAN 78.0.0.0 R2 router CS118/Spring05
IPv6 • What header fields are available in both IPv4 and IPv6? • What are the new fields in IPv6 header? Why do we need them? • Comparison between IPv4 and IPv6 Q: Does IPv6 support fragmentation? If not, how does IPv6 handle the case of small-MTU network? Transition from IPv4 to IPv6 • how does tunneling work? CS118/Spring05
IPv6 header format Flow Label Version Priority Payload Length Next Header Hop Limit Source Address (16 bytes, 128 bits) Destination Address (16 bytes) IPv4 header CS118/Spring05
Transition From IPv4 To IPv6 Flow: X Src: A Dest: F data Flow: X Src: A Dest: F data E B A F E B C D F A tunnel Logical view: IPv6 IPv6 IPv6 IPv6 • Not all routers can be upgraded simultaneous • to allow the Internet operate with mixed IPv4 and IPv6 routers : tunneling Physical view: IPv6 IPv6 IPv6 IPv6 IPv4 IPv4 Src:B Dest: E Src:B Dest: E Flow: X Src: A Dest: F data Flow: X Src: A Dest: F data E-to-F: IPv6 B-to-C: IPv6 inside IPv4 B-to-C: IPv6 inside IPv4 A-to-B: IPv6 CS118/Spring05
Broadcast and Multicasting • Broadcast • By building a spanning tree • By reverse path forwarding • IP multicast service model • each group identified by an IP mcast address • members can be anywhere • members may join and leave any time • multicast routing protocols • Center-based, shared multicast tree • Distance-Vector Multicast Routing (DVMRP) • reverse path broadcast: only broadcast over output interfaces if the input interface is on the shortest path to the source S • pruning and grafting Q: after sending a pruning message, why does the router need to keep the pruning state? CS118/Spring05
IGMP • A query router on each link • querier periodically polls the link • on receipt of query message, a host sets a random timer for each mcast group it belongs to • when timer expires, send a membership report to group G • others in G hear the report and stop the timers • joining: send reports immediately • leaving: send a leave msg only if the host answered the last membership query, and querier router sends group-specific queries again Q: Why does the host use a random timer in IGMP? Q: Does the router know how many receiving hosts for each multicast group on its local Ethernet? Q: When the last receiving host leaves the group, but its leave message is lost, what happens? CS118/Spring05
ON TCP • How does TCP achieve reliable data delivery? • What are the fundamental mechanisms? • How does TCP perform flow control? • How does TCP perform congestion control? • How does TCP estimate its RTT and set the retransmission timeout (RTO)? CS118/Spring05
TCP header format 31 0 16 IP header source port destination port Data sequence number acknowledgment number u a p r s F r c s s y i g k h t n n Hlen unused window size checksum urgent pointer Options (viable length) data CS118/Spring05
"pseudo header" in UCP and TCP UDP pseudo header source IP address destination IP address zero protocol UDP length source IP address TCP pseudo header destination IP address zero protocol TCP length FYI 0 31 source port # destination port# UDP header • Length: # of bytes (including both header & data) • checksum: computed over • the pseudo header, and • UDP datagram (including both header and data) • if the value is 0: no checksum checksum length data ...... CS118/Spring05
More on pseudo headers • addresses & protocol: copied from IP header • Length • UDP: already covered in the UDP header • TCP: can be calculated from the IP total length • pseudo header is not carried in the datagram, nor counted in length field • why pseudo header: UDP/TCP's self-protection against mis-delivered IP packets CS118/Spring05
TCP connection: open and close • Open: the initial seq# is randomly chosen server client Passive open ack(x+1) + request(y) open request(x) ack(y+1) (now in estab. state) enter estab. state Close: I-finished(M) ACK (M+1) I-finished(N) • ack(N+1), wait for 2MSL before deleting conn. state Done, delete conn. state CS118/Spring05
TCP Retransmission Timer • SRTT = EstimatedRTT, rttvar = DevRTT • When opening a new TCP connection: • EstimatedRTT = DevRTT = 3 sec • Upon getting the first RTT sample: EstimatedRTT = SampleRTT, DevRTT = EstimatedRTT/2 • Upon getting next SampleRTT: • difference = SampleRTT - EstimatedRTT • EstimatedRTT = (1-) x EstimatedRTT + x SampleRTT = EstimatedRTT + x difference • DevRTT = (1-) x DevRTT + x |difference| = DevRTT + (|difference| - DevRTT) • Typically: = 1/8, = 1/4 • TimeoutInterval (RTO) = EstimatedRTT + 4 x DevRTT • If timeout: RTO = 2 x RTO CS118/Spring05
TCP Congestion Control • Basic idea: learn from observations • when congwin < threshold, increase congwin exponentially • when congwin ≥ threshold, increase congwin linearly • if packet lost, have gone too far • threshold = congwin / 2 • If 3 dup. ACKs: network capable of delivering some packets, congwin cut in half • If timeout: slow-start again (congwin = 1 mss) CS118/Spring05
TCP Slow-Start & Congestion Avoidance time initialize: Congwin = 1 MSS threshold = RcvWindow if (CongWin < threshold) { for every segment ACKed Congwin++ } until (loss event) /* slowstart is over */ { for every w segments ACKed: Congwin++ } Until (loss event) /* loss detected */ threshold = Congwin/2 If (3 dup. ACKs) Congwin = threshold Else Congwin = 1 MSS one segment RTT two segments four segments CS118/Spring05
Application Protocols • HTTP • Persistent vs. non-persistent HTTP • Parallel HTTP sessions • DNS: providing name to IP address translation service • Generally speaking, there is no relation between DNS domains and IP address space • FTP: uses separate TCP connections for control exchange and file transfer • SMTP CS118/Spring05