Othmane Moutaouakkil
LinkedInGitHub
  • Introduction
  • OSCP Journey
    • HTB
      • HTB Linux Boxes
      • HTB Windows Boxes
  • Write-Ups
    • TCM Security
      • Practical Ethical Hacking
        • Networking Refresher
        • The Ethical Hacker Methodology
        • Information Gathering (Reconnaissance)
        • Scanning & Enumeration
        • Vulnerability Scanning with Nessus
        • Exploitation Basics
        • New Capstone
        • Active Directory (AD)
          • AD Overview
          • AD Lab Build
          • Attacking AD: Initial Attack Vectors
          • Attacking AD: Post-Compromise Enumeration
          • Attacking AD: Post-Compromise Attacks
          • We've Compromised the Domain - Now What?
          • Additional AD Attacks
          • AD Case Studies
        • Post Exploitation
        • Web Application Enumeration, Revisited
        • Find & Exploit Common Web Vulnerabilities
        • Wireless Penetration Testing
        • Legal Documents and Report Writing
      • Open-Source Intelligence (OSINT)
    • Hacking Challenges
      • OTW
        • Bandit
          • Level 0
          • Level 0 → 1
          • Level 1 → 2
          • Level 2 → 3
          • Level 3 → 4
          • Level 4 → 5
          • Level 5 → 6
          • Level 6 → 7
          • Level 7 → 8
          • Level 8 → 9
          • Level 9 → 10
          • Level 10 → 11
          • Level 11 → 12
          • Level 12 → 13
          • Level 13 → 14
          • Level 14 → 15
          • Level 15 → 16
          • Level 16 → 17
          • Level 17 → 18
          • Level 18 → 19
        • Natas
        • Leviathan
        • Krypton
        • Narnia
        • Behemoth
        • Utumno
        • Maze
        • Vortex
        • Manpage
        • Drifter
        • FormulaOne
      • THM
  • Research
  • Resume
Powered by GitBook
On this page
  • Introduction
  • IP Addresses
  • MAC Addresses
  • TCP, UDP, and the Three-Way Handshake
  • Common Ports and Protocols
  • The OSI Model
  • Subnetting

Was this helpful?

  1. Write-Ups
  2. TCM Security
  3. Practical Ethical Hacking

Networking Refresher

Introduction

  • IP Addresses

  • MAC Addresses

  • TCP, UDP, and the Three-Way Handshake

  • Common Ports and Protocols

  • The OSI Model

  • Subnetting

IP Addresses

Layer 3 - Network

IP (Internet Protocol) addresses, IPv4 and IPv6 - core internet addressing protocols, operating on layer 3 of OSI model.

  • IPv4: 192.168.0.1 - decimal notation

    • 4 octets of 8 bits = 32 bits

    • Total IPv4 addresses:

232=4,294,967,2962^{32} = 4,294,967,296232=4,294,967,296
  • IPv6: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 - hexadecimal notation

    • 8 groups of 16 bits = 128 bits

    • Total IPv6 addresses:

2128≈3.4×10382^{128} ≈ 3.4 × 10^{38}2128≈3.4×1038

Key IPv6 improvements:

  • Enhanced security

  • Simplified network configuration

  • More efficient routing

Transition challenges:

  • IPv4 and IPv6 not directly compatible

  • Ongoing global shift from IPv4 to IPv6

  • Critical for sustaining internet growth and accommodating future devices

Displays the network interface configuration and status:

ifconfig
ipconfig

MAC Addresses

Layer 2 - Data Link

MAC (Media Access Control) address - unique identifier assigned to network interface controllers (NICs) of network devices.

  • MAC Address: 00:1A:2B:3C:4D:5E - hexadecimal notation

    • 6 pairs of hexadecimal digits = 48 bits:

      • First 3 pairs: Manufacturer identifier

      • Last 3 pairs: Unique device identifier

TCP, UDP, and the Three-Way Handshake

Layer 4 - Transport

TCP (Transmission Control Protocol) and UPD (User Datagram Protocol) - transport layer protocols in computer networks.

  • TCP:

    • Connection-oriented

    • Reliable, ordered, error-checked delivery

    • Uses acknowledgment, retransmission, and flow control

    • Breaks data into packets with sequence numbers

    • Suitable for: web browsing, email, file transfer, remote login

  • UDP:

    • Connectionless

    • Simpler and lightweight

    • No guaranteed delivery or packet order

    • Suitable for: streaming media, online gaming, DNS, VoIP

Three-Way Handshake - establishes TCP connections:

  1. SYN: Client sends SYN packet with initial sequence number

  2. SYN-ACK: Server responds with SYN-ACK packet, own sequence number

  3. ACK: Client acknowledges with ACK packet, incremented sequence number

Capture Packet Data using Wireshark:

wireshark&

Common Ports and Protocols

TCP Protocols:

Protocol
Port

FTP (File Transfer Protocol)

21

SSH (Secure Shell)

22

Telnet

23

SMTP (Simple Mail Transfer Protocol)

25

HTTP (Hypertext Transfer Protocol)

80

HTTPS (Hypertext Transfer Protocol Secure)

443

POP3 (Post Office Protocol version 3)

110

IMAP (Internet Message Access Protocol)

143

RDP (Remote Desktop Protocol)

3389

SMB (Server Message Block)

445

FTPS (FTP over SSL/TLS)

990

MySQL

3306

UDP Protocols:

Protocol
Port

DHCP (Dynamic Host Configuration Protocol)

67, 68

SNMP (Simple Network Management Protocol)

161

NTP (Network Time Protocol)

123

TFTP (Trivial File Transfer Protocol)

69

Protocols using both TCP and UDP:

Protocol
Port

DNS (Domain Name System)

53

LDAP (Lightweight Directory Access Protocol)

389

The OSI Model

OSI (Open Systems Interconnection) model - conceptual framework standardizing communication system functions into seven distinct layers.

key aspects:

  • Separates complex network communication into manageable layers

  • Facilitates interoperability and troubleshooting

  • Conceptual model, not always reflecting exact implementations

  • Useful reference for understanding network communication

Subnetting

Subnetting - Process of dividing a network into smaller subnetworks

CIDR (Classless Inter-Domain Routing) - Method to represent IP addresses and subnet masks

Concepts:

  • Borrows bits from host portion to create subnet identifier

  • Allows efficient use of IP addresses

  • Facilitates network management and routing

CIDR Notation:

  • Format: IP address/prefix length

  • Example: 192.168.0.0/24

    • First 24 bits: Network portion

    • Remaining 8 bits: Host portion

Subnetting example:

Original Network
192.168.0.0/24

Subnet Mask

255.255.255.0

Subnetting (borrowing 2 bits):

Subnet
Network Range
CIDR Notation

1

192.168.0.0 - 192.168.0.63

192.168.0.0/26

2

192.168.0.64 - 192.168.0.127

192.168.0.64/26

3

192.168.0.128 - 192.168.0.191

192.168.0.128/26

4

192.168.0.192 - 192.168.0.255

192.168.0.192/26

New Subnet Mask: 255.255.255.192

Benefits:

  • Flexible network boundaries

  • Efficient address allocation

  • Enhanced network organization

Subnetting Sheet:

Bits Sheet:

How to calculate the Subnet:

PreviousPractical Ethical HackingNextThe Ethical Hacker Methodology

Last updated 7 months ago

Was this helpful?

Lookup devices using the first 3 pairs:

https://www.macvendorlookup.com
Source: The Cyber Mentor
Source: The Cyber Mentor
Private IP Address
Check the Vendor details using the first 3 pairs: https://www.macvendorlookup.com
wireshark&
The OSI model
Subnetting Sheet
Bits Sheet
How to calculate the Subnet