IP Address
An IP address (Internet Protocol address) is a logical address assigned to a network interface so that devices can communicate across IP networks.
Simple definition
An IP address is a logical network address used to identify a network interface and help deliver packets to the correct network and host.
Example:
192.168.1.10
or IPv6:
2001:db8::10
1. Why Do We Need IP Addresses?
Imagine a college network:
Router │ ┌──────────┼──────────┐ │ │ │ PC 1 PC 2 Server
Each device needs an address so that packets can be delivered to the appropriate destination.
For example:
PC 1 → 192.168.1.10 PC 2 → 192.168.1.11 Server → 192.168.1.20 Router → 192.168.1.1
Now PC1 can send an IP packet to the server:
192.168.1.10 ↓ 192.168.1.20
2. IP Address Works at Layer 3
In the OSI model:
IP operates at Layer 3 — Network Layer.
In the TCP/IP model:
IP belongs to the Internet Layer.
OSI TCP/IP Layer 7 ─┐ Layer 6 │ Layer 5 ─┤ Application Layer 4 ───→ Transport Layer 3 ───→ Internet ← IP Layer 2 ─┐ Layer 1 ─┴──→ Network Access
So remember:
MAC → Layer 2 IP → Layer 3 Port → Layer 4
3. Two Major Versions of IP
There are two major versions:
IPv4 IPv6
4. IPv4
IPv4 stands for:
Internet Protocol version 4
IPv4 uses a 32-bit address.
Example:
192.168.1.10
It contains four decimal numbers called octets.
192 . 168 . 1 . 10 │ │ │ │ 8 8 8 8 bits
Therefore:
8 + 8 + 8 + 8 = 32 bits
5. IPv4 Binary Representation
Each octet contains 8 bits.
For example:
192.168.1.10
can be represented as:
11000000.10101000.00000001.00001010
Each octet can contain values from:
0 → 255
Therefore the theoretical IPv4 address space contains:
2³² = 4,294,967,296
addresses.
Not all of these are usable as ordinary host addresses because some ranges have special purposes.
6. IPv6
IPv6 stands for:
Internet Protocol version 6
IPv6 uses 128-bit addresses.
Example:
2001:db8:1234:5678::10
IPv6 uses hexadecimal notation.
Example:
2001:0db8:0000:0000:0000:0000:0000:0010
can be shortened to:
2001:db8::10
IPv6 provides a vastly larger address space:
2¹²⁸
possible addresses.
7. IPv4 vs IPv6
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address size | 32-bit | 128-bit |
| Example | 192.168.1.10 | 2001:db8::10 |
| Notation | Decimal | Hexadecimal |
| Address space | ~4.3 billion | ~3.4 × 10³⁸ |
| Broadcast | Supported | No traditional broadcast |
| Neighbor discovery | ARP | ICMPv6 Neighbor Discovery |
| Header | Variable length | Fixed base header |
| NAT | Common | Generally less necessary |
8. Public IP Address
A public IP address is an address that can be used for communication across the public Internet, subject to routing and network configuration.
For example:
Internet │ ↓ Public IP │ ↓ Router
A website/server may have a public IP address such as:
203.0.113.10
The address above is from a documentation range, not a normal Internet host.
9. Private IP Address
Private IPv4 addresses are intended for use inside private networks.
The three main private IPv4 ranges are:
| Range | CIDR |
|---|---|
10.0.0.0 – 10.255.255.255 | 10.0.0.0/8 |
172.16.0.0 – 172.31.255.255 | 172.16.0.0/12 |
192.168.0.0 – 192.168.255.255 | 192.168.0.0/16 |
Example:
Laptop → 192.168.1.10 Phone → 192.168.1.11 Printer → 192.168.1.20 Router → 192.168.1.1
These addresses are not directly routed across the public Internet.
10. Private Network Example
A home network might look like:
Internet │ │ Public IP │ Router 192.168.1.1 │ ┌──────────┼──────────┐ │ │ │ Laptop Phone Printer 192.168.1.10 .11 .20
The router commonly performs NAT when private IPv4 devices access the Internet.
11. NAT
NAT stands for:
Network Address Translation
It allows a router/firewall to translate between private and public addresses.
Example:
Laptop 192.168.1.10 │ ↓ Router │ ↓ Public IP │ ↓ Internet
For example:
Private: 192.168.1.10:51520 ↓ NAT Public: 203.0.113.50:40001
This is a simplified example.
NAT is extremely common in IPv4 networks.
12. Static IP Address
A static IP address is manually configured or deliberately assigned so that it remains stable.
Example:
Server: 192.168.1.100
It may be useful for:
- Servers
- Printers
- Network devices
- Infrastructure
- Security cameras
13. Dynamic IP Address
A dynamic IP address is assigned automatically, commonly using DHCP in IPv4 networks.
Example:
Laptop ↓ DHCP ↓ 192.168.1.25
Later, the device may receive a different address depending on the DHCP configuration and lease.
14. Static vs Dynamic IP
| Static | Dynamic |
|---|---|
| Stable/manual or reserved assignment | Automatically assigned |
| Useful for servers | Common for normal clients |
| Easier to predict | Can change |
| Requires configuration/management | DHCP simplifies management |
15. Loopback Address
A loopback address allows a computer to communicate with itself.
For IPv4:
127.0.0.1
The entire:
127.0.0.0/8
range is reserved for loopback use.
The most commonly used address is:
127.0.0.1
It is often called:
localhost
Example:
http://127.0.0.1:3000
This means the service is being accessed on the same computer.
For IPv6:
::1
16. APIPA / Link-Local IPv4
If a Windows device cannot obtain an IPv4 address from DHCP, it may automatically configure an address from:
169.254.0.0/16
These are IPv4 link-local addresses.
Example:
169.254.20.15
Such an address generally indicates local-link communication rather than normal Internet connectivity.
17. IPv6 Link-Local Address
IPv6 interfaces commonly have a link-local address from:
fe80::/10
Example:
fe80::a4b5:12ff:fe34:5678
IPv6 link-local addresses are important for communication on the local link and for Neighbor Discovery.
18. Subnet Mask
A subnet mask tells us which portion of an IPv4 address represents the network and which portion represents the host.
Example:
IP Address: 192.168.1.10 Subnet Mask: 255.255.255.0
This is commonly written as:
192.168.1.10/24
19. CIDR
CIDR stands for:
Classless Inter-Domain Routing
Instead of writing:
192.168.1.10 255.255.255.0
we can write:
192.168.1.10/24
The /24 means:
24 bits = network prefix 8 bits = remaining host portion
Conceptually:
192.168.1 | 10 Network | Host
20. Common CIDR Examples
| CIDR | Subnet Mask | Addresses |
|---|---|---|
/8 | 255.0.0.0 | 16,777,216 |
/16 | 255.255.0.0 | 65,536 |
/24 | 255.255.255.0 | 256 |
/25 | 255.255.255.128 | 128 |
/26 | 255.255.255.192 | 64 |
/27 | 255.255.255.224 | 32 |
/28 | 255.255.255.240 | 16 |
/30 | 255.255.255.252 | 4 |
These counts are total addresses; some addresses in traditional IPv4 subnets have special purposes.
21. Network Address
Consider:
192.168.1.10/24
The network is:
192.168.1.0/24
So:
Network: 192.168.1.0
This identifies the subnet itself.
22. Broadcast Address
For:
192.168.1.0/24
the IPv4 broadcast address is:
192.168.1.255
It is used to send a packet to all hosts in that IPv4 subnet.
So traditionally:
Network: 192.168.1.0 Usable host range: 192.168.1.1 ↓ 192.168.1.254 Broadcast: 192.168.1.255
23. Default Gateway
The default gateway is the router a host uses to reach destinations outside its local subnet.
Example:
Laptop IP: 192.168.1.10 Mask: 255.255.255.0 Gateway: 192.168.1.1
If the destination is outside:
192.168.1.0/24
the laptop normally sends the packet to the gateway.
Laptop 192.168.1.10 │ ↓ Gateway 192.168.1.1 │ ↓ Other Network │ ↓ Internet
24. IP Address and MAC Address
This is one of the most important concepts.
Suppose:
PC: IP = 192.168.1.10 MAC = AA:AA:AA:AA:AA:10
Router:
IP = 192.168.1.1 MAC = BB:BB:BB:BB:BB:01
The PC wants to access a server on the Internet.
The packet might contain:
Source IP: 192.168.1.10 Destination IP: Server's IP
But the local Ethernet/Wi-Fi frame is sent toward the router:
Source MAC: AA:AA:AA:AA:AA:10 Destination MAC: BB:BB:BB:BB:BB:01
So:
IP handles logical addressing/routing, while MAC handles local link delivery.
25. IP Address and Port
An IP address identifies the network destination, while a port identifies a transport-layer endpoint/service.
Example:
192.168.1.10:443
means:
IP Address → 192.168.1.10 Port → 443
A connection can be represented by:
Client IP:Client Port ↓ Server IP:Server Port
For example:
192.168.1.10:51520 ↓ 142.250.x.x:443
26. IPv4 Address Classes
Older networking education often teaches:
Class A Class B Class C Class D Class E
Historically:
| Class | First Octet | Traditional Purpose |
|---|---|---|
| A | 1–126 | Large networks |
| B | 128–191 | Medium networks |
| C | 192–223 | Smaller networks |
| D | 224–239 | Multicast |
| E | 240–255 | Experimental/reserved |
However:
Modern IP networking uses CIDR rather than the old classful A/B/C system for normal address allocation and routing.
You should know classes for exams if your syllabus includes them, but use CIDR when thinking about modern networking.
27. Special IPv4 Addresses
Important ranges include:
| Range/Address | Purpose |
|---|---|
0.0.0.0 | Unspecified / special-use |
127.0.0.0/8 | Loopback |
169.254.0.0/16 | IPv4 link-local |
10.0.0.0/8 | Private |
172.16.0.0/12 | Private |
192.168.0.0/16 | Private |
224.0.0.0/4 | Multicast |
28. Public IP vs Private IP
Internet │ Public IP │ Router │ ┌──────────┼──────────┐ ↓ ↓ ↓ Private Private Private 192.168... 192.168... 192.168...
Private IP addresses allow devices to communicate inside a private network.
The router can use NAT for Internet connectivity.
29. How to Check Your IP Address
Linux
Run:
ip addr
or:
ip a
Example:
inet 192.168.1.10/24
To see routing information:
ip route
Example:
default via 192.168.1.1
Windows
Use:
ipconfig
For detailed information:
ipconfig /all
30. Finding Your Public IP
Your local computer might have:
192.168.1.10
while your router has a public IP assigned by the ISP.
Conceptually:
PC 192.168.1.10 ↓ Router Public IP ↓ Internet
So:
Your private/local IP and your public Internet-facing IP can be different.
31. IP Address Example
Suppose a college network uses:
Network: 192.168.10.0/24
Devices could be:
Router: 192.168.10.1 Teacher PC: 192.168.10.10 Student PC: 192.168.10.20 Server: 192.168.10.100 Printer: 192.168.10.200
The subnet:
192.168.10.0/24
contains:
Network: 192.168.10.0 Typical host range: 192.168.10.1 – 192.168.10.254 Broadcast: 192.168.10.255
32. IP Address in Networking Communication
A simplified packet:
┌──────────────────────────────┐ │ Source IP │ │ 192.168.1.10 │ ├──────────────────────────────┤ │ Destination IP │ │ 8.8.8.8 │ ├──────────────────────────────┤ │ Transport Header │ ├──────────────────────────────┤ │ Application Data │ └──────────────────────────────┘
The router examines the destination IP and uses its routing table to determine where the packet should go.
33. Routing
Suppose:
PC 192.168.1.10 │ ↓ Router A │ ↓ Router B │ ↓ Server 203.0.113.10
The packet travels through multiple networks.
Conceptually:
Source IP 192.168.1.10 ↓ Destination IP 203.0.113.10
Routers forward the packet toward the destination.
The Layer-2 frame used to carry that packet can be different on each link.
34. Important: IP Does Not Guarantee Delivery
IP is fundamentally a best-effort packet delivery protocol.
It does not itself guarantee:
- Delivery
- Ordering
- Retransmission
Reliability can be provided by higher-level protocols such as TCP.
For example:
Application ↓ TCP ↓ IP
TCP handles reliability while IP handles packet addressing and forwarding.
35. IP Address vs MAC Address vs Port
Remember this table:
| Layer | Address/Identifier | Example | Purpose |
|---|---|---|---|
| Layer 2 | MAC | AA:BB:CC:DD:EE:FF | Local link |
| Layer 3 | IP | 192.168.1.10 | Logical addressing/routing |
| Layer 4 | Port | 443 | Application/service endpoint |
Simple memory:
MAC → Local IP → Network Port → Application
36. Cybersecurity Perspective
IP addresses are extremely important in cybersecurity.
For example, when performing authorized network reconnaissance, you may identify:
192.168.1.10 192.168.1.20 192.168.1.30
Then you may determine which services are exposed:
192.168.1.20 │ ├── 22/tcp → SSH ├── 80/tcp → HTTP └── 443/tcp → HTTPS
An IP address alone does not tell you that a machine is vulnerable.
It identifies a network endpoint; further authorized assessment is needed to understand services and security.
37. Important IPv6 Concepts
IPv6 introduces several important concepts.
Global Unicast
Generally used for globally routable IPv6 addresses.
Example:
2001:db8::10
Link-Local
fe80::/10
Used for communication on the local link.
Multicast
IPv6 heavily uses multicast.
IPv6 does not use traditional broadcast.
Loopback
::1
Equivalent conceptually to IPv4:
127.0.0.1
38. IP Address — Quick Revision
IP ADDRESS │ ┌────────────┴────────────┐ ↓ ↓ IPv4 IPv6 │ │ 32-bit 128-bit │ │ 192.168.1.10 2001:db8::10
IPv4 important concepts
Private Public Static Dynamic Loopback Link-local Subnet Subnet mask CIDR Default gateway Broadcast Multicast NAT
Most important examples
192.168.1.10 → Private IPv4 10.0.0.10 → Private IPv4 172.16.0.10 → Private IPv4 127.0.0.1 → IPv4 loopback 169.254.1.10 → IPv4 link-local ::1 → IPv6 loopback fe80::/10 → IPv6 link-local
Final Concept
Think of a network like a postal system:
MAC Address ↓ Which device/interface on this local link? IP Address ↓ Which network/host should the packet reach? Port Number ↓ Which application/service should receive it?
For example:
MAC AA:BB:CC:DD:EE:FF ↓ IP 192.168.1.10 ↓ Port 443 ↓ HTTPS application
So the three key networking identifiers are:
MAC → local/link communication
IP → logical addressing and routing
Port → application/service endpoint