githubEdit

Computer Network

Computer Network

1. Overview of Computer Networks

Classification

  • By switching technology: circuit switching, message switching, packet switching

  • By user type: public network, private network

  • By transmission medium: wired network, wireless network

  • By coverage area: WAN (Wide Area Network), MAN (Metropolitan Area Network), LAN (Local Area Network), PAN (Personal Area Network)

  • By topology: bus, star, ring, mesh

Performance Metrics

  • Speed: data unit (bit)

Bit unit calculation: 8bit=1B KB=210B MB=210x210B ... Speed calculation: b/s=bps/s Kbps=103bps/s Mbps=103x103bps/s ...

  • Bandwidth: the data transmission capacity of a communication link, the "maximum rate" that can pass from one point to another per unit of time

Units and calculation methods are the same as speed

  • Throughput: the amount of data passing through a network (channel, interface) per unit of time; the actual data volume passing through the network, affected by network bandwidth and rated speed (less than or equal to speed)

  • Delay: transmission delay, propagation delay, processing delay (when geographically co-located, transmission delay dominates for large data)

Transmission delay calculation: packet length (b) / transmission rate (b/s); transmission rate takes the minimum of NIC speed, channel bandwidth, and interface rate Propagation delay calculation: channel length (m) / electromagnetic propagation speed (m/s); free space: 3x108 m/s, copper wire: 2.3x108, optical fiber: 2x108 Processing delay: includes queuing delay (router store-and-forward, computationally complex)

  • Delay-bandwidth product: propagation delay x bandwidth image- Round-trip time: the time for a single bidirectional information exchange (RTT)

  • Utilization (backbone ISPs generally keep channel utilization below 50%; exceeding this causes network delay to increase rapidly)

Channel utilization: indicates what percentage of time a channel is being utilized (data passing through) Network utilization: the weighted average of all channel utilizations across the network

  • Packet loss rate: the ratio of lost packets to total packets within a given time period

Causes of packet loss: bit errors during transmission, or packets being dropped when arriving at switches or routers with full queues (high traffic volume easily causes network congestion)

Computer Network Architecture

Common Computer Network Architectures

  1. OSI 7-Layer Model (original academic architecture)

Application Layer Presentation Layer Session Layer Transport Layer Network Layer Data Link Layer Physical Layer

  1. TCP/IP Architecture (commercially driven)

Application Layer (HTTP, SMTP, DNS, RTP) Transport Layer (TCP, UDP) Internet Layer (IP) Network Interface Layer

  1. Theoretical Architecture (pedagogical model)

Application Layer Transport Layer Network Layer Data Link Layer Physical Layer

The Necessity of Layered Computer Network Architecture

  • Physical Layer (what signals are used to transmit bits)

    • Transmission media

    • Physical interfaces

    • Using signals to represent bits 0/1

  • Data Link Layer (transmission over a single network or link segment)

    • How to identify hosts in the network (host addressing, e.g., MAC address)

    • How to distinguish addresses and data from a continuous bit stream represented by signals

    • How to coordinate hosts competing for the bus

  • Network Layer (solving the problem of packet routing across multiple networks)

    • How to identify each network and hosts within networks (combined network and host addressing, e.g., IP address)

    • How routers forward packets and perform route selection

  • Transport Layer (solving network-based communication between processes)

    • How to solve process-to-process communication over the network

    • How to handle transmission errors

  • Application Layer (solving specific network application needs through application process interaction)

    • Completing specific network applications through interaction between application processes

image

Terminology

  • Entity: any hardware or software process capable of sending or receiving information. Peer entities (entities at the same layer on both sending and receiving sides, e.g., network interface cards)

  • Protocol: a set of rules controlling logical communication between two peer entities (HTTP protocol, TCP protocol, IP protocol, etc.)

    • Syntax: defines the format of exchanged information (e.g., IP header + data format)

    • Semantics: defines the operations to be performed by both communicating parties (e.g., HTTP GET request and HTTP response message)

    • Synchronization: defines the timing relationship between communicating parties (TCP three-way handshake)

  • Service

    • Under protocol control, logical communication between two peer entities enables the current layer to provide services to the layer above

    • To implement the current layer's protocol, services provided by the layer below are also needed

    • Protocols are "horizontal"; services are "vertical"

    • Service access points: frames, protocol fields (IP), port numbers

    • Service primitives: the upper layer must exchange certain commands with the lower layer to use its services

  • Protocol Data Unit (PDU): data packets transmitted between peer layers

    • Bit stream (bit)

    • Frame

    • Packet

    • Segment (TCP) / Datagram (UDP)

    • Message

  • Service Data Unit (SDU): data packets exchanged between layers within the same system

  • Multiple SDUs can be combined into one PDU; one SDU can also be divided into several PDUs

Delay and propagation time exercise calculations: image image

2. TCP/IP Architecture

Physical Layer

Transmission Media

  • Guided media

    • Twisted pair

    • Coaxial cable

    • Optical fiber

  • Unguided media

    • Radio waves

    • Infrared

    • Microwave communication (2~40 GHz)

    • Visible light

Main Tasks of Physical Layer Protocols

  • Mechanical characteristics

  • Electrical characteristics

  • Functional characteristics

  • Procedural characteristics

The Physical Layer is concerned with how to transmit data bit streams over various computer transmission media It shields the Data Link Layer from the differences between various transmission media, so the Data Link Layer only needs to consider how to implement its own protocols and services without worrying about the specific underlying transmission

Transmission Modes

  • Serial transmission: computer networks

  • Parallel transmission: CPU --> memory bus parallel transmission

  • Synchronous transmission: sender and receiver clocks synchronized

    • External synchronization: a separate clock signal line added between sender and receiver

    • Internal synchronization: the sender encodes the clock synchronization signal into the transmitted data (e.g., Manchester encoding)

  • Asynchronous transmission

    • Synchronization between bytes (start bit, stop bit)

    • Each bit within a byte is still synchronized

  • Simplex: radio

  • Half-duplex: walkie-talkie

  • Full-duplex: telephone

Encoding and Modulation

image
image

Framing

Adding frame header and trailer: MAC frame image

Error Detection

  • Frame trailer error detection code

  • Parity check

  • Cyclic Redundancy Check (CRC) image

Reliable Transmission

image
  • Stop-and-Wait protocol (SW)

  • Go-Back-N protocol (GBN)

  • Selective Repeat protocol (SR)

Point-to-Point Protocol (PPP)

image

Media Access Control

image image

Random Access

  • CSMA/CD protocol

  • CSMA/CA protocol

MAC Address, IP Address, and ARP Protocol

image

Hubs and Switches

image image image

VLAN Technology

image

Network Layer

Overview

image

IPv4 Addresses

  • Classification

image
  • Classless IPv4 addressing: CIDR. For example: the CIDR block for 192.168.10.1/20 is --> 192.168.0~192.168.15

image
  • Fixed-Length Subnet Mask (FLSM) and Variable-Length Subnet Mask (VLSM)

  • IP datagram sending and forwarding process

  • Routing protocol overview

    • Static routing: manually configured network routes, default routes, host-specific routes, black hole routes

    • Dynamic routing: automatically obtaining routing information through routing protocols

image image

  • Routing Information Protocol: RIP (distance-vector based)

image image

  • Routing protocol: Open Shortest Path First (OSPF) basic working principle (link-state based)

image image image image

  • Routing protocol: Border Gateway Protocol (BGP)

image image

  • IPv4 datagram header format

image
  • Internet Control Message Protocol (ICMP)

    • Destination unreachable, source quench, time exceeded, parameter problem, redirect

image
  • ping、traceroute

image image

  • Virtual Private Network (VPN) and Network Address Translation (NAT)

image

Transport Layer

TCP vs. UDP Comparison

image

TCP Principles

  • Flow control (sliding window)

image
  • Congestion control

    • Tahoe version

      • Slow start

      • Congestion avoidance

    • Reno version

      • Fast retransmit (sender retransmits as soon as possible, without waiting for timeout timer)

      • Fast recovery

image image

  • Retransmission timeout selection (RTO retransmission timeout value)

  • Reliable transmission implementation

  • Three-way handshake and four-way teardown

image
  • Header format

image

Application Layer

Client/Server Model and P2P Model

image

DHCP, DNS, FTP, SMTP, HTTP and Other Protocols

Last updated