What is an IP Address?
WE FOUND YOU, π
π What is an IP Address?
π‘An IP address (Internet Protocol address) is a unique number assigned to every device on a network so it can: Identify itself, and communicate with other devices.
Think of it like a phone number β it tells other devices where to reach you.
π§© IP Address Format
There are two versions of IP addresses:
1οΈβ£ IPv4
It has 4 numbers (called octets), each ranging from 0 to 255, separated by dots.
xxx.xxx.xxx.xxx
For example:
192.168.1.1
.Total possible addresses: ~4.3 billion.
Most commonly used.
2οΈβ£ IPv6
It has 8 octets, but more accurately, they are made up of 8 groups of 16-bit blocks, so they are often referred to as hextets instead of octets.
It is a 128-bit format (long hexadecimal), split into 8 blocks (hextets) of 16 bits each. Each block is represented as 4 hexadecimal digits.
For example:
2001:0db8:85a3:0000:0000:8a2e:0370:7334
Total possible addresses: 340 undecillion.
Designed to solve IPv4 address exhaustion.
π Private vs Public IP Addresses
There are 2 types of IP Addresses: Private IP and Public IP.
Private
Inside your home or business LAN
β No
192.168.1.1, 10.0.0.5
Public
On the internet (e.g., websites)
β Yes
8.8.8.8, 172.217.160.78
Private IP Ranges
192.168.0.0 β 192.168.255.255
65,536
172.16.0.0 β 172.31.255.255
1,048,576
10.0.0.0 β 10.255.255.255
16,777,216
π§ How do Devices Talk to Each Other?
π οΈ MAC Address
π‘A MAC address is a unique identifier assigned to a network interface card (NIC) β hardware in your device that connects to a network (Ethernet or Wi-Fi).
It's like the fingerprint of your device on a local network, used to identify and communicate between devices in the same network.
A MAC address is:
48 bits long
Usually written in 6 pairs of hexadecimal digits (8 bits each)
Example:
44:F2:1B:83:11:7A
or44-F2-1B-83-11-7A
44:F2:1B
: It is an OUI (Organizationally Unique Identifier), which identifies the manufacturer83:11:7A
: It is the NIC Specific Part, which is unique to the device/network card
πΆ Where MAC Addresses are Used
Data Link Layer (Layer 2) of the OSI model
Switches use MAC to forward traffic within LANs
Wi-Fi routers use MAC filtering for security
ARP (Address Resolution Protocol) maps IP βοΈ MAC
π MAC Address Filtering
Wi-Fi routers can use MAC filtering to:
Allow only specific devices to connect
Block unwanted devices
However, MAC spoofing exists β attackers can fake MAC addresses, so it's not a strong security measure on its own.
βοΈ Can You Change a MAC Address?
Yes, it's called MAC spoofing, and can be done via software:
Useful for privacy/anonymity
Often used in penetration testing
Example:
ifconfig eth0 hw ether 00:11:22:33:44:55
β It temporarily changes the MAC address of the eth0 interface to 00:11:22:33:44:55. This change is temporary β it will reset after reboot unless automated with scripts or set in system config.
π ARP (Address Resolution Protocol)
When one device wants to talk to another:
It sends an ARP Request: βHey, who has IP 192.168.1.22?β
That device replies: βThatβs me! My MAC address is 44:F2:1B:83:11:7A.β
Now the sender knows exactly where to send the data.
π The device saves this info in the ARP Cache, so it doesnβt have to ask every time.

π What if the Other Device Is on the Internet?
Your device sends the request to the default gateway (your router).
The router:
Translates your private IP to its public IP using NAT (Network Address Translation).
Sends the request across the internet.
The remote device replies to your routerβs public IP, and the router sends it back to your private IP.

βοΈ How You Get an IP Address: DHCP
When your device joins a network (Wi-Fi or Ethernet), it gets:
An IP address
A Subnet Mask
A Gateway Address (usually your router)
A DNS Server (weβll cover this in the next lesson)
This is handled automatically by DHCP (Dynamic Host Configuration Protocol), which is built into most routers.
π‘ What is DHCP?
π‘DHCP (Dynamic Host Configuration Protocol) is a network protocol that automatically assigns IP configuration settings to devices (clients) when they connect to a network.
Built into most routers and network servers.
Eliminates the need to configure IP addresses manually.
π§ What Does DHCP Provide?
When a device (client) joins a network (e.g., via Wi-Fi or Ethernet), DHCP provides:
π IP Address β Unique identifier for the device on the network.
π§© Subnet Mask β Defines the network and host portion of the IP address.
πͺ Default Gateway β Typically your router; it's the "exit" point to other networks, including the internet.
π DNS Server β Translates domain names (like
google.com
) to IP addresses (we'll cover DNS separately).
π How DHCP Works (The 4-Step DORA Process)
DHCP uses a 4-step DORA process to assign an IP address
D β Discover: The client broadcasts a DHCPDISCOVER message to find available DHCP servers.
O β Offer: A DHCP server responds with a DHCPOFFER message, suggesting an IP address and other settings.
R β Request: The client replies with a DHCPREQUEST to accept the offered configuration.
A β Acknowledge: The server finalizes the process with a DHCPACK message, confirming the IP assignment.
β π Result: The device is now configured to communicate on the network!
π IP Lease Time
π‘DHCP doesnβt assign IPs permanentlyβit gives them out for a limited time.
This period is called a lease (e.g., 24 hours).
Before the lease expires, the client must renew it with the server to keep the address.
If not renewed, the address returns to the pool and may be reassigned.
π§ DHCP Server Location
We could find the DHCP server in 2 common locations:
π Home networks: The router usually acts as the DHCP server.
π’ Enterprise networks: A dedicated DHCP server (e.g., Windows Server or Linux service) handles IP assignments.
π§° Static vs. Dynamic IP
π Dynamic IP
Assigned automatically by DHCP.
Lease-based: can change over time.
Efficient for managing many clients.
Pro: Simplifies network management in large environments.
Con: IP addresses may change, making it hard to track devices over time.
Use cases:
Personal devices: laptops, smartphones, tablets.
Guest or temporary network access.
π Static IP
Set manually and remains fixed. Does not expire or change unless reconfigured.
Easier to locate on a network.
No DHCP involvement after setup.
Pros: Consistent address, which is ideal for devices that must always be reachable at a known IP.
Con: Requires manual configuration and IP conflict management.
Use cases:
Servers (web, database, DNS).
Networked printers, IP cameras.
Infrastructure devices (routers, switches).
π Dynamic IP
Automatically assigned by DHCP. Can change over time.
Laptops, phones, tablets, etc.
π Static IP
Manually set and never changes.
Servers, printers, network gear.
βοΈ When to Use What?
Personal/home devices
π Dynamic IP
Web or file servers
π Static IP
Printers in an office
π Static IP
IoT devices with temporary use
π Dynamic IP
Remote access to internal services
π Static IP
π‘οΈ DHCP Security Considerations
π¨ Problem: Rogue DHCP Servers
Unauthorized devices (e.g., an attackerβs laptop) may run a fake DHCP server.
This can assign malicious settings (wrong DNS, gateway, etc.).
Leads to Man-in-the-Middle (MitM) attacks or network disruption.
π Solutions
π 1. DHCP Snooping
A network switch feature that is used to validate DHCP messages.
Only trusted ports (e.g., the one connected to the real DHCP server) can send DHCP responses.
It blocks rogue servers from assigning IPs.
π§Ύ 2. Trusted Server Configuration
Configure network devices to trust only certain DHCP servers.
Some firewalls and routers allow DHCP server whitelisting.
Ensures clients ignore unauthorized offers.
π§ββοΈ 3. Client Hardening
Manually set static IPs for critical devices.
Disable DHCP where appropriate (e.g., on servers).
Combine with a firewall and MAC filtering.
β
Summary
IP addresses identify devices on a network.
IPv4 addresses look like
192.168.0.1
.IPv6 addresses look like
2001:0db8:85a3:0000:0000:8a2e:0370:7334
.Private IPs stay in your local network, and public IPs can be accessed over the internet.
MAC addresses are used to identify and communicate between devices in the same network.
Devices use ARP to find each otherβs MAC addresses.
Routers use NAT to translate between private and public IPs.
DHCP handles the automatic setup of these settings.
Last updated