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

CS2105 Reference

Uploaded by

xZealthiusx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

CS2105 Reference

Uploaded by

xZealthiusx
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

CS2105 Introduction to Domain Name System ˆ Multiplexing: When receiving packet from network layer, ˆ Selective repeat:

Computer Networks ˆ Mapping between hostname and IP address (and others) TCP/UDP must read transport header to decide which
socket to deliver the message to (de-multiplexing); when
Receiver individually ACKs all correctly received packets;
buffers out-of-order packets as needed
are stored as resource records (RR)
sending messages from application layer, TCP/UDP must
ˆ RR format: (name, value, type, ttl)
Sender maintains timer for each unACKed packet; if timer
Basics combine packets from different messages into the same expires, retransmit only that unACKed packet
network interface (multiplexing)
ˆ Circuit switching: type name value
- UDP connectionless de-multiplexing: decide TCP Reliability
ˆ TCP sequence number: “byte number” of first byte of
Call setup required A hostname IP address
Circuit-link (guaranteed) performance NS domain hostname of au- using destination port only
Circuit segment idle if not used by call (no sharing) (nus.edu.sg) thoritative NS - TCP connection-oriented de-multiplexing: data in a segment
ˆ Packet switching: CNAME alias name canonical name decide using ˆ TCP acknowledgement number: sequence number of
Share network resources ˆ 13 root servers globally that answer NS queries for TLDs (src IP addr, src port, dest IP addr, dest port) next byte expected (“cumulative ACK”)
Resources used on demand
Excessive congestion is possible ˆ Local DNS server caches mapping and acts as proxy ˆ Maximum segment size: maximum number of data bytes
Maximum packet size: includes header bytes
ˆ TCP delayed ACK: Wait up to 500ms for second
Sender breaks message into pkts; receiver reassembles them
ˆ Processing delay: Check bit errors; determine output link Dynamic Host Configuration Protocol
© CS2105 Lecture 6 - 11
segment; use one ACK for two segments only
ˆ Queuing delay: Waiting in queue for transmission Arriving DHCP server
ˆ Dynamic TCP timeout:
ˆ Transmission delay: Time taken to push bits onto link special IP
client 223.1.2.5
SampleRT T := RTT of new packet
ˆ Propagation delay: Time for bits to travel in link EstRT T ← (1 − α) × EstRT T + α × SampleRT T
(typically α = 0.125)
ˆ End-to-end packet delay: Time for packet to travel from broadcast
address DevRT T ← (1−β)×DevRT T +β ×|SampleRT T−EstRT T |
source to destination (typically β = 0.25)
ˆ Throughput: Bits transmittable per unit time for Your IP T imeoutInterval ← EstRT T + 4 × DevRT T
end-to-end communication
address
ˆ TCP fast retransmission: If 3 duplicate ACKs (i.e. 4 in
Application message Transport segment total) are received, next segment is treated as lost and thus
Network datagram Link frame Reliable Data Transfer retransmitted immediately

ˆ rdt 1.0: Perfectly reliable ˆ Maintains single timer and resends oldest unACKed packet
on timeout; timer started only when prev. ACK is received
Application Layer ˆ rdt 2.0: May corrupt packets
Stop-and-wait protocol; receiver sends ACK or NAK back Network Security
Common Protocols Fatal flaw if ACK is corrupted, because sender will resend
App. Protocol Tpt. Protocol Port KS : session key
ˆ May also provide other network information:
packet and receiver will treat it as new packet + −

ˆ rdt 2.1: To fix rdt 2.0, add 1-bit sequence number to each ˆ Integrity / Authenticity: Bob can verify Alice is sender
HTTP TCP 80 (default) KA : public key KA : private key 2 keys per user
HTTPS TCP 443 (default) - first-hop router, local DNS server, subnet mask
DNS UDP 53 packet; receiver can now detect and discard duplicate
Message authentication code: Send H(m + KS ) ⊕ m
SMTP TCP 25 packet (but must still send ACK for the duplicate packet) −
Digital signature: Send KA (m) ⊕ m
DHCP
RIP
UDP
UDP
67 (svr) 68 (client)
520
Transport Layer
ˆ rdt 2.2: Same functionality as rdt 2.1, but is NAK-free; Digital sign.: Bob can prove to third party Alice is sender

receiver ACKs sequence number of last received packet Signed message digest as digital sign: Send KA (H(m)) ⊕ m
TCP vs UDP
Hypertext Transfer Protocol ˆ Transmission Control Protocol: ˆ rdt 3.0: May corrupt packets, may lose packets, may incur ˆ Confidentiality: Send K (<everything from above>)
+
B

ˆ HTTP 1.0 closes connection after transmitting single object Reliable transport arbitrary long packet delay
Sender waits “reasonable” amount of time for ACK, and
ˆ Hybrid: Send K (K ) ⊕ K (m ⊕ K (H(m)))
+
B S S

A

ˆ HTTP 1.1 uses persistent connection by default (possibly


Flow control (sender won’t overwhelm receiver)
Congestion control (throttle sender in overloaded network) retransmits if ACK is not received before timeout; sequence
with pipelining) Does not provide timing, minimum throughput guarantee, number included in both data and ACK just like rdt 2.2 Network Layer
ˆ HTTP request message: (terminates with double CRLF) security
GET /cs2105/demo.html HTTP/1.1 ˆ User Datagram Protocol: Pipelining IP Addressing
ˆ 172.16.0.0/12  subnet mask starts with 12 ‘1’s
Host: www.comp.nus.edu.sg
User-Agent: Mozilla/5.0
Unreliable data transfer ˆ Go-back-N : first: 172.16.0.0 (subnet); last: 172.31.255.255 (broadcast)
Does not provide reliability, flow control, congestion control, Sender:
Connection: close timing, minimum throughput guarantee, security - all other addresses are usable
Cookie: name=value; name2=value2; name3=value3
ˆ Socket: Interface between application and transport layers
- Up to N unACKed packets in pipeline
ˆ Valid
ˆ HTTP response message:
subnet masks:
- k-bit sequence number Subnet size 256 128 64 32 16 8 4 2 1
TCP uses a stream socket
HTTP/1.1 200 OK - “sliding window” to keep track of unACKed packets Subnet mask 0 128 192 224 240 248 252 254 255
ˆ Longest prefix match is used to determine next hop from
UDP uses a datagram socket
Date: Thu, 15 Jan 2018 13:02:41 GMT
Content-Type: text/html ˆ TCP and UDP ports are distinct; port num may be reused - timer for oldest unACKed packet
- on timeout(n) retransmit packet n and all subsequent router forwarding table
ˆ TCP creates a new socket for each client (using the same ˆ Special IP addresses:
Content-Length: 150
Set-Cookie: name=value packets in the window
server port), but uses client IP and client port to 0.0.0.0/8 Local subnet (non-routable)
distinguish clients Receiver:
data data data... 127.0.0.0/8 Loopback
ˆ Conditional GET: ˆ Checksum: 1’s complement sum of 16-bit integers = - Only ACK packets that arrive in order 255.255.255.255/32 Broadcast (within subnet)
10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 Private
ˆ Routers have one IP address per subnet
If-Modified-Since: Thu, 15 Jan 2018 13:02:41 GMT 0b1111111111111111 - Discards out of order packets and ACK the last
Server may reply with 304 Not Modified To compute checksum, remember to invert the sum in-order sequence number (“cumulative ACK”)
Network of Networks Link Layer ˆ Pure (unslotted) ALOHA: ˆ Ethernet switch:
ˆ The Internet is a “network of networks” – a hierarchy of Required services
No slots; transmit immediately
- Chance of collision increases
- Hosts have dedicated connection to switch; switch buffers
frames (store-and-forward) and is full duplex (simultaneous
automonous systems (AS)
ˆ - Framing: Encapsulate datagram to frame, add header/trailer
Intra-AS routing: RIP, OSPF; Inter-AS routing: BGP Optional services
ˆ Carrier Sense Multiple Access (CSMA): bidirectional transfer)
- CSMA/CD protocol is used even though no collisions
ˆ
- Sense the channel before transmission; don’t interrupt
“link-state” algorithms – all routers have complete - Link access control: If multiple nodes share a single link, ongoing transmission - Maintains switch table – maps MAC address to interface
knowledge of network topology and link cost; compute need to coordinate which nodes can send frames at a certain - Collisions may still occur due to to propagation delay and (and TTL); if destination interface is known then frame is
least-cost path using Dijkstra’s algorithm point in time propagation distance forwarded only to that link; if destination is not known
ˆ “distance vector” algorithms – routers know
- Reliable delivery: Often used on error-prone links (e.g.
wireless) - Error detection - Error correction ˆ CSMA/CD (Collision Detection): then frame is broadcast
physically-connected neighbours and link costs to them, and
exchange and update “local views” periodically; compute ˆ
Link + physical layer is implemented in hardware in
Abort transmission when collision is detected
Minimum frame size is usually specified as collision may not
- Switch learns source MAC address when frame is sent
through it
using Bellman-Ford equation (cost = total distance) network adapter or on a chip
be detected for overly small frames due to propagation delay
ˆ Routing Information Protocol (RIP) implements ˆ Single bit parity can detect single-bit errors (e.g. Ethernet requires minimum frame size of 64 bytes)
- Nodes do not need to know about the presence of the
switch (switch is transparent to nodes)
“distance vector” (DV) algorithm, measuring hop count
- Entries in routing table are aggregated subnet masks
ˆ Two-dimensional bit parity can detect and correct Has “Hidden node problem”: due to propagation distance,
collisions at receiver may not be detectable by source
single-bit errors; can detect two-bit errors
Physical Layer Lecture 11 - 9

ˆ CSMA/CA (Collision Avoidance):


© CS2105

ˆ Cyclic Redundancy Check (CRC):


(so we are routing to destination subnet)
- Exchange routing table every 30 secs over UDP port 520
- If no update for 3 minutes, assume neighbour has failed Used widely in practice (on Ethernet & Wi-Fi) Receiver needs to return an acknowledgement if frame is NRZ (Non-Return-to-Zero)
Digital
- D: data bits (dividend)
- G: generator of r + 1 bits, pre-agreed (divisor)
received successfully (e.g. Wi-Fi)
ˆ Limited
NRZ encoding
 number ofuses two voltage
different voltageslevels. It has
(usually 2 ortwo
3)
Network Address Translation
ˆ Maintains mapping between (external IP Address, external
- R: resultant CRC checksum (remainder) MAC Addressing ˆ Non-return-to-zero
variations.
(NRZ):
 NRZ-L: absolute voltage level determines value of a bit.
© CS2105
port) and (destination (LAN) IP address, destination port)
Lecture 7 - 29
Bitwise XOR division is used
ˆ 48 bits long NRZ-L: absolute voltage level determines value of a bit
 NRZ-I:
NRZ-I: inverts
inverts thethe voltage
voltage if ifbit
bit11 is
is encountered.
encountered
IPv4 Datagram Format ˆ Permanently assigned to network interface card (NIC)
Sender computes R and sends (D, R)
Receiver divides (D, R) by G and checks if remainder is zero
IP Datagram Format
IP protocol 1
32 bits
16 32 Multiple Access Protocols
ˆ Each network node will only process frames that are © CS2105 Lecture 11 - 10
version number addressed to its MAC address (or the broadcast address
for fragmentation /
ver

identifier
IP datagram length

flags fragment offset


ˆ Required in broadcast links FF-FF-FF-FF-FF-FF) RZ (Return-to-Zero)
reassembly - multiple nodes connect to a shared broadcast channel  RZ encoding uses three voltage levels. It always
upper layer
TTL protocol header checksum - when a node transmits a frame, every other node receives Address Resolution Protocol (ARP) returns the voltage to zero halfway through a bit
number of remaining
hops (decremented source IP address
a copy
ˆ Resolves IP address to MAC address © CS2105 interval. Lecture 11 - 11
at each router)
destination IP address
- if two nodes transmit simultaneously, frames collide and
none would be correctly read ˆ Each IP node has an ARP table which stores the mapping ˆManchester
Return-to-zero: return to zero halfway in bit interval

 IP header data
(typically a TCP or UDP segment)
ˆ Categories: of IP address to MAC address (and TTL) of other nodes in
the same subnet  Manchester coding inverts the signal in the
 20 bytes Channel partitioning: divide channel into smaller “pieces”
middle of a bit.
ˆ IP datagram length includes IP header (some fields are not shown)
(e.g. time slots, frequency); each node exclusively allowed
to transmit in given piece (unused pieces go idle)
ˆ If the next hop node is not yet in the ARP table, an ARP  A −𝑣𝑣𝑣𝑣 to +𝑣𝑣𝑣𝑣 transition represents 1. A +𝑣𝑣𝑣𝑣 to −𝑣𝑣𝑣𝑣
query packet (with required IP address) is broadcasted to
ˆ Header checksum only for header bytes; Taking turns: nodes take turns to transmit (but can
cooperatively forfeit turn if there is nothing to transmit)
subnet; node with correct IP address will respond with its ˆ transition represents 0.
Manchester: Invert signal in the middle of a bit
16-bit 1’s complement sum (just like TCP) MAC address, sent back to source MAC address
© CS2105 Lecture 10 - 22

ˆ Different links have different maximum transfer unit


Random access: channel is not divided and collisions are
Ethernet Frame Structure (1/2)
© CS2105 Lecture 7 - 31
possible; focus on “recovering” from collisions
(MTU)IP Fragmentation Illustration Ethernet
(MTU
IP datagrams
includes IP header); routers may fragment
ˆ Time division multiple access (TDMA): ˆ Topology
IP
Original datagram payload
Channel partitioning by fixed-length time slot Sending NIC (adapter) encapsulates IP datagram
ˆ Frequency division multiple access (FDMA):
header Bus: all nodes can collide with each other
in Ethernet
Star: switch in frame.
centre, nodes do not collide
Channel partitioning by frequency band
ˆ Polling: 8 bytes 6 4
new IP new IP
new IP
header
Data part 1
header
part 2
header
part 3 6 2 46 - 1500 Analog
ˆ Total dataDestination
transferred increases due to extra IP headers Taking turns; master node “invites” slave nodes to transmit Preamble
Dest Src
Type Payload CRC ˆ Vary amplitude, frequency, or phase of a sine wave:
ˆ Destination  host will reassemble the packet. Addr Addr
in turn y = A sin (2πf t + φ)
host fields
IP header

will are
reassemble
ˆ Header field changes for fragmentation:
and their relative order.
the packet
used to identify fragments
(polling overhead; single point of failure of master node) ˆ Preamble: 10101010 10101010 10101010 · · · 10101011 ˆ Channel bandwidth: difference between highest and
ˆ Token passing: Preamble:
Provides bit-level syncing, not part of 64-bit min. frame size lowest frequency that can pass through the channel
IP datagram length is set to fragment size
More frags. (MF) flag is set for all fragments except the last Control token is passed from one node to next sequentially
ˆ Type:
 7 bytes with pattern 10101010 followed by 1 byte
Higher-level protocol; 0x0800 for IPv4
ˆ Shannon channel capacity:
(token overhead; single point of failure (lost token)) with pattern 10101011. Theoretical maximum bit rate of noisy channel:
ˆ Ethernet
Fragment offset is the fragment offset in the original data
payload, measured in 8-byte units
Header checksum is recomputed
ˆ Slotted ALOHA:  used toCSMA/CD
synchronizealgorithm:
receiver and sender clock rates.
1) If channel idle, start transmitting immediately.
C = B × log2 (1 + SNR) where B = bandwidth,
SNR = signal-to-noise ratio (not affected by bits per baud)
ˆ Encodings (??? Shift Keying):
Assumptions:
Otherwise wait until idle.
- All frames of equal size
Internet Control Message Protocol (ICMP) 2) If collision while transmitting, abort and send jam signal.
- Time divided into slots of equal length (1 slot = 1 frame) Amplitude (ASK): susceptible to noise
Then do binary back-off: after mth collision, choose K at
ˆ Used to communicate network-level information: - Nodes start to transmit only at the beginning of a slot
Operations: random from range [0, 2m ), and wait 512 × K bit times, ° °
Frequency (FSK): limited by channel bandwidth
Phase (FSK): 0 and 180 phases
error reporting, echo request/reply (ping) then go back to step 1.
ˆ When TTL for a packet is zero, the packet is discarded and
- Listens to the channel while transmitting (detect collision) QPSK, 8-PSK: more phases
- If collision, re-transmit frame in each subsequent slot with Binary back-off aims to adapt re-transmission attempts to Quadrature Amplitude Modulation (QAM): modifies both
an ICMP message is sent to source address probability p until success estimated current load amplitude and phase

You might also like