mideterm cheatsheet
mideterm cheatsheet
Protocols define format, order of messages sent and received among network entities, and actions taken on message
transmission, receipt
Access Network:
. Digital Subscriber Line (dedicated line to center office), Cable Network (shared cable to distribution network), Ethernet
. Wireless LAN (802.11 b/g/n/), Wide -area wireless access (4G, LTE, 5G)
Circuit-switching:
. FDM vs TDM
Packet-switching: hosts break application-layer message into small packets, forward packets from one router to the next
. Store-and-Forward: entire packet must arrive at router before it can be transmitted to next link
Delay:
. Transmission (push out) delay = L (bits) / R (bits/s); packets of length L bits, link transmission rate of R bits/s
Packet-switching vs Circuit-switching
. Packet switching allows more users to use network, better for burst data
. example: 1 Mb/s link, each user (100 kb/s when active, 10% time active)
. circuit switching: 10 users, packet switching: 35 users, probability > 10 active at same time is less than .0004
Application Layer
Socket:
. TCP: client (socket, connect, read/write, close), server (socket, bind, listen, accept, read/write, close)
. UDP: client (socket, bind, read/write, close), server (socket, read/write, close)
Client-Server:
. Client: do not communicate directly with each other, may intermittently connected, may have dynamic IP address
P2P:
Client-Server vs P2P:
. Server X, which has upload speed of Userver, to distribute file of size F. N clients, each has upload speed of Ui and
download speed of Di.
BitTorrent:
. request chunks: 1. Periodically check with peer for list of chunks. 2. Request missing chunks, rarest first
. sending chunks (tit-for-tat): 1. (choke) Send to 4 peers currently sending me at highest rate, reevaluate every 10
seconds. 2. (optimistically unchoke) Every 30 seconds, randomly choose another peer to send.
. HTTP: stateless
. non-persistent HTTP: at most one object sent over one TCP connection. Response time for each object: 1 RTT for
initiate TCP connection + 1 RTT for HTTP request and response + file transmission time
. persistent HTTP: multiple objects can be sent over single TCP connection.
DNS:
. DNS record RR (name, value, type): (hostname, IP address, A), (alias, canonical name, CNAME), (domain, hostname of
authoritative server, NS), (name, name of mail server, MX)
. assign key-value pair to the peer that has the closest ID. Closest is immediate successor of the key.
Video Compression:
Transport Layer
. provide logical communication between app process running on different hosts
Multiplexing:
Demultiplexing:
. use header info to deliver received segments to correct socket
. destination IP address, destination port number, source IP address, source port number identify TCP socket
. server host may support simultaneous TCP connection, and each connection has different sockets
UDP:
. checksum: addition (ones’ complement sum) of segment contents. I.E. E666, D555 -> 4443
.. a carryout from the most significant bit needs to be added to the result
TCP:
. pipelined protocols: Assume sender can have up to N unACKed packet in pipeline. 1. Go-back-N, 2. Selective Repeat
. Go-back-N:
. sender has timer for oldest unACKed packet. When timeout, resend all unACKed packets
. receiver only sends ACK for correctly-received pkt with highest in-order seq #, discard out-of-order pkt and re-
ACK received pkt. No buffer required.
. Selective Repeat:
. sender maintains timer for each unACKed packet. when timeout, only resend that packet. If receive ACK(n),
where n in [base, base + N], mark pkt(n) as ACKed, advance window if appropriate.
. receiver send ACK for each packet. If receive pkt(n), where n in [base, base + N – 1], send ACK(n), buffer out-of-
order pkt, deliver in-order packets. If receive pkt(n), where n in [base – N, base – 1], send ACK(n). Otherwise, ignore.
. need to choose appropriate seq range and window size, otherwise, could have dilemma
. TCP segment: seq # marks the beginning byte in the data, ack # marks the (end byte in the data + 1)
. TCP timeout:
. TCP sender:
TCP retransmission:
. sender: LastByteAcked <= LastByteSent, LastByteSent <= LastByteWritten (application send to TCP). Buffer bytes
between LastByteAcked and LastByteWritten
. receiver: LastByteRead (application read from TCP) < NextByteExpected, NextByteExpected <= LastByteRcvd + 1. Buffer
bytes between NextByteRead and LastByteRcvd
. if sender receives 3 ACKs for same data (“triple duplicate ACKs”), resend unacked segment with smallest seq #
TCP flow control:
. Slow start: 1. Initially cwnd = 1 MSS, 2. Double cwnd for every RTT, 3. Till reach some threshold or first loss event
. Congestion avoidance: 1. Additive increase: increase cwnd by 1 MSS every RTT until loss detected. 2. Multiplicative
decrease: cut cwnd in half after loss
. switching from slow start to CA: When cwnd gets to 1/2 of its value before timeout. On loss event, ssthresh is set to 1/2
of cwnd just before loss event
. Congestion detecting:
. Loss due to timeout: set cwnd to 1 MSS, 2. window then grows exponentially (as in slow start) to threshold,
then grows linearly (as in additive increase)
. Loss due to 3 duplicate ACK:
. TCP Reno (Fast Recovery): 1. dup ACKs indicate network capable of delivering some segments, 2. cwnd
is cut in half window then grows linearly (as in additive increase)
TCP throughput:
. let window size = W when loss occurs, then avg. window size (# in-flight bytes) = 3/4 * W, avg TCP throughput = (3/4) *
(W/RTT). Ex, 1500-byte segments, 100ms RTT, want 10 Gbps throughput, requires W = 83,333 in-flight segments.
. throughput in terms of segment loss probability, L = 1.22 * MSS / ( RTT * sqrt(L) ). For example, to achieve 10 Gbps
throughput, need a loss rate of L = 2·10-10
TCP fairness:
. fairness goal: if K TCP sessions share same bottleneck link of bandwidth R, each should have average rate of R/K
. RTT fairness
. Assume A(100ms), B(50ms), B increases window faster, but when rate(A)+rate(B) reach
capacity, both halve their window
Network Layer
On sending side encapsulates segments into datagrams. On receiving side, delivers segments to transport layer
Control plane: network-wide logic. Two approaches: 1. Routing Algorithms (implemented in router, control how
forwarding table looks like). 2. Software-defined networking (implemented in (remote) servers).
Switching fabrics:
.. packet is copied from input port memory to system’ memory and controlled by CPU
.. packet send from input port memory to output port memory via a shared bus
. forwarding:
.. Longest prefix matching forwarding: use longest address prefix that matches destination address.
. queuing: if datagrams arrive faster than forwarding rate into switch fabric
.. Head-of-the-Line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward
. buffering: if datagrams arrive from fabric faster than the transmission rate. Queuing (delay) and loss due to output port
buffer overflow
.. buffer size: ‘typical RTT’ * link capacity C. Or with N flows, buffering equal to RTT * C / sqrt(N)
.. Priority scheduling: send highest priority queued packet. Multiple classes, with different priority
.. Round Robin scheduling: cyclically send highest priority queued packet from each class queue. Multiple classes, with
different priority.
.. Weighted Fair Queuing scheduling: generalized Round Robin. Each class gets weighted amount of service in each cycle.
. IP protocol: define addressing conventions, datagram format, and packet handling conventions
IP datagram format
. 20 bytes overhead
IP fragmentation
. network links has MTU. Larger datagram will be fragmented and reassembled only in the final destination.
. sender can choose to send larger packet with Don’t Fragment flag set, but when the packet arrives at router with
smaller MTU, the packet will be dropped and an ICMP message will be sent back
IP addressing
DHCP (Dynamic Host Configuration Protocol): dynamically get address from a server
. can set address of first-hop router, name and IP address of DNS server, network mask
. establishment: 1. host broadcasts “DHCP discover” msg [optional] | 2. DHCP server responds with “DHCP offer” msg
[optional] | 3. host requests IP address: “DHCP request” msg | 4. DHCP server sends address: “DHCP ack” msg
. implementation-> outgoing datagrams: replace | remember (in NAT translation table) | incoming datagrams: replace
IPv6
. 128-bit address
Routing Protocols
.. If router malfunctions, node can advertise incorrect link cost. Each node computes only its own table
.. iterative, asynchronous: each local iteration caused by->1. Local link cost change. 2. DV update message from neighbor
.. good news travels fast, bad news travels slow (count to infinity problem, poisoned reverse solution)
. intra-AS routing (aka interior gateway protocol), all router in same AS must run same intra-domain protocol. Gateway
router has link to router in another AS. Eg. RIP, OSPF, IGRP
. inter-AS routing, gateway perform inter-domain routing as well as intra-domain routing. Inter-AS routing must learn
which destination are reachable through which other AS and propagate this reachability info to all router in the same AS.
. inter-AS: admin control over how traffic routed, policy over traffic routed, policy may dominate over performance.
Intra-AS: single admin, no policy decision needed, performance, hierarchical routing save table size, reduced update
traffic.
. router flood OSPF link-state advertisement to all other router in same AS, which carried directly over IP (not UDP/TCP)
. features: security (msg authenticated), multiple same-cost paths allowed, uni-/multi-cast support, hierarchical OSPF
. hierarchical OSPF: Two-level hierarchy – Internet – (boundary router – backbone router – area border
router)”backbone” – (area border router – internal router)”internal area”
. determine “good” routes to other networks based on reachability information and policy (gateway receiving
route advertisement uses import policy to accept/decline path (e.g., never route through AS Y). AS policy
. BGP session: two BGP routers (“peers”) exchange BGP messages over semi-permanent TCP connection:
. advertising paths to different destination network prefixes (BGP is a “path vector” protocol)
. BGP, OSPF, forwarding table entries (how does router set forwarding table entry to distant prefix?
.. 1a, 1b, 1c, 1d learn about dest X via iBGP from 1c “path to X goes through 1c”
.. 1d: OSPF intra domain routing: to get 1c, forward over outgoing local interface 1
.. 1. local preference value attribute: policy decision 2. shortest AS-PATH 3. closest NEXT-HOP router: hot potato routing
4. additional criteria
.. eg: hot potato routing: 2d learns via iBGP X can be reached via 2a or 2c, it will choose 2a
. advantages of logically centralized control panel: 1. Easier to manage, 2. Table-based forwarding allows “programming”
router, 3. Open implementation of control panel
. properties of SDN: 1. Generalized “flow-based” forwarding. 2. Control, data plane separation. 3. Control plane
functions external to data-plane switches. 4. Programmable control applications
. SDN-controlled switches – southbound API – SDN controller – northbound API – network-control application
. flow table: each router has one and it is computed and distributed by the routing controller. It includes headers
(defines flow, which will use to match packet header), counters (#bytes and #packets), and actions
. OpenFlow:
.. OpenFlow messages:
. SDN challenges: 1. Hardening control panel. 2. Meet mission specific requirement 3. Internet-scaling
ICMP
SNMP
. 1. The binary data is first augmented by adding k-1 zeros in the end of the data. 2. Use modulo-2 binary division (XOR)
to divide binary data by the key and store remainder of division. 3. Append the remainder at the end of the data to form
the encoded data and send the same
. Perform modulo-2 division again and if the remainder is 0, then there are no errors.
1. Channel partitioning
2. Random access
. Slotted ALOHA
.. assumptions: all frames same size, time divided into equal size slots (time to transmit 1 frame), nodes start to transmit
only slot beginning, nodes are synchronized, if 2 or more nodes transmit in slot, these nodes detect collision
.. operation: when node obtains fresh frame, transmits in next slot, if no collision: node can send new frame in next slot,
if collision: node retransmits frame in each subsequent slot with prob. p until success
.. Pros: single active node can continuously transmit at full rate of channel, highly decentralized: only slots in nodes need
to be in sync, simple
.. Cons: collisions, wasting slots, idle slots, nodes may be able to detect collision in less than time to transmit packet,
clock synchronization
. ALOHA
.. collision probability increases: frame sent at t0 collides with other frames sent in [t0-1, t0+1]
.. listen on channel to detect if it can transmit. Still can collide due to propagation delay, if collide, entire packet wasted
. CSMA/CD
.. colliding transmissions aborted, reducing channel wastage. After aborting, enters binary (exponential) backoff
..
3. Turns
. 48bit
Ethernet
. 7 bytes preamble | 6 bytes dest MAC addr | 6 bytes source MAC addr | type | data (payload) | CRC
. connectionless, unreliable
.. Basic Rules: 1. Switch with the lowest ID is the root 2. For a given switch - A port in the direction of the root switch is
the root port 3. For a given LAN - The switch closest to the root (or the switch with the lowest ID to break ties) is the
designated switch for a LAN, The corresponding port is the designated port 4. Switches with no designated ports and
ports that are neither a root port nor a designated port are not part of the tree.
VLAN
Trunk port: carries frame between VLANs defined over multiply physical switches
Wireless Networks
Power transmission, Signal to Noise ratio, Signal to Interference and Noise ratio, multipath propagation:
High SNR -> Lower Bit Error -> Use higher order modulation (i.e., pack more bits per symbol, bit rate = Bandwidth *
bits/symbol) BPSK(1bit/symbol), QPSK(2), 16 QAM(4)
Spread Spectrum (spread the narrow band signal into a broad band signal using a special code):
. Direct Sequence Spread Spectrum: XOR the signal with pseudonoise (PN) sequence (chipping sequence)
. Frequency Hopping Spread Spectrum (Discrete changes of carrier frequency - sequence of frequency changes
determined via PN sequence)
.. frequency selective fading and interference limited to short period, uses only small portion of spectrum at any
time, Secure
. problem: two devices too far way. Solution 1: increase one device power. (double transmission range -> need 4x power
on one device) Solution 2: using intermediate device (transmit over two hops, require 2x power, one for each hop)
Collision detection is difficult: 1. Transmitter can only hear itself 2. Cannot determine signal quality at receiver
Hidden terminal problem
Multiplexing:
1. Frequency multiplex
2. Time multiplex
. Advantages: only one carrier in the medium at any time, throughput high even for many users
. Advantages: better protection against tapping, protection against frequency selective interference, higher data rates
compared to code multiplex
. Advantages: bandwidth efficient, no coordination and synchronization, good protection against interference
802.11 sender – 1. if sense channel idle for DIFS, then transmit entire frame (no CD) 2. if sense channel busy, then start
random backoff time - timer counts down while channel idle - transmit when timer expires - if no ACK, increase random
backoff interval, repeat 2
802.11 receiver - if frame received OK, then return ACK after SIFS (ACK needed due to hidden terminal problem)
802.11 frame
Cellular Networks
Serving GPRS Support Node (SGSN)
Mobility
let routing handle it: routers advertise permanent address of mobile-nodes-in-residence via usual routing table
exchange. (Not scale well)
- no changes to end-systems
- indirect routing: communication from correspondent to mobile goes through home agent, then forwarded to remote