Host Address Bits in IP 192.168.1.25
Host Address Bits in IP 192.168.1.25
MAC addresses are fixed and unique only at the hardware (local network) level.
Problem:
IP Address – Solution:
IP addresses are logical and hierarchical — they represent both the network and the
host.
Routers use IP addresses to forward packets across multiple networks (WANs,
internet).
IP allows communication beyond local networks, which MAC alone cannot achieve.
Example:
IP (Internet Protocol) is a network layer protocol (Layer 3) that is responsible for delivering
data packets from a source host to a destination host based on their IP addresses.
It provides logical addressing and routing functions.
1. Addressing
a. Every device in a network gets a unique IP address.
b. This address is logical, meaning it can change depending on the network.
2. Packetization
a. Breaks data into smaller packets, which are individually routed and reassembled
at the destination.
3. Routing
a. IP decides how packets move across networks by interacting with routing
protocols (like OSPF, BGP).
b. Routers read destination IPs to forward packets through optimal paths.
4. Encapsulation
a. IP encapsulates data from the Transport Layer (TCP/UDP) by adding its own IP
header, which contains addressing and control information.
5. Fragmentation and Reassembly
a. If a packet is too large for a link’s MTU (Maximum Transmission Unit), IP can
fragment it, and the destination will reassemble it.
➡ IPv6 was introduced to solve the limitations of IPv4, offering a much larger address space
and some enhancements.
✅Summary
Feature Description
Full Name Internet Protocol
Layer Network Layer (Layer 3)
Purpose Logical addressing and routing
IP Versions IPv4 (common), IPv6 (modern)
Key Roles Packet delivery, routing, fragmentation
An IP packet header is a block of metadata added by the network layer (Layer 3) to the
actual data. It tells routers how to deliver the data from the source to the destination across
multiple networks.
Think of it like:
The address label on a parcel — without it, the post office (router) won’t know where to send
your data.
Key Fields in an IPv4 Header
Field Size Purpose
Version 4 bits IP version (usually 4 or 6)
Header Length 4 bits Length of IP header in 32-bit words
Type of Service (ToS) 8 bits QoS/priority info
Total Length 16 bits Entire packet size (header + data)
Identification 16 bits Used for fragment tracking
Flags 3 bits Controls fragmentation (e.g., "Don't Fragment")
Fragment Offset 13 bits Reassembly order for fragmented packets
TTL (Time To Live) 8 bits Limits packet's life (hops) to avoid loops
Protocol 8 bits Next-layer protocol (e.g., TCP = 6, UDP = 17)
Header Checksum 16 bits Verifies header integrity
Source IP Address 32 bits Sender’s IP address
Destination IP Address 32 bits Receiver’s IP address
Options (Optional) Variable Used for testing, security, timestamps
1. Transport Layer (e.g., TCP) passes a segment (data) to the Network Layer.
2. The Network Layer wraps it with the IP header, forming an IP packet.
3. Each router reads the destination IP in the header to forward the packet.
4. The TTL decreases by 1 at each hop — if it hits 0, the packet is discarded (to prevent
infinite loops).
5. If a packet is too large, routers fragment it and use Identification + Fragment
Offset to reassemble it later.
6. When the packet reaches the destination, the IP header is removed, and the data is
handed up to the transport layer.
Visual Overview (Simplified):
[ IP Header ] + [ TCP/UDP Header ] + [ Actual Data ]
↓
Routers read IP header:
- Who sent this?
- Where is it going?
- Should I forward it?
↓
Forward packet to next router or final destination.
✅Summary:
Feature Description
Added by Network Layer (Layer 3)
This statement — "IP addresses belong to the network, not the devices connected to the
network" — is partially true, and it reflects a key concept in how IP addressing is designed.
Core Idea
So, an IP address is assigned to a device, but it must match the structure of the network it’s
connected to.
Example:
Network ID = [Link]
Host ID = 10
All devices in this subnet (e.g., [Link] to [Link]) are part of the same network.
If a device moves to another network (e.g., [Link]/24), it can’t keep the same IP,
because:
Great question — you're asking how we know that /24 means the first 3 octets are the
Network ID, and that’s fundamental to understanding subnetting and IP structure.
[Link] → [192].[168].[1].[50]
→ 8 bits . 8 bits . 8 bits . 8 bits
A subnet mask or CIDR notation (like /24) tells us how many bits are used for the Network
ID.
/24 means the first 24 bits (out of 32) represent the Network ID.
That leaves 8 bits (32 - 24) for the Host ID.
Octet Breakdown
Octet Value in IP Covered by /24?
1st 192 ✅Yes (8 bits)
2nd 168 ✅Yes (8 bits)
3rd 1 ✅Yes (8 bits)
4th 50 ❌No (host bits)
→ So the first 3 octets (192.168.1) form the Network ID, and the last octet (50) is the Host ID.
✅ Summary:
Let’s now understand what exactly "Host ID 50" means in the IP address [Link]/24.
It means this device is the 50th unique addressable host within the network [Link]/24.
In binary:
.50 = 00110010 (just an 8-bit number)
This value uniquely identifies a device within that subnet.
The Host ID must be:
o Non-zero (.0 is reserved for the network address)
o Not all 1s (.255 is reserved for broadcast)
Real-world analogy:
Imagine a street named [Link] (the network), and there are 254 houses (hosts) on it:
Then, the router uses ARP to find the MAC address of the device with that Host ID, and
delivers the packet.
✅Summary:
Field Value Meaning
IP Address [Link] Complete address
Network ID [Link] Identifies the subnet
Host ID 50 Device number within the subnet
Role Uniquely identifies one device in that subnet
This is not a device’s IP address — it represents a whole group of devices that are on the same
network. This group is called a subnet.
But:
✅So:
It is not a device.
Old Example:
Network ID = [Link]
Host ID = 10
All devices in this subnet (e.g., [Link] to [Link]) are part of the same network.
If a device moves to another network (e.g., [Link]/24), it can’t keep the same IP,
because:
If you move to a new building, you get a new apartment number in that building.
You can’t keep the same number from your old building — it wouldn’t make sense there.
✅Summary
Concept Description
IP Address Assigned to device, but based on the network
Network owns the range Devices are assigned IPs that fit within it
Mobility Moving to a new network requires a new IP
Why? So routers can properly forward packets
The IP address [Link] is the full (complete) address used to identify one unique device
on a network.
It includes:
The network part (e.g., 192.168.1) → tells routers which network the device is in.
The host part (e.g., .50) → tells routers or switches which device inside that network.
[Link] =
"Network [Link], House (Host) #50"
Just like:
So:
Recap:
Term Meaning
[Link]/24 The network name (not usable by a device)
[Link] A complete IP address of a device
[Link] to .254 All valid complete addresses for devices
[Link] Broadcast address (also not usable by a device)
So yes — "complete address" means the full IP address of a device, combining both:
✅Features:
Feature Value
Example:
A static IP address is an IP that is manually assigned to a device and does not change.
✅Features:
Feature Value
Assigned by Admin (manually configured)
Changes? No — remains fixed
Setup needed? Yes — must be set manually
Use case Servers, printers, routers, etc.
Example:
Dynamic IP Like getting a hotel room number — it may change every visit
Static IP Like owning a house — your address is fixed
✅Summary Table
Feature Dynamic IP Static IP
In most home or small office networks, the DHCP server is the router.
Example:
You connect to Wi-Fi → Router gives your phone IP [Link]
In Larger Networks (Offices, Data Centers):
✅Summary:
Network Type DHCP Role Played By
Home Wi-Fi Your router (e.g., TP-Link, Netgear)
Office network Usually a separate DHCP server (can be router too)
Data centers Centralized DHCP server (managed by admins)
Let's go step-by-step through the DHCP Handshake Process — it's how a device (like your
laptop or phone) gets an IP address from a DHCP server (usually a router).
→ Discover
→ Offer
→ Request
→ Acknowledgement
In Simple Words:
Step Who Says It Message Meaning
D Client → All “Is there a DHCP server?”
O Server → Client “Yes! Here's an IP you can use.”
R Client → Server “I accept this IP. Please confirm.”
A Server → Client “You’re all set. Use this IP.”
What Info Does DHCP Give?
Diagram
What is an IP Datagram?
Header = shipping label (who it's from, where it’s going, tracking info)
Payload = the contents inside the box
--------------------------------------------------------
| Version | IHL | TOS | Total Length |
| Identification | Flags | Fragment Offset |
| TTL | Protocol | Header Checksum | Header
| Source IP Address |
| Destination IP Address |
| Options (if any) |
|-----------------------------------------------------|
| Payload (Data) |
--------------------------------------------------------
1. Version (4 bits)
The entire size of the datagram, including header and data, in bytes.
Max size = 65,535 bytes.
6. Flags (3 bits) *
Control fragmentation:
o DF (Don't Fragment)
o MF (More Fragments)
9. Protocol (8 bits)
Used to detect errors in the IP header only (not the entire datagram).
Rarely used.
Can include things like security or routing instructions.
The actual content being carried (web request, email, file, etc.)
This part is passed to the higher-layer protocol (TCP/UDP/ICMP, etc.)
Although physically data goes from bottom (Layer 1) → up to top (Layer 7) at the receiver,
we usually explain the communication process from top (Layer 7) → down to Layer 1 on the
sender side.
Sender's Side:
1. Application Layer (Layer 5): You write the message (what you want to say)
2. Transport Layer (Layer 4): You pack it nicely (envelope, name)
3. Network Layer (Layer 3): You write the address (IP)
4. Data Link Layer (Layer 2): The post office handles sorting (MAC address)
5. Physical Layer (Layer 1): The truck delivers the letter (electrical or wireless signal)
Receiver's Side:
1. Layer 1: Receives the signal (The physical interface of the network adapter (NIC) or
Wi-fi Adapter — either wired or wireless — is what receives/requests for the signal at
Layer 1.)
2. Layer 2: Figures out which device it’s for (MAC)
3. Layer 3: Recognizes IP
4. Layer 4-5: Finally reads the message (application gets the data)
Because we are usually explaining it from the perspective of what the user wants to do — like:
Then we walk down the stack to explain how that request becomes bits and travels.
Real-world analogy:
✅Summary
Layer Role Why we explain it first
App Layer User action (visit website) That’s where the intention starts
Physical Layer Bits over wires/wireless Final step in sending
We explain top-down because it's easier to understand the logic and purpose.
But data travels bottom-up at the receiver.
Summary Table
Field Purpose
Version IPv4 or IPv6
Header Length How long is the header
Total Length Size of the datagram
TTL How many hops allowed
Protocol What type of data is in the payload
Source/Dest IP Where it's from / going
Fragmentation Info Helps reassemble split packets
Payload The actual data
In Simple Words:
The IP datagram is like an addressed parcel: the network reads the label (IP header) to send it the
right way, but only the recipient opens the content (payload).
IPv4 addresses are 32-bit numbers written in dotted-decimal format (like [Link]).
To manage and allocate these IPs efficiently, IPv4 was originally divided into 5 classes: A, B, C,
D, E. (D.E are not very useful).
Large organizations
Medium-sized networks
Small networks
Multicast
Research/Experimental
Back when IPv4 was designed, the internet was much smaller. To avoid confusion and waste,
addresses were grouped by class based on:
total ipv4 addresses: 4.3Billion (2 to the power 32)
Network size
Number of devices per network
Class A
Field Details
1st Octet Range 1 – 126
Default Subnet Mask [Link] (or /8)
Networks Available 128 (but 0 and 127 are reserved)
Hosts per Network ~16.7 million
Example [Link]
Class B
Field Details
1st Octet Range 128 – 191
Default Subnet Mask [Link] (or /16)
Networks Available ~16,384
Hosts per Network ~65,534
Example [Link]
Field Details
1st Octet Range 192 – 223
Default Subnet Mask [Link] (or /24)
Networks Available ~2 million
Hosts per Network 254
Example [Link]
Class D (Multicast)
Field Details
1st Octet Range 224 – 239
Use For multicast groups
Example [Link]
Not for assigning to individual devices — used for sending one packet to many receivers (like
video conferencing, streaming).
Class E (Experimental)
Field Details
Example [Link]
✅Now replaced by CIDR (Classless Inter-Domain Routing) which allows any subnet size
using slash notation (/8, /16, /24, etc.)
✅Summary Table
Class 1st Octet Range Hosts per Network Subnet Mask Use
A 1–126 ~16 million [Link] Large orgs
B 128–191 ~65,000 [Link] Medium orgs
C 192–223 254 [Link] Small networks
D 224–239 Multicast only — Group communication
E 240–255 Experimental — Research, not in use
Quick Reminder:
[ Network ID ] + [ Host ID ]
Detailed Breakdown:
Class: C
In binary:
11000000.10101000.00000001.00110010
= 192 .168 .1 .50
First 3 octets = network part: 192.168.1
Last octet = host part: 50
Rigid division wasted IPs (e.g., if you only need 300 hosts, Class B gives you 65,534)
Lacked flexibility
✅That’s why we now use CIDR (Classless Inter-Domain Routing), where you can create
custom-sized networks using subnet masks like /18, /27, etc.
Summary Table
Class Network ID Host ID Subnet Mask
A 8 bits 24 bits [Link] (/8)
B 16 bits 16 bits [Link] (/16)
C 24 bits 8 bits [Link] (/24)
IP Address: [Link]
Class: A
Default Subnet Mask: [Link] (or /8)
So:
o Network ID: 10
o Host ID: 5.23.1
So does it mean host ID is 5.23.1 and how do we identify the exact destination device from
this?
Breakdown:
Example:
✅Summary:
Great! You're asking how to interpret a multi-octet Host ID like 5.23.1 (in Class A), and how
to identify the exact device it refers to within the network. Let's break it down step by step:
✅Class C (Simple Case):
In Class C:
Example: [Link]
Subnet mask: /24 → first 3 octets = Network ID
Last octet = Host ID
So:
So:
Network ID = 10
Host ID = 5.23.1 → this identifies a unique device within the [Link] network
But how?
The host ID (3 octets) is treated as a single 24-bit number, just like the 1 in Class C was treated
as an 8-bit number.
The host ID 5.23.1 is not 3 separate host numbers, it's a single host number derived from 3
octets.
Analogy:
Class IP Address Host ID Device Number
C [Link] 10 10th device
A [Link] 5.23.1 = 333,569 333,569th device
First, remember:
An IP address like [Link] (Host ID 333,569) is just a label assigned to a device — but it
doesn't mean the device exists.
Just like how a phone number can be valid but unused, an IP can be assigned, but if no device is
using it, then…
If you try to send data to [Link] and no device is using that IP, here’s what happens:
Step-by-Step:
1. Your system checks its routing table to forward the packet to network [Link].
2. Once inside that network, your device (or the router) sends an ARP request:
3. Who has IP [Link]? Tell me your MAC address.
4. No one replies, because no device has claimed that IP.
As a result:
Real-World Analogy:
✅Summary:
Situation What Happens
Valid IP, but no device has it ARP fails, packet undeliverable
Router tries to send it anyway Packet dropped or bounced (ICMP unreachable)
User perspective Website/app will show failure/error
Bonus Tip:
Let’s dive into a detailed and practical explanation of ARP, including how ARP Request and
ARP Reply work — step by step, with examples and analogy.
What is ARP?
Its job is to map an IP address to a MAC address inside a local network (LAN).
In simple terms:
"I know the IP of a device, but I need its MAC address to send data to it at Layer 2."
So, before a device sends data to another IP on the same network, it first uses ARP to get the
MAC address.
Real-World Analogy:
Imagine you have someone's name (IP) but don’t know their exact seat in a room (MAC).
You shout:
Let’s say Host A wants to communicate with Host B on the same LAN:
1. ARP Request
arp -a
Key Points:
ARP Request ARP Reply
Broadcast to all devices Unicast to requesting device
Asks: “Who has this IP?” Says: “That IP is at this MAC”
Sent when MAC is unknown Sent in response to request
Limitations of ARP:
✅Summary: