0% found this document useful (0 votes)
20 views

mideterm cheatsheet

Uploaded by

pengzonglin
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

mideterm cheatsheet

Uploaded by

pengzonglin
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Introduction

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 Access Network:

. Wireless LAN (802.11 b/g/n/), Wide -area wireless access (4G, LTE, 5G)

Circuit-switching:

. dedicated resources, circuit-like (guaranteed) performance. Circuit is idle if not in use

. 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:

. Nodal processing delay: check error, determine output link

. Queueing delay, loss: time waiting at output link for transmission

. Transmission (push out) delay = L (bits) / R (bits/s); packets of length L bits, link transmission rate of R bits/s

. Propagation delay = d (m) / v (m/s); physical link of length d, propagation speed of v

Utilization: ( L/R ) / ( RTT + (L/R) )

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

IP stack: application(message), transport(segment), network(datagram), link(frame), physical(bit)

Application Layer
Socket:

. process send/receive message to/from socket

. it sits between application layer and transport layer

. 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:

. Server: always on host, permanent IP address

. Client: do not communicate directly with each other, may intermittently connected, may have dynamic IP address
P2P:

. no always on server, arbitrary end systems directly communicate

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.

. Client-Server: >= max ( N*F/Userver, F/Dmin )

. P2P: >= max ( F/Userver, F/Dmin, N*F/(Userver + ∑Ui) )

BitTorrent:

. churn: peers may come and go

. 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.

Application layer protocols: SMTP, HTTP, FTP, DNS

. 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.

. HTTP optimization: pipelining (send several requests at once), HTTP/2 (push)

. HTTP request message: request line, header lines, body

. HTTP response message: status line, header lines, body

DNS:

. iterative query, recursive query

. 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)

Distributed Hash Table:

. assign key-value pair to the peer that has the closest ID. Closest is immediate successor of the key.

Video Compression:

. color encoding: RGB, YUV

Transport Layer
. provide logical communication between app process running on different hosts

Multiplexing:

. handle data from multiple sockets, add transport header

Demultiplexing:
. use header info to deliver received segments to correct socket

. destination IP address, destination port number identify UDP 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:

. no-frills extension of “best effort” IP

. 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:

. features: connection-oriented, reliable transport, flow control, congestion control

. not supported: timing, minimum throughput guarantee, security

. rdt3.0: stop-and-wait operation: utilization: ( L / R) / ( RTT + L / R )

. 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:

. SampleRTT = measured time from segment transmission until ACK receipt

. EstimatedRTT = ( 1 – a ) * EstimatedRTT + a * SampleRTT, where typical value a = 0.125

. DeviationRTT = ( 1 – b ) * DeviationRTT + b * | SampleRTT – EstimatedRTT |, where typical value b = 0.25

. TimeoutInterval = EstimatedRtt + 4 * DeviationRTT

. TCP sender:

TCP retransmission:

TCP sliding window protocol:

. 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

TCP fast retransmit:

. if sender receives 3 ACKs for same data (“triple duplicate ACKs”), resend unacked segment with smallest seq #
TCP flow control:

. sender limits amount of unacked (“in-flight”) data to receiver’s rwnd value

TCP connection management:

. 3 way handshaking and 4 way closing:

TCP congestion control:

. sender limits transmission: LastByteSent-LastByteAcked <= cwnd

. sending rate roughly = cwnd / RTT (bytes/s)

. 3 stages: 1. Slow start, 2. Congestion avoidance, 3. Congestion detecting

. 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 Tahoe: always sets cwnd to 1 (timeout or 3 duplicate acks)

. 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)

for new ACK, need to run the


adjustment for each ack number,
especially for cumulative ACK

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

. TCP is fair, assuming two competing sessions:

. additive increase gives slope of 1, as throughout increases

. multiplicative decrease decreases throughput proportionally

(Connection with higher throughput will decrease more)

. 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

Routing: determines source-destination route

Forwarding: move packets from router’s input to appropriate output

Data plane: local, per-router function. Forwarding function.

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).

Generic router architecture:

Switching fabrics:

. transfer packet from input buffer to appropriate output buffer

. three types of SF:

. Switching via memory

.. packet is copied from input port memory to system’ memory and controlled by CPU

.. speed limited by memory bandwidth. (2 bus crossings per datagram)

. Switch via bus

.. packet send from input port memory to output port memory via a shared bus

.. speed limited by bus bandwidth. (Bus contention)

. Switch via interconnection network

.. overcome bus bandwidth limitations

Input port functions:


. lookup: using header field values, lookup output port using forwarding table in input port memory

. forwarding:

.. Destination address range-based forwarding: forward based only on destination IP address

.. Longest prefix matching forwarding: use longest address prefix that matches destination address.

. queuing: if datagrams arrive faster than forwarding rate into switch fabric

Input port queuing

. Slow switch fabric.

. Output port contention

.. Head-of-the-Line (HOL) blocking: queued datagram at front of queue prevents others in queue from moving forward

input 1 and input 3 are competing to forward packet to output 4. If switching


fabric decides to transfer packet from input 3, then input 1 cannot process in
the same time slot. All the packet (1,2,3) in the input 1 is blocked

. Possible solutions: 1. Increase switch fabric speed. 2. Increase inbound


capacity of output ports

Output port functions:

. 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)

. scheduling discipline: choose among queued datagrams for transmission on link

.. discard policy: if packet arrives to full queue, need drop packet.

1. tail drop: drop arriving packet

2. priority: drop/remove on priority basis

3. random: drop/remove randomly

.. FIFO scheduling: send in order of arrival to queue.

.. 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.

Internet network layer protocols

. routing protocols: for path selection. Example: RIP, OSPF, BGP

. IP protocol: define addressing conventions, datagram format, and packet handling conventions

. ICMP protocol: for error reporting and router ‘signaling’

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

. interface: connection between host/router and physical link

. IP addresses are associated with each interface


. CIDR: Classless Inter Domain Routing

.. subnet portion of address of arbitrary length

.. address format: a.b.c.d/x, where x is # bits in subnet portion of address

DHCP (Dynamic Host Configuration Protocol): dynamically get address from a server

. can renew least on address in use

. can allow reuse of address

. 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

ICANN: Internet Corporation for Assigned Names and Numbers

. allocates addresses; manages DNS; assigns domain names, resolves disputes

Private IP addresses: (Not routable externally)

. 10.0.0.0/8 | 172.16.0.0/12 | 192.168.0.0/16

NAT: network address translation

. implementation-> outgoing datagrams: replace | remember (in NAT translation table) | incoming datagrams: replace

. 16-bit port-number field

IPv6

. 128-bit address

. datagram format: fixed-length 40-byte header, no fragmentation allowed

Routing Protocols

. routing algorithm classification:

. global information: link state algorithm

. decentralized information: distance vector algorithm

. static: routes change slowly over time

. dynamic: routes change more quickly in response to link cost changes

. link state algorithm – Dijkstra’s algorithm

.. with n nodes, E links, O(nE) msg sent

.. If router malfunctions, node can advertise incorrect link cost. Each node computes only its own table

.. could result in oscillation

. distance vector algorithm – Bellman-ford algorithm

.. iterative, asynchronous: each local iteration caused by->1. Local link cost change. 2. DV update message from neighbor

.. distributed: each node notifies neighbors only when its DV changes


.. if router malfunctions, node can advertise incorrect path cost. Each node’s table used by other, error propagates.

.. good news travels fast, bad news travels slow (count to infinity problem, poisoned reverse solution)

Autonomous Systems (aka domain)

. 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.

OSPF (Open Shortest Path First)

. uses link-state algorithm

. 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”

BGP (border gateway protocol, inter-AS)

. BGP provides each AS a means to:

. eBGP: obtain subnet reachability information from neighboring ASes

. iBGP: propagate reachability information to all AS-internal routers.

. 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

also determines whether to advertise path to other neighboring ASes)

. BGP session: two BGP routers (“peers”) exchange BGP messages over semi-permanent TCP connection:

. message types: OPEN, UPDATE, KEEPALIVE, NOTIFICATION

. advertising paths to different destination network prefixes (BGP is a “path vector” protocol)

. advertised prefix includes BGP attributes (prefix + attributes = “route”)

. two important attributes:

. AS-PATH: list of ASes through which prefix advertisement has passed

. NEXT-HOP: indicates specific internal-AS router to next-hop AS

. 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

.. 1d: a forwarding entry [dest X, interface 1]


↑ ↓

. BGP route selection

.. 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

Software defined networking

. 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:

1. controller-to-switch - features, configure, modify-state, packet-out

2. switch-to-controller - packet-in, flow-removed, port status

. SDN challenges: 1. Hardening control panel. 2. Meet mission specific requirement 3. Internet-scaling

ICMP

SNMP

. 1. request/response mode. 2. Trap mode (passive, like heartbeat)


Link Layer
Services: 1. Framing, link access. 2. Reliable delivery. 3. Flow control. 4. Error detection/correction. 5. Half-/Full-duplex

Error detection: parity checking

Cyclic redundance check:

. 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.

Multiple access protocols:

1. Channel partitioning

. TDMA and FDMA

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

.. max efficiency = 1/e = .37

. ALOHA

.. collision probability increases: frame sent at t0 collides with other frames sent in [t0-1, t0+1]

.. max efficiency = 1/2e = .18

. CSMA (carrier sense multiple access)

.. 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

. Polling; Token ring;

MAC address and ARP

. 48bit
Ethernet

. 7 bytes preamble | 6 bytes dest MAC addr | 6 bytes source MAC addr | type | data (payload) | CRC

. connectionless, unreliable

. Spanning tree to deal with loop

.. 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

Port-based VLAN: switch port grouped

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)

Shannon Capacity theorem: Capacity = Bandwidth * log2(1 + SNR)

Wireless link characteristics: 1. Interference from other source 2. Multipath propagation

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)

.. reduces frequency selective, fading Robust to interference, Multi-user

. 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

Wireless link characteristics: 3. Decreased signal strength

. Advantage of signal attenuation: Spatial Reuse

. 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

. RTS/CTS not enough

Exposed terminal problem

. carrier sensing can make situation worse

Multiplexing:

1. Frequency multiplex

. Advantages: no dynamic coordination needed, works also for analog signals

. Disadvantages: waste of bandwidth, if traffic distributed unevenly inflexible, guard spaces

2. Time multiplex

. Advantages: only one carrier in the medium at any time, throughput high even for many users

. Disadvantages: precise synchronization necessary

3. Time and frequency multiplex

. Advantages: better protection against tapping, protection against frequency selective interference, higher data rates
compared to code multiplex

. Disadvantages: precise coordination required

4. Code multiplex (Implemented using spread spectrum)

. Advantages: bandwidth efficient, no coordination and synchronization, good protection against interference

. Disadvantages: lower user data rates, more complex signal regeneration

. Code Division Multiple Access (unique “code” assigned to each user)

.. encoded signal = (original data) X (chipping sequence)

.. decoding: inner-product of encoded signal and chipping sequence


.. need codes to have good: Auto-correlation properties: 𝑐𝑖 (𝑡)⋅𝑐𝑖 (𝑡)=1, Cross-correlation properties: 𝑐𝑖 (𝑡)⋅𝑐𝑗 (𝑡)=0 for
𝑗≠𝑖

.. need orthogonal codes: For N users, length of code is exponential 2^(N – 1)

802.11: passive/active scanning

host: must associate with an AP:

. scans channels, listening for beacon frames


containing AP’s name (SSID) and MAC address

. selects AP to associate with

. may perform authentication

. will typically run DHCP to get IP address in AP’s


subnet

IEEE 802.11 MAC Protocol: CSMA/CA

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)

Gateway GPRS Support Node (GGSN)

Mobility

let routing handle it: routers advertise permanent address of mobile-nodes-in-residence via usual routing table
exchange. (Not scale well)

- routing tables indicate where each mobile located

- no changes to end-systems

let end-systems handle it:


- direct routing: correspondent gets foreign address of mobile, sends directly to mobile

- indirect routing: communication from correspondent to mobile goes through home agent, then forwarded to remote

1. mobile uses two addresses:

. permanent address: used by correspondent (hence


mobile location is transparent to correspondent)

. care-of-address: used by home agent to forward


datagrams to mobile

2. foreign agent functions may be done by mobile itself


3. triangle routing: correspondent-home-network-
mobile. It is inefficient when correspondent, mobile is in
same network

You might also like