NETWORKING AND TECHNICAL FUNDAMENTALS

OSI 7-Layer Networking Model

OSI Model Introduction (4:46)

Alt text

Alt text

Layer 1 - Physical (10:00)

Alt text

Alt text

Alt text

Alt text

**mac vs mac address**?

  • MAC: Medium Access Control, also called Media Access Control

  • MAC Address: Medium Access Control Address,

    • also known as hardware address, or physical address
    • a unique identifier assigned to a network interface controller (NIC) for use as a network address in communications within a network segment

Alt text

Alt text Left game sends Frame F1 to Right game

Alt text Right game sends Frame F2 to Left game - Carrier Sense Multiple Access (CSMA)

layers are independent

Conceptually, left L2 is talking to right L2.

Alt text Collision Detection (CD)

Alt text OSI Layer 2 - Try using a Hub

Alt text OSI Layer 2 - Using a Switch - MAC Address Table

Alt text OSI Layer 2 Data Link: MAC Address 👉️ Median Access Control & Collision Detection, Switch

Layer 3 - Network - PART1 (12:06)

Alt text OSI Layer 3 - Layer 3LAN (Local Area Network) use Ethernet protocol

Alt text OSI Layer 3 - Long distant point to point (P2P) links use other protocols: PPP/MPLS/ATM…

Alt text OSI Layer 3 - Internet Protocol (IP), a Layer-3 protocol, moves data between LAN without direct P2P links, by adding cross network IP addressing and routing

Alt text OSI Layer 3 - IP Packets are moved step by step from source to destination via intermediate networks, encapsulated in different frames along the way.

Alt text OSI Layer 3 - Routers (L3) devices, remove frame encapsulation and add new frame encapsulation at every hop 1️⃣2️⃣3️⃣4️⃣

Alt text OSI Layer 3 - IP v4 package structure

Alt text OSI Layer 3 - IP v6 package structure

Layer 3 - Network - PART2 (19:13)

Alt text OSI Layer 3 - IPv4 Addressing

Alt text OSI Layer 3 - Subnet Mask

ipv4 classful addressing

Class A, class B, class C

Ref: https://www.wikiwand.com/en/Classful_network

ipv4 reserved ip address

  • Class A

    • 0.0.0.0/8: Local network
    • 10.0.0.0/8: Private network
    • 127.0.0.0./8: Loopback of local host
  • Class B

    • 169.254.0.0/16: Link-local address when no IP address is specified

      • 169.254.169.254/32: AWS EC2 Instance Metadata Service
    • 172.16.0.0/12: Private network

      • 127.31.0.0/16: AWS default VPC size
  • Class C

    • 192.168.0.0/16: Private network

Ref:

Alt text OSI Layer 3 - Route Tables & Routes

Alt text OSI Layer 3 - Router compares packet destination IP & route table for matching destinations and is forwarded on to the Next Hop/Target. The more specific prefixes are preferred (0 lowest. 32 highest)

Alt text OSI Layer 3 - Packets are routed, hop by hop across the internet. From source to destination.

Layer 3 - Network - PART3 (15:15)

Alt text OSI Layer 3 - Address Resolution Protocol (ARP)

Alt text OSI Layer 3 - IP Routing - Same local network

Alt text OSI Layer 3 - IP Routing - 2 different networks

Alt text OSI Layer 3 - L3 Summary

Layer 4&5 - Transport & Session - PART1 (15:39)

Alt text L3 problems

Alt text TCP & UDP

Alt text TCP Segments

Alt text TCP Header

Layer 4&5 - Transport & Session - PART2 (13:54)

Alt text Transmission Control Protocol (TCP) is a connection based protocol.

Alt text TCP Flags 🏴🏳️

Alt text TCP Connection 3-way Handshake 🤝

Alt text Stateless firewall

Alt text Stateful firewall

Other Networking (MORE COMING SOON)

Network Address Translation (NAT) - PART1 (11:00)

Alt text NAT - Types of NATs

why nat?

  • Overcome IPv4 shortages.
  • Security: hide private IP

Alt text Static NAT - Outbound Traffic

static nat maintains a nat table to map privateip : public ip (1:1)>

👉️ In AWS, Internet Gateway (IGW) is a static NAT.

Alt text Static NAT - Inbound Traffic👉️

Network Address Translation (NAT) - PART2 (9:38)

Alt text Dynamic NAT

dynamic nat maintains a nat table:

  • Dynamic NAT maps PrivateIP : Public IP (1:1 first available).
  • Public IP allocations are temporary allocations from a Public IP Pool, the pool may be out-of-public IPs.

Alt text Port Address Translating (PAT)

pat records the source (private) ip and source port:

  • PAT replaces the source IP with the single Public IP and a public source port
  • The Public IP and public source port are allocated from a pool which allows IP Overloading (many to one)

in aws, nat gateway (natgw) is a pat.

nat vs pat

  • NAT Alt text
  • PAT: is a type of Dynamic NAT Alt text

Ref: https://techdifferences.com/difference-between-nat-and-pat.html

IP Address Space & Subnetting - PART1 (14:37)

Alt text IPv4 Addressing

Alt text IPv4 Address Space

IP Address Space & Subnetting - PART2 (10:32)

Alt text IPv4 - Private Ranges

Alt text IPv4 vs IPv6 Address Space

classless inter-domain routing (cidr)

A method for allocating IP addresses and for IP routing.

CIDR is introduced in 1993 to replace the previous classful network addressing architecture

See Classless Inter-Domain Routing (CIDR) | Wikipedia

subnetting

The process of spitting a larger network into more smaller subnets

Alt text Subnetting and CIDR

Alt text Subnetting - Start and end calculation

Distributed Denial of Service (DDOS) Attacks (14:35)

Alt text DDOS - Overview

ddos types:

  • Layer 7:
    • HTTP Flood
    • DNS Fllod
  • Layer 4:
    • (TCP) SYN Flood

Alt text Without DDOS - Normal App

Alt text DDOS - Application Layer Attack (HTTP Flood)

Alt text DDOS - Protocol Attack (SYN Flood)

Alt text DDOS - Volumetric / Amplification Attack

VLANs, TRUNKS & QinQ (16:14)

Alt text Physical Segment - 1 Switch

Alt text Physical Segment - Multi Switches

Alt text Physical Segment - Connecting Switches

what is vlan?

A way to divide a single physical network into multiple logical networks.

Alt text Frame Tagging - 802.1Q

what does 802.1q do?

802.1Q allows multiple “VIRTUAL LANS (VLANS)” to operate over the same L2 physical network.

Each has a separate broadcast domain and is isolated from all others

Alt text OSI Layer 2 - Frame Tagging - 802.1AD - QinQ

what does 802.1ad do?

802.1AD (QinQ) allows ISPs or carriers to use VLANS across their network, while carrying customer traffic which might also be using multiple VLANs

how does 802.1ad (qinq) work?

It allows multiple VLAN tags to be added to a single Ethernet frame.

Alt text VLAN - Trunk Port vs Access Port

what are trunk port?

Trunk ports are a way to carry VLAN traffic between network switches

Alt text Devices on different VLANs cannot communicate without a Layer 3 Device (Router)

Alt text VLAN - Summary

Decimal to Binary Conversion (IP Addressing) (17:12)

Alt text

Alt text

Alt text

SSL & TLS (11:19)

Alt text

Alt text

See The First Few Milliseconds of an HTTPS Connection

Border Gateway Protocol (BGP) 101 (17:03)

Alt text BGP: Exchange the best path (ASPATH) to a destination

Alt text BGP: AS will advertise all the shortest paths its known to all its peers (and prepends its own ASN onto the path)

aspath prepending: make a path longer

Stateful vs Stateless Firewalls (14:04)

Alt text Connection’s Inbound and Outbound

connection and port

A connection has 2 parts:

  • Request: From an ephemeral port - chosen by the client - (to a well-known port)
  • Response: From the well-known port (to that ephemeral port)

Alt text Inbound and Outbound are depend on perspective

Alt text Stateless Firewall

stateless firewall

A Stateless Firewall

  • examines each individual network packet in isolation
  • makes decisions
    • based on predetermined rules
    • without any awareness of the state of the network connection

stateless firewall and server

When using stateless firewall with a server, you need to:

  • Allow inbound traffic to well-known port, e.g. 443
  • Allow outbound traffic to all ephemeral ports, e.g. 1024, 65535 (randomly chosen by the client)

e.g. AWS Network ACL

Alt text Stateful Firewall

stateful firewall

A stateful firewall

  • tracks the state of the network connections:
    • knows a response corresponding to which request
  • make decisions based on these knowledge:
    • do some of the works for you

👉 If

  • the request (no matter whether it’s inbound or outbound traffic) is allowed
  • the response will be automatically allowed too

e.g. AWS security group

tip

Usually:

  • A stateful firewall is called “firewall”.
  • A stateless firewall is called ACL.

When something is called firewall, it usually means it’s a stateful firewall.

JumboFrames (4:35)

Alt text JumboFrame vs normal frame (OSI Layer 2)

maximum transmission unit (mtu)

  • Traditional Ethernet frames have a MTU of 1500 bytes.
  • Jumbo Frames can allow for frames up to 9000 bytes.

why use jumbo frames

  • Reduce frame overhead
  • Reduce wasted time on medium (between frames)

Alt text Not everything in AWS supports JumboFrames

in aws, which traffic supports jumbo frames?

  • VPC Peering in same region
  • Direct Connect
  • TGW (up to 8500 bytes)

Layer 7 Firewalls (7:44)

Alt text Traditional firewalls, such as packet filtering or stateful inspection firewalls, operate at the network and transport layers and are only capable of filtering traffic based on IP addresses, port numbers, and protocol types.

Alt text In contrast, layer 7 firewalls have the ability to analyze the content of network traffic, including application protocols such as HTTP, FTP, and SMTP, and can make more granular decisions about which traffic should be allowed or blocked.

layer 7 firewall

FeatureTraditional Firewalls (Packet Filtering/Stateful Inspection)Layer 7 Firewalls (Application Firewalls)
Layer of OperationNetwork and Transport Layers (Layer 3 & 4)Application Layer (Layer 7)
Filtering CriteriaIP addresses, Port numbers, Protocol typesApplication data, HTTP/FTP/SMTP, user inputs
Traffic InspectionBasic packet-level inspectionDeep packet inspection of application data
GranularityCoarse-grained (limited to IP, port, protocol)Fine-grained (based on application content)
Protection againstBasic network attacks (IP spoofing, SYN floods)Advanced threats (SQL injection, XSS, malware)
Policy ControlLimited to low-level network policiesApplication-specific policies (e.g., block specific URLs)
PerformanceHigher throughput due to simpler inspectionPotentially slower due to deep inspection
ComplexitySimpler to configure and manageMore complex, requires detailed understanding of applications
Use CaseBasic security for network and transport layersProtection of web and application services
Examples of ApplicationsFirewall rules based on IP, Port, and ProtocolWeb Application Firewall (WAF), API Gateways

See Nord Security - Learning Center

IP Sec VPN Fundamentals (14:48)

Alt text IPSec

what does ip sec do?

IP Sec sets up secure tunnel across insecure networks.

Alt text IP Sec Tunnel

Alt text Asymmetric/Symmetric Encryption

Alt text IP Sec’s 2 main phases

Alt text IP Sec - IKE Phase 1

Alt text IP Sec - IKE Phase 2

Alt text Route-based VPN / Policy-based VPN

Alt text Route-based VPN / Policy-based VPN examples

Fibre Optic Cable 101 (11:21)

Alt text Fibre Optic Cables

Alt text Fibre Optic Cables - Connectors

Alt text Fibre Optic Cables - Core

Alt text Fibre Optic Cables - Cladding

Alt text Fibre Optic Cables - Buffer

Alt text Fibre Optic Cables - Jacket

Alt text Fibre Optic Cables - Single Mode

Alt text Fibre Optic Cables - Multi Mode

Alt text Fibre Optic Transceivers

Security (MORE COMING SOON)

Encryption 101 - PART1 (13:56)

Alt text Encryption 101

Alt text Encryption at Rest

Alt text Encryption in Transit

Alt text Encryption Concepts: Plaintext, Algorithm, Key and Ciphertext

Alt text Symmetric Encryption

Alt text Symmetric Encryption - The same key is used for decryption

Alt text Asymmetric Encryption - Public and Private Key

Alt text Asymmetric Encryption - Key Exchange

Alt text Asymmetric Encryption - Encryption

Alt text Asymmetric Encryption - Decryption

Encryption 101 - PART2 (6:42)

Alt text Alt text Signing

signing

The practice of using asymmetric keys to verify the authenticity and integrity of data.

Alt text Alt text Steganography

steganography

The practice of concealing information within another message or physical object to avoid detection.

Envelope Encryption (8:06)

Alt text Enveloper Encryption: KEK, DEKs

Alt text Enveloper Encryption - Decryption

Alt text Enveloper Encryption - Considerations

Hardware Security Modules (HSMs) (6:40)

Alt text HSM - Without HSM

Alt text HSM - With HSM

Alt text HSM - Keys are stored securely inside the HSM

Alt text HSM - Authenticate takes place inside the HSM

Alt text HSM - HSMs are tamper proof & hardened against physical logical attacks

Alt text HSM - Accessed via tightly controlled, industry standard APIs

Alt text HSM - Role Separation: HSM admins can update & maintain but don’t always have full access

Alt text HSM - HSM can be used to processing SSL/TLS or PKI Signing certificate

Hash Functions & Hashing (13:19)

Alt text Hashing

hashing

The process of applying a hash function to data to produce a unique and irreversible representation of the original data.

Alt text Hash Function

hash function

Mathematical algorithms that transform input data into a fixed-length string of characters, called a hash or message digest.

Alt text Hashing is 1 way.

Alt text Hashing Example - Raw Password

Alt text Hashing Example - Hashed Password

Alt text Hashing Collision

Alt text Hashing Summary

Digital Signatures (9:26)

Alt text Public Key Cryptography

Alt text Digital Signatures verifies:

  • Integrity (WHAT is sent) 👈 by compare the hash of data
  • Authenticity (WHO sent it) 👈 by using the public key to very the signature

Alt text

DNS & DNSSEC

DNS #1 - What does DNS do (2:56)

Alt text DNS translates human readable domain names (e.g. www.amazon.com) to machine readable IP addresses (e.g. 192.0.2.44)

DNS #2 - Why does DNS need a complex architecture (13:19)

Alt text Why not ONE server?

Alt text DNS Terms

Alt text DNS Hierarchical Design

DNS #3 - How DNS actually works … walking the tree (8:46)

Alt text The job of DNS is help us get the DNS records we need.

Alt text DNS - Walking the tree

Alt text DNS - Walking the tree - Behind the scene

DNS #4 - What happens when a domain is registered? (4:27)

Alt text Domain Registrar - DNS Hosting Provider - TLD Registry

Alt text Registering a domain

DNSSEC #1 - Why do we need DNSSEC (11:08)

Alt text DNSSEC Benefits ~ Digital Signature for DNS Records

Alt text DNSSEC is an extension to DNS. It adds, and doesn’t replace DNS.

Alt text DNSSEC Benefit Example

Alt text DNS Disrupted

alt text Example: Use dig to query A record for example.com

alt text Example: Use dig to query A record and DNSSEC for example.com

note

To verify DNSSEC of a domain, you can use:

  • dig: if there’s the flag ad
  • delv
  • Web Tools: DNS Viz, DNSSEC Debugger

See

DNSSEC #2 - How DNSSEC Works within a Zone (17:34)

Alt text DNSSEC - RRSET

what is a rrset?

A group of all the records with the same type ad same name

Alt text DNSSEC - RRSIG & Zone Signing Key (ZSK)

what is a rrsig?

A digital signature for a RRSET, signed by the private Zone Signing Key (ZSK).

what is zone signing key (zsk)?

Each zone has a ZSK, which is used to:

  • sign 👈 the private ZSK
  • verify 👈 the public ZSK

the RRSETs.

Alt text DNSSEC - DNSKEY contains public ZSK to verify all RRSIGs in the zone

why the dnskey also has an rrsig?

Because someone can fake the DNSKEY too. 🤯

Alt text DNSSEC - 2 Keys - Key Signing Key

what is a ksk?

KSK is used to sign and verify the ZSK

why do we use separate zone-signing keys and key-signing keys?

The KSK is linked to the parent zone.

If we use a single key, changes to the ZSK would requires parent zone changes. 🐌🆘

By using 2 keys, we can change the ZSK as quired, without impacting parent zone. 🤳

Alt text DNSSEC - Summary

DNSSEC #3 - DNSSEC Chain of Trust (8:16)

Alt text DNSSEC - DS Record

what is ds record?

DS (Delegation Signer) Record, on a parent zone, contains a hash of the KSK in a child zone.

Alt text DNSSEC - Validation Flow

DNSSEC #4 - DNSSEC Root Signing Ceremony (7:53)

Alt text DNSSEC - Root KSK Private

Alt text DNSSEC - Root KSK Public

Alt text DNSSEC - The TRUST Anchor (Root KSK)

Alt text DNSSEC - The Signing Ceremony

Alt text DNSSEC - Key Ceremony

See The Key to the Internet and Key Ceremonies: An Explainer | ICANN

Containers & Virtualization (MORE COMING SOON)

Kubernetes 101 (11:27)

Alt text K8s - Cluster Structure

what is the basic structure of a k8s cluster?

A K8s cluster contains:

  • Control Plane
  • Worker Nodes

what is the control plane in k8s?

The control plane manages the overall state of the cluster

what is a worker node in k8s?

A worker node is the machine that actually run the containers

what are the core components of a worker node?

  • kubelet

    • Ensures that Pods are running, including their containers.
  • Container runtime

    • Software responsible for running containers.
  • kube-proxy (optional)

    • Maintains network rules on nodes to implement Services.

what is the core component of control plane?

The core of Kubernetes’ control plane is

  • the API server
  • the HTTP API that it exposes, which is known as the Kubernetes API.

what does the kubernetes api do?

The Kubernetes API

  • lets end users, different parts of your cluster, and external components communicate with one another.
  • let you query and manipulate the state of API objects in Kubernetes (for example: Pods, Namespaces, ConfigMaps, and Events).

Alt text K8s - Cluster Detail

what is a `pod` in k8s?

In Kubernetes, a pod is the smallest unit of computing.

  • In Docker, it’s the container.

what are the components of the control plane in k8s?

  • kube-apiserver: The core component server that exposes the Kubernetes HTTP API
  • etcd: Consistent and highly-available key value store for all API server data
  • kube-scheduler: Looks for Pods not yet bound to a node, and assigns each Pod to a suitable node.
  • kube-controller-manager: Core control loops of K8s: Runs controllers to implement Kubernetes API behavior.
  • cloud-controller-manager (Optional): Integrates with underlying cloud provider(s).(AWS, Azure, GCP)

what is `kube-controller-manager`?

kube-controller-manager is the core control loops of K8s

  • Watches the shared state of the cluster through the apiserver
  • Makes changes attempting to move the current state towards the desired state

Alt text K8s - Summary

See Kubernetes Components | Kubernetes Documentation

Backups & DR (MORE COMING SOON)

Recovery Point Objective (RPO) & Recovery Time Objective (RTO) (16:54)

Alt text Recovery Point Objective (RPO)

what is rpo?

Recovery Point Objective (RPO) is the maximum (amount of) data (in time) can be lost.

Alt text Recovery Time Objective (RTO)

what is rto?

Recovery Time Objective (RTO) is the maximum of time that the system can be down.

when does rto begin and end?

RTO

  • begins at at momne of failure
  • ends when the system is operational (and handled back to business)

what need to be cautious about rto?

  • How long until we know there is an issue?
  • What is the issue?
  • Do we need to restore a backup? How to restore the backup?

Alt text RPO & RTO - Summary

Data Formats & Configuration Formats (MORE COMING SOON)

YAML aint markup language (YAML) 101 (6:12)

Alt text A YAML document is an “unordered list” of key:value pairs.

tip

In YAML, an “unordered list” is called a dictionary

Alt text YAML - Ordered list

tip

In YAML, an “ordered list” is called sequence, which can contains values of different types.

Alt text YAML - Structure

Javascript Object Notation (JSON) 101 (4:25)

Alt text JSON - Introduction

Alt text JSON - Object & List

Alt text JSON - Nested Object