Computer Networks - A Top Down Approach: Notes (Chapters 1, 2, 3, 9)
Computer Networks - A Top Down Approach: Notes (Chapters 1, 2, 3, 9)
(Chapters 1, 2, 3, 9)
•
• 1.1.1 A Nuts-And-Bolts Description
o End systems/hosts connected by a network of communication links
and packet switches
Hardware and software components
o End systems/hosts access the Internet through lower-tier Internet
Service Providers (ISPs), which are interconnected through national
and international upper-tier ISPs
o Protocols are run to control the sending and receiving of information
TCP/IP
o Internet standards developed by the Internet Engineering Task Force
(IETF), whose standard documents are requests for comments (RFCs)
• 1.1.2 A Services Description
o Infrastructure that provides services to distributed applications
Distributed since they run on multiple end systems
o End systems and the Internet provide a socket interface for
communication
• 1.1.3 What Is a Protocol?
o Defines the format and order of messages exchanged between two
or more communicating entities, as well as the actions taken on the
transmission and/or receipt of a message or other event
o
Methods
• GET
• POST
• HEAD
• PUT
• DELETE
Browser generates header lines as a function of
• The browser type and version
• User configuration of the browser
• Whether the browser currently has a cached, but
possibly out-of-date version of the object
o Response
Web servers generate headers in a similar way to browsers
• Different products, versions, configurations
• 2.2.4 User-Server Interaction: Cookies
o An HTTP server is stateless
Simplifies server design
However, often desirable to identify users
o Cookies
• 2.2.5 Web Caching
o Distributed to avoid
A single point of failure
High, growing traffic volume
Having a large distance between querying clients
Constant maintenance to account for constant new hosts
o Classes of DNS servers
Root DNS servers
• Provide IP addresses of top-level domain (TLD) servers
• Over 400 scattered globally
TLD servers
• com, org, net, uk, fr
• Provide IP addresses for authoritative DNS servers
Authoritative DNS servers
• Houses an organization’s publicly accessible DNS records
that map the names of hosts within the organization to
IP addresses
o Local DNS (LDNS) server
Provided by ISPs to allow connected hosts to query the DNS
database
o In general, TLD servers do not always know the IP addresses of
authoritative DNS servers for the queried hostname
May only know of an intermediate DNS server (often have
hostname dns.organization), which knows the authoritative
DNS server for the hostname
o Recursive and iterative queries
o DNS servers cache responses to queries for some time (often set to
two days)
• 2.4.3 DNS Records and Messages
o DNS servers store resource records (RRs)
Four-tuple (Name, Value, Type, time to live (TTL))
The meaning of Name and Value depend on Type
• Type=A
o Name is a hostname
o Value is the IP address of the hostname
o (relay1.bar.foo.com, 145.37.93.126, A, TTL)
• Type=NS
o Name is a domain
o Value is the hostname of an authoritative DNS
server that knows how to obtain the IP addresses
for hosts in the domain
o (foo.com, dns.foo.com, NS, TTL)
• Type=CNAME
o Name is an alias hostname
o Value is a canonical hostname for the alias
hostname
o (foo.com, relay1.bar.foo.com, CNAME, TTL)
• Type=MX
o Name is an alias hostname
o Value is a canonical name of a mail server for the
alias hostname
o (foo.com, mail.bar.foo.com, MX, TTL)
o MX record allows a company’s mail server and
Web server to have identical (aliased) hostnames
o
o nslookup program to send DNS query messages
o Insert records into the DNS database via a registrar
Commercial entity that verifies the uniqueness of a domain
name and enters it into the DNS database for a small fee
o Need to provide names and IP addresses of your primary and
secondary authoritative DNS servers
o DNS vulnerabilities
DDoS to TLD servers
• Partial damage control from caching at LDNS servers
Man-in-the-middle
• Intercept queries from hosts and return bogus replies
DNS poisoning attack
• Attacker sends bogus replies to a LDNS server, tricking
the server into accepting bogus records into its cache
o
o To accommodate pipelining
Range of sequence numbers must be increased
Sender and receiver sides of the protocols may have to buffer
more than one packet
o Two approaches: Go-Back-N (GBN) and selective repeat (SR)
protocols
• 3.4.3 Go-Back-N
o
o Application data passed into TCP send buffer
o TCP intermittently passes chunks of data to the network layer
o Maximum segment size (MSS): maximum amount of data that can be
grabbed from the TCP send buffer and placed in a segment
(accounting for TCP/IP header length, typically 40 bytes)
Determined by largest link-layer frame that can be sent by the
local sending host (maximum transmission unit (MTU), usually
1500 bytes)
Thus typical values are MTU = 1500 bytes, MSS = 1460 bytes
• 3.5.2 TCP Segment Structure
o Flags
CWR and ECE
• Used for explicit congestion notification
URG
• Indicates whether data in the segment that the sending-
side upper-layer entity has been marked as “urgent”
(whose location is pointed to by the urgent data pointer,
rare usage in practice)
ACK
• Indicates whether the value in the acknowledgment
number field is valid or not
PSH
• Indicates whether the receiver should pass data to the
upper layer protocol process immediately (rare usage in
practice)
RST, SYN, FIN
• Used for connection setup and teardown
o Sequence number: byte-stream number of the first byte in the
segment
Randomly chose initial sequence number, minimize the
possibility that a segment still present in the network from an
earlier, already-terminated connection between the same two
hosts using the same port numbers is mistaken for a valid
segment
o Acknowledgment number: next byte that the sending host expects
from the receiving host (cumulative acknowledgments)
TCP RFC does not impose rules on buffering out-of-order
bytes, but in practice this is often done to increase the
efficiency of network bandwidth
Piggybacking: TCP segment with ACK and data
• 3.5.3 Round-Trip Time Estimation and Timeout
o Want timeout to be greater than RTT to avoid unnecessary
retransmissions, but not so much larger that link utilization is low
o SampleRTT: amount of time between when a segment is sent (passed
to IP process) and received
Most TCP implementations only take one SampleRTT
measurement (track SampleRTT for a single transmitted but
currently unacknowledged segment) at a time (roughly once
per RTT)
Never tracked for retransmitted packets
Fluctuates from segment to segment due to congestion in
routers and varying load on the end systems
o EstimatedRTT: (1-a)*EstimatedRTT + a*SampleRTT
a is recommended to be 0.125
Exponentially weighted moving average (EWMA)
o DevRTT: (1-b)*DevRTT + b*|SampleRTT - EstimatedRTT|
b is recommended to be 0.25
Also EWMA
o Finally, TimeoutInterval: EstimatedRTT + 4*DevRTT
• 3.5.4 Reliable Data Transfer
o TCP ensures that the byte stream that a process reads out of its TCP
receive buffer is exactly the same byte stream as that sent by the end
system on the other side of the connection
o Specific TCP details and mechanisms
SendBase variable in TCP sender: sequence number of the
oldest unacknowledged byte
Doubling the timeout interval for a segment after a timeout
• Provides a limited form of congestion control
Some versions of TCP have an implicit NAK mechanism – TCP
fast retransmit
• Three duplicate ACKs for a given segment serve as an
implicit NAK for the following segment, triggering
retransmission before timeout
Delayed ACK: when in-order segment arrives with expected
sequence number, wait up to 500 msec for the arrival of
another in-order segment. If next in-order segment does not
arrive in this interval, send an ACK
• 3.5.5 Flow Control
•
o TCP Tahoe and Reno behave the same until triple duplicate ACK at
transmission round 8
o Loss at cwnd = 12, so ssthresh = 6
o TCP Reno sets cwnd = cwnd/2 + 3 (= 9 MSS) and enters fast recovery
mode
o TCP Tahoe sets cwnd = 1 MSS and enters slow start mode
• TCP splitting
o Desirable for cloud services to provide a high-level of responsiveness
o If end system is far from a data center, RTT will be large, potentially
leading to poor response time performance due to TCP slow start
o Solution: clients establish TCP connection to nearby front-end server.
Front-end server maintains a persistent TCP connection to the data
center with a large TCP congestion window
• TCP’s congestion control is often referred to as an additive-increase,
multiplicative-decrease (AIMD) form of congestion control
Start at point A
• Total throughput into link < R, so no loss
Moves to point B
• Total throughput into link > R, so loss
• Both connections set cwnd = cwnd / 2
Moves to point C
• Connection 1, whose cwnd was greater than that of
connection 2, experiences a greater reduction than
connection 2
o Closer to equal bandwidth sharing
Converges to fairness
• Though in reality, RTT varies
o Hosts with lower RTT are able to grab the available
bandwidth (increase their cwnd) at the link more
quickly as it becomes free
o TCP’s congestion control mechanism incentivizes high bandwidth
applications to run over UDP
o Can use multiple TCP connections in parallel to grab more bandwidth
• 3.7.2 Explicit Congestion Notification (ECN): Network-assisted Congestion
Control
Interleaving
Error concealment
• Produce a replacement for a lost packet that is similar to
the original
• Possible via short-term self-similarity
• Packet repetition
• Interpolation
• 9.3.4 Case Study: VoIP with Skype
o Proprietary
o Clients can use many different codecs
o Audio and video packets via UDP (by default, TCP otherwise)
o Control packets via TCP
o FEC for loss recovery
o Adapts streams to current network conditions
o P2P
o Skype super peers relay data between two callers behind UDP-
blocking NATs
o For video calls with N > 2 participants, each participant’s video
stream is routed to a server cluster, which relays to each participant
the streams of the N-1 streams of the N-1 other participants,
avoiding the likely low bandwidth upstream links of each participant
o
Payload type = audio or video encoding
Synchronization source identifier (SSRC) uniquely identifies the
source of the RTP stream
o No insurance of timely delivery of data, or other quality-of-service
(QoS) guarantees
• 9.4.2 Session Initiation Protocol (SIP)
o Establishes calls
o Can allow the caller to determine the current IP address of the callee