Skip to main content

networking

OSI Model

img

Components

  • Local networking - Ethernet
  • Routing
  • Segmenting, ports and sessions
  • Applications

Key features

  • Higher layer built on lower layer, adding features and capabilities
  • This bottom-up approach illustrates the limitations of each lower layer and how each subsequent upper layer was developed to address and overcome those limitations

Layer 1 - Physical - Bit

img

Key features

  • Layer 1 (Physical) specifications define the transmission and reception of raw bit streams between a device and a shared physical medium
  • It defines things like voltage levels, timing, rates, distances, modulation, and connectors
  • Physical medium can be copper (electrical), fibre (light), or wifi (RF)

Physical HUB

  • Connects two more devices

img

Combinations

  • We can mix and match multiple components depending on the network's needs
    • Cables and NICs
    • Cables and transceivers
    • Cables and repeaters and hubs
    • Cables and wireless access points

Summary

  • Physical shared medium
  • Standards for transmitting onto the medium
  • Standards for receiving from the medium
  • No access control
  • No uniquely identified devices
  • No devices → Device communications

img

Components on frame

  • Preamble and SFD: Define the start of the frame
  • MAC header: Contains the destination and source MAC addresses and the EtherType field (layer 3 protocol)
  • Payload: The data encapsulated within the frame
  • FCS: Check to detect any transmission errors

CSMA/CD - Carrier-sense Multiple Access/Collision Detection

  • Challenge

img

  • Solution

img

Switch - Layer 2 device

  • The NIC handles the conversion of a structured frame (Layer 2) into raw bits encoded as physical signals (Layer 1) for transmission
  • Problem

img

  • Solution

img

Summary

  • Identifiable devices
  • Media access control (sharing)
  • Collision detection
  • Unicast 1:1
  • Broadcast 1:ALL
  • Switches - Like Hubs with Super powers (Layer 2)

Layer 3 - Network - Packet

Decimal and binary

  • Human vs. computer

img

  • Conversion: Decimal to binary

img

img

  • Conversion: Binary to decimal

img

Layer 3

img

IPv4 and IPv6

img

  • IPv4

img

Subnet mask

  • /16 in CIDR notation means the first 16 bits of an IP address are the network portion

img

Route tables and routes

  • Each router typically has a single routing table

img

Address resolution protocol (ARP)

img

How routing works?

  • During routing, the IP packet's core content (source/destination IP, payload) typically remains unchanged, but fields like TTL and checksum are modified
  • Routers work at layer 3 but need MACs for layer 2
  • MAC address is in frame header, not packet

img

Summary

  • IP addresses (IPv4/IPv6) enable cross-network addressing
  • ARP maps an IP address to its corresponding MAC address
  • A route determines where to forward a packet
  • Routing tables store multiple routes for packet forwarding
  • Routers move packets, encapsulated in Layer 2 frames
  • Devices communicate over the Internet using IP addresses
  • IP uses source and destination IP addresses for communication
  • IP packets may be delivered out of order

Layer 4 - Transport - Segment

Problems - Layer 3

img

TCP and UDP

img

  • TCP segments
    • Source port: Identifies the port number of the sending application, enabling the recipient to know which application sent the data
    • Destination port: Identifies the port number of the receiving application, allowing the recipient's operating system to direct the segment to the correct application
    • Sequence number: A 32-bit number used to ensure correct ordering of data segments and to acknowledge received data
    • Acknowledgment number: A 32-bit number used by the receiver to indicate the next sequence number it expects to receive, confirming receipt of previous segments
    • Flags 'N' things (*): A set of 1-bit flags (e.g., SYN, ACK, FIN, RST, PSH, URG) that control the state and management of the TCP connection
    • Window: A 16-bit field that specifies the number of data bytes the sender of this segment is willing to accept from the other end (flow control)
    • Checksum: A 16-bit field used for error checking of the TCP header and data to ensure integrity
    • Urgent pointer: A 16-bit field that, if the URG flag is set, indicates the offset from the current sequence number to the last byte of urgent data
    • Options: A variable-length field used to convey additional information not covered in the standard header, such as Maximum Segment Size (MSS)
    • Padding: Zero bits added to the end of the options field to ensure the TCP header ends on a 32-bit boundary

img

  • TCP

img

Layer 5 - Session

TCP connection 3-way handshake

img

Session and state

img

Network Address Translation (NAT)